@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | // recreate the table with the new structure |
12 | 12 | $this->execute("DROP TABLE IF EXISTS $cms_static"); |
13 | - $sql =<<<EOQ |
|
13 | + $sql = <<<EOQ |
|
14 | 14 | CREATE TABLE IF NOT EXISTS `cms_static_content` ( |
15 | 15 | `key` varchar(100) NOT NULL COMMENT 'a key to access the content' COLLATE utf8mb4_unicode_ci, |
16 | 16 | `page_id` INT UNSIGNED NULL COMMENT 'if provided, restrict content to the associated page', |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $connection = \Yii::$app->getDb(); |
16 | 16 | |
17 | 17 | // create the various tables for dds |
18 | - $sql=<<<EOQ |
|
18 | + $sql = <<<EOQ |
|
19 | 19 | -- -------------------------------------------------------- |
20 | 20 | |
21 | 21 | -- |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return array of |
34 | 34 | * ['class_type'] => [ 'class_type', 'module', 'label', 'description', ['deleted'] ] |
35 | 35 | */ |
36 | - public function listClasses(&$paginator=[], $filters=[], $orderBy=[], $includeDeleted=false); |
|
36 | + public function listClasses(&$paginator = [], $filters = [], $orderBy = [], $includeDeleted = false); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Create an IPhoebeClass interface for a new class reference. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @throw \RuntimeException if the classRef already exists or something |
47 | 47 | * else went wrong during creation |
48 | 48 | */ |
49 | - public function addClass(&$classType, $module=''); |
|
49 | + public function addClass(&$classType, $module = ''); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Get hold of an IPhoebeClass interface for a particular class reference. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return null | \neon\phoebe\interfaces\IPhoebeClass |
60 | 60 | * returns null if the classType or version doesn't exist |
61 | 61 | */ |
62 | - public function getClass($classType, $version=null, $classOverrideCriteria=[]); |
|
62 | + public function getClass($classType, $version = null, $classOverrideCriteria = []); |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Get hold of a set of IPhoebeClasses for a set of classType. The latest version |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * will return all rows that have been soft deleted. |
100 | 100 | * @return array an array of objects of this class |
101 | 101 | */ |
102 | - public function listObjects($classType, &$paginator=[], $filters=[], $orderBy=[], $additionalFields=[]); |
|
102 | + public function listObjects($classType, &$paginator = [], $filters = [], $orderBy = [], $additionalFields = []); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Create and save a new IPhoebeObject of a particular class type |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return \neon\phoebe\interfaces\IPhoebeObject |
112 | 112 | * @throw \RuntimeException if anything went wrong during the addition |
113 | 113 | */ |
114 | - public function addObject($classType, $classOverrideCriteria=[]); |
|
114 | + public function addObject($classType, $classOverrideCriteria = []); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Get hold of a phoebe object interface for managing an instance |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * the set of fields provided. |
49 | 49 | * @return array a form definition |
50 | 50 | */ |
51 | - public function getClassFormDefinition(array $fields=[]); |
|
51 | + public function getClassFormDefinition(array $fields = []); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Get the class definition in a suitable format to present to a class builder app |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * 'date' - a date used to select which override is active at that date |
156 | 156 | * @return null|array null if not found or the override parameters |
157 | 157 | */ |
158 | - public function findOverride($filters=[]); |
|
158 | + public function findOverride($filters = []); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Get an override by its uuid. This will return soft deleted overrides. |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @return uuid|errors returns the uuid of the created override or the array of |
179 | 179 | * errors if not possible |
180 | 180 | */ |
181 | - public function addOverride($label, $selector='', $activeFrom=null, $activeTo=null, $isActive=true); |
|
181 | + public function addOverride($label, $selector = '', $activeFrom = null, $activeTo = null, $isActive = true); |
|
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Edit the properties of an override |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * an override and $force was not true, or the override does not apply to |
93 | 93 | * this class of object; and array if there are any other errors |
94 | 94 | */ |
95 | - public function setOverride($overrideUuid, $force=false); |
|
95 | + public function setOverride($overrideUuid, $force = false); |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Get the class override used when creating the object |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @return array an array of history entries with |
114 | 114 | * the historical uuid, and date archived |
115 | 115 | */ |
116 | - public function listHistory(&$paginator=[]); |
|
116 | + public function listHistory(&$paginator = []); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Get the object's historical data from its historical uuid |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param type $objects |
108 | 108 | */ |
109 | - protected function updateDataFromDds(&$objects, $isTree=true) |
|
109 | + protected function updateDataFromDds(&$objects, $isTree = true) |
|
110 | 110 | { |
111 | 111 | // It may be better to flatten the data and make a more intelligent |
112 | 112 | // set of selects from the database, or use the idea of requests and |
113 | 113 | // do this in two passes |
114 | 114 | $dds = neon('dds')->getIDdsObjectManagement(); |
115 | - foreach($objects as &$object) { |
|
115 | + foreach ($objects as &$object) { |
|
116 | 116 | if (!empty($object['_uuid'])) { |
117 | 117 | // update the object definition to pick up any new fields from the definition |
118 | 118 | $object = array_merge($this->getAllowedFieldsForClass($object['_classType']), $object); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param array &$objects |
192 | 192 | * @return array |
193 | 193 | */ |
194 | - protected function extractObjects(&$objects, &$extractedObjectIds=null) |
|
194 | + protected function extractObjects(&$objects, &$extractedObjectIds = null) |
|
195 | 195 | { |
196 | 196 | // |
197 | 197 | // TODO - this code is particularly messy - refactor |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | if (!empty($objRend['dataSourceMap'])) { |
395 | 395 | foreach ($objRend['dataSourceMap'] as $member => $dsMap) { |
396 | 396 | $dsDef = $this->getDataSourceDefinition($dsMap['id']); |
397 | - if (($dsObj = $this->getDataSourceObject($dsDef['label']))!==null) { |
|
397 | + if (($dsObj = $this->getDataSourceObject($dsDef['label'])) !== null) { |
|
398 | 398 | $object[$member] = $dsObj[$dsMap['memberRef']]; |
399 | 399 | } |
400 | 400 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @inheritdoc |
25 | 25 | */ |
26 | - public function getClassFormDefinition(array $fields=[]) |
|
26 | + public function getClassFormDefinition(array $fields = []) |
|
27 | 27 | { |
28 | 28 | // if there is no definition return an empty form |
29 | 29 | if (empty($this->definition)) |
@@ -133,19 +133,19 @@ discard block |
||
133 | 133 | protected function convertRenderablesToFields($key, $renderables) { |
134 | 134 | if (!isset($renderables[$key])) { |
135 | 135 | dd("Key $key doesn't exist in the form definition", $renderables); |
136 | - throw new \RuntimeException("Key $key doesn't exist in the form definition");} |
|
136 | + throw new \RuntimeException("Key $key doesn't exist in the form definition"); } |
|
137 | 137 | $rend = $renderables[$key]; |
138 | - $field=[]; |
|
138 | + $field = []; |
|
139 | 139 | if (!empty($rend['type'])) { |
140 | 140 | $field = []; |
141 | - switch($rend['type']) { |
|
141 | + switch ($rend['type']) { |
|
142 | 142 | case 'FormComponent': |
143 | 143 | if (isset($rend['items'])) |
144 | 144 | $field['fields'] = $this->addItems($rend['items'], $renderables); |
145 | 145 | break; |
146 | 146 | case 'ClassComponent': |
147 | 147 | $classDefinition = isset($rend['definition']) ? $rend['definition'] : []; |
148 | - if (count($rend['items'])>0) { |
|
148 | + if (count($rend['items']) > 0) { |
|
149 | 149 | $field['fields'] = []; |
150 | 150 | $field['label'] = ''; |
151 | 151 | if (isset($classDefinition['showLabel']) && $classDefinition['showLabel']) |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $field['allowRemove'] = $allowChangeOfRepeats; |
218 | 218 | |
219 | 219 | // now set the template header part |
220 | - $field['template']['class'] = "neon\\core\\form\\Form"; |
|
220 | + $field['template']['class'] = "neon\\core\\form\\Form"; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * so we know what object it belongs to if set |
226 | 226 | * @return array |
227 | 227 | */ |
228 | - protected function createHiddenField($name, $value=null) |
|
228 | + protected function createHiddenField($name, $value = null) |
|
229 | 229 | { |
230 | 230 | return [ |
231 | 231 | 'class' => "neon\\core\\form\\fields\\Hidden", |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | protected function createFieldName($field) |
239 | 239 | { |
240 | 240 | $uuid = isset($field['id']) ? $field['id'] : Hash::uuid64(); |
241 | - return str_replace(['-','_'],['a','Z'], $uuid); |
|
241 | + return str_replace(['-', '_'], ['a', 'Z'], $uuid); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | } |
245 | 245 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | use PhoebeTrait; |
20 | 20 | |
21 | - public function __construct($config=[]) |
|
21 | + public function __construct($config = []) |
|
22 | 22 | { |
23 | 23 | $path = '\neon\phoebe\services\adapters\appforms'; |
24 | 24 | $config['phoebeType'] = 'applicationForm'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | parent::__construct($config); |
29 | 29 | } |
30 | 30 | |
31 | - public function getClass($classType, $version=null, $classOverrideCriteria=[]) |
|
31 | + public function getClass($classType, $version = null, $classOverrideCriteria = []) |
|
32 | 32 | { |
33 | 33 | $class = parent::getClass($classType, $version, $classOverrideCriteria); |
34 | 34 | // update member definitions with the latest from the database and |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * values can be changed if they were changed in the Daedalus definition |
29 | 29 | * @param type $definition |
30 | 30 | */ |
31 | - protected function updateDefinitionFromDds($definition, $includeAll=false) |
|
31 | + protected function updateDefinitionFromDds($definition, $includeAll = false) |
|
32 | 32 | { |
33 | 33 | if (!empty($definition['renderables'])) { |
34 | 34 | $classes = $this->getDdsClassDefinitions($definition); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
165 | - if (count($newClassTypes)>0) { |
|
165 | + if (count($newClassTypes) > 0) { |
|
166 | 166 | $newClasses = $this->ddsPhoebe()->getClasses($newClassTypes); |
167 | 167 | foreach ($newClasses as $newClass) { |
168 | 168 | $requestedClasses[$newClass->class_type] = $newClass; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if (!isset($memberDefinition['definition'][$key]) || ($memberDefinition['definition'][$key] != $value)) |
186 | 186 | $differences[$key] = $value; |
187 | 187 | } |
188 | - $renderable['changes']=$differences; |
|
188 | + $renderable['changes'] = $differences; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | protected function sanitiseDefinition(&$definition) |
199 | 199 | { |
200 | 200 | /** Remove Orphaned Renderables **/ |
201 | - $items = [ $definition['rootNode'] ]; |
|
201 | + $items = [$definition['rootNode']]; |
|
202 | 202 | foreach ($definition['renderables'] as $renderable) { |
203 | 203 | if (isset($renderable['items'])) { |
204 | - $items = array_merge($items,$renderable['items']); |
|
204 | + $items = array_merge($items, $renderable['items']); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // remove renderables not linked via rootNode |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $uuid64s[] = Hash::uuid2uuid64($key); |
229 | 229 | } |
230 | 230 | $serialised = str_replace($keys, $uuid64s, $serialised); |
231 | - $definition = json_decode($serialised,true); |
|
231 | + $definition = json_decode($serialised, true); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | private function ddsPhoebe() |