Cheetah
Constraint.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Intervention\Image;
4 
5 class Constraint
6 {
10  const ASPECTRATIO = 1;
11 
15  const UPSIZE = 2;
16 
22  private $size;
23 
29  private $fixed = 0;
30 
36  public function __construct(Size $size)
37  {
38  $this->size = $size;
39  }
40 
46  public function getSize()
47  {
48  return $this->size;
49  }
50 
56  public function fix($type)
57  {
58  $this->fixed = ($this->fixed & ~(1 << $type)) | (1 << $type);
59  }
60 
67  public function isFixed($type)
68  {
69  return (bool) ($this->fixed & (1 << $type));
70  }
71 
77  public function aspectRatio()
78  {
79  $this->fix(self::ASPECTRATIO);
80  }
81 
87  public function upsize()
88  {
89  $this->fix(self::UPSIZE);
90  }
91 }
Intervention\Image\Constraint
Definition: Constraint.php:6
Intervention\Image\Constraint\fix
fix($type)
Definition: Constraint.php:56
php
Intervention\Image\Constraint\getSize
getSize()
Definition: Constraint.php:46
Intervention\Image\Constraint\__construct
__construct(Size $size)
Definition: Constraint.php:36
Intervention\Image\Constraint\ASPECTRATIO
const ASPECTRATIO
Definition: Constraint.php:10
Intervention\Image\Constraint\UPSIZE
const UPSIZE
Definition: Constraint.php:15
Intervention\Image\Constraint\aspectRatio
aspectRatio()
Definition: Constraint.php:77
Intervention\Image\Constraint\upsize
upsize()
Definition: Constraint.php:87
Intervention\Image\Constraint\isFixed
isFixed($type)
Definition: Constraint.php:67
Intervention\Image\Size
Definition: Size.php:8
Intervention\Image
Definition: AbstractColor.php:3