1 | <?php |
||
8 | class CropTwigExtension extends \Twig_Extension |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $root_path; |
||
14 | |||
15 | public function __construct($root_path) |
||
19 | |||
20 | /** |
||
21 | * {@inheritdoc} |
||
22 | */ |
||
23 | public function getName() |
||
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | public function getFilters() |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function getFunctions() |
||
47 | |||
48 | /** |
||
49 | * Crops a file and returns crop's web path |
||
50 | * |
||
51 | * @param array $croppable |
||
52 | * @param int $index |
||
53 | * @return mixed |
||
54 | */ |
||
55 | public function crop(array $croppable, $index = 0) |
||
69 | |||
70 | /** |
||
71 | * Returns the name for a cropped file |
||
72 | * |
||
73 | * @param UploadableFile $file |
||
74 | * @param $coordinates |
||
75 | * @return mixed |
||
76 | */ |
||
77 | protected function makeCropName(UploadableFile $file, $coordinates) |
||
84 | |||
85 | /** |
||
86 | * Crops a file |
||
87 | * |
||
88 | * @param UploadableFile $file |
||
89 | * @param $coordinates |
||
90 | * @param $path |
||
91 | */ |
||
92 | protected function doCrop(UploadableFile $file, $coordinates, $path) |
||
132 | |||
133 | /** |
||
134 | * Returns image size info |
||
135 | * |
||
136 | * @param $image |
||
137 | * @param bool $relative |
||
138 | * @return array |
||
139 | */ |
||
140 | public function getSize($image, $relative = false) |
||
152 | } |
As per the PSR-2 coding standard, the
break
(or other terminating) statement must be on a line of its own.To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.