PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / intervention / image / src / Intervention / Image / Constraint.php

Constraint.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/intervention/image/src/Intervention/Image/Constraint.php

93 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image;
4
5 class Constraint
6 {
7 /**
8 * Bit value of aspect ratio constraint
9 */
10 const ASPECTRATIO = 1;
11
12 /**
13 * Bit value of upsize constraint
14 */
15 const UPSIZE = 2;
16
17 /**
18 * Constraint size
19 *
20 * @var \Intervention\Image\Size
21 */
22 private $size;
23
24 /**
25 * Integer value of fixed parameters
26 *
27 * @var int
28 */
29 private $fixed = 0;
30
31 /**
32 * Create a new constraint based on size
33 *
34 * @param Size $size
35 */
36 public function __construct(Size $size)
37 {
38 $this->size = $size;
39 }
40
41 /**
42 * Returns current size of constraint
43 *
44 * @return \Intervention\Image\Size
45 */
46 public function getSize()
47 {
48 return $this->size;
49 }
50
51 /**
52 * Fix the given argument in current constraint
53 *
54 * @param int $type
55 * @return void
56 */
57 public function fix($type)
58 {
59 $this->fixed = ($this->fixed & ~(1 << $type)) | (1 << $type);
60 }
61
62 /**
63 * Checks if given argument is fixed in current constraint
64 *
65 * @param int $type
66 * @return boolean
67 */
68 public function isFixed($type)
69 {
70 return (bool) ($this->fixed & (1 << $type));
71 }
72
73 /**
74 * Fixes aspect ratio in current constraint
75 *
76 * @return void
77 */
78 public function aspectRatio()
79 {
80 $this->fix(self::ASPECTRATIO);
81 }
82
83 /**
84 * Fixes possibility to size up in current constraint
85 *
86 * @return void
87 */
88 public function upsize()
89 {
90 $this->fix(self::UPSIZE);
91 }
92 }
93