1 | <?php |
||
36 | class ChildrenCountPlugin extends AbstractPlugin |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * Process the plugin functionality. |
||
41 | * |
||
42 | * @return void |
||
43 | * @throws \Exception Is thrown, if the plugin can not be processed |
||
44 | */ |
||
45 | public function process() |
||
65 | |||
66 | /** |
||
67 | * Prepare the attributes of the entity that has to be persisted. |
||
68 | * |
||
69 | * @return array The prepared attributes |
||
70 | */ |
||
71 | protected function prepareAttributes() |
||
84 | |||
85 | /** |
||
86 | * Initialize the category with the passed attributes and returns an instance. |
||
87 | * |
||
88 | * @param array $attr The category attributes |
||
89 | * |
||
90 | * @return array The initialized category |
||
91 | */ |
||
92 | protected function initializeCategory(array $attr) |
||
99 | |||
100 | /** |
||
101 | * Return's the primary key of the passed category. |
||
102 | * |
||
103 | * @param array $category The category to return the primary key for |
||
104 | * |
||
105 | * @return integer The primary key of the category |
||
106 | */ |
||
107 | protected function getPrimaryKey(array $category) |
||
111 | |||
112 | /** |
||
113 | * Return's the category with the passed ID. |
||
114 | * |
||
115 | * @param string $id The ID of the category to return |
||
116 | * |
||
117 | * @return array The category |
||
118 | */ |
||
119 | protected function loadCategory($id) |
||
123 | |||
124 | /** |
||
125 | * Return's the children count of the category with the passed path. |
||
126 | * |
||
127 | * @param string $path The path of the category to count the children for |
||
128 | * |
||
129 | * @return integer The children count of the category with the passed path |
||
130 | */ |
||
131 | protected function loadCategoryChildrenChildrenCount($path) |
||
135 | |||
136 | /** |
||
137 | * Persist's the passed category data and return's the ID. |
||
138 | * |
||
139 | * @param array $category The category data to persist |
||
140 | * |
||
141 | * @return string The ID of the persisted entity |
||
142 | */ |
||
143 | protected function persistCategory($category) |
||
147 | |||
148 | /** |
||
149 | * Merge's and return's the entity with the passed attributes and set's the |
||
150 | * status to 'update'. |
||
151 | * |
||
152 | * @param array $entity The entity to merge the attributes into |
||
153 | * @param array $attr The attributes to be merged |
||
154 | * |
||
155 | * @return array The merged entity |
||
156 | */ |
||
157 | protected function mergeEntity(array $entity, array $attr) |
||
161 | } |
||
162 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: