| 1 | <?php |
||
| 10 | class CategoryHelper extends AbstractHelper |
||
| 11 | { |
||
| 12 | /** @var CategoryService */ |
||
| 13 | private $categoryService; |
||
| 14 | |||
| 15 | /** @var array */ |
||
| 16 | private $homepageCategories; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * CategoryHelper constructor. |
||
| 20 | * |
||
| 21 | * @param CategoryService $categoryService |
||
| 22 | */ |
||
| 23 | public function __construct(CategoryService $categoryService) |
||
| 27 | |||
| 28 | /** @return $this */ |
||
| 29 | public function __invoke() |
||
| 33 | |||
| 34 | /** @return \Zend\Db\ResultSet\ResultSet */ |
||
| 35 | public function forSelect() |
||
| 39 | |||
| 40 | /** |
||
| 41 | * We need to return X categories with Y posts in every category sorted by |
||
| 42 | * magic for homepage. magic = most viewed, most comments, most appropriate |
||
| 43 | * for the user etc. etc. for now return just latest. |
||
| 44 | */ |
||
| 45 | public function forHomepage() |
||
| 53 | } |
||
| 54 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.