@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | interface IColumn |
| 16 | 16 | { |
| 17 | - public function __construct($config=[]); |
|
| 17 | + public function __construct($config = []); |
|
| 18 | 18 | |
| 19 | - public function renderDataCell($model, $key, $index); // GRID: called by grid |
|
| 19 | + public function renderDataCell($model, $key, $index); // GRID: called by grid |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Renders the contents of the cell (can be overriden by setting self::setDataCellContentFunction) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * Set whether this column is sortable or not |
| 150 | 150 | * @param bool $bool |
| 151 | 151 | */ |
| 152 | - public function setIsSortable($bool=true); |
|
| 152 | + public function setIsSortable($bool = true); |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Is the column sortable |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * |
| 251 | 251 | * @param boolean $bool |
| 252 | 252 | */ |
| 253 | - public function setAsIndex($bool=true); |
|
| 253 | + public function setAsIndex($bool = true); |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Set the title of the column |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * |
| 300 | 300 | * @return null|callable |
| 301 | 301 | */ |
| 302 | - public function getSearchFunction(); // GRID: called by grid |
|
| 302 | + public function getSearchFunction(); // GRID: called by grid |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * Set the database field name. This is used to lookup the row data, and in filters and ordering |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * @param array $linkOptions |
| 363 | 363 | * @return mixed |
| 364 | 364 | */ |
| 365 | - public function addRowAction($key, $text, $linkOptions=[]); |
|
| 365 | + public function addRowAction($key, $text, $linkOptions = []); |
|
| 366 | 366 | |
| 367 | 367 | public function renderRowActions($model, $key, $index); |
| 368 | 368 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | return $this->_width; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function __construct($config=[]) |
|
| 176 | + public function __construct($config = []) |
|
| 177 | 177 | { |
| 178 | 178 | parent::__construct($config); |
| 179 | 179 | if (!isset($config['key'])) { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | /** |
| 274 | 274 | * @inheritDoc |
| 275 | 275 | */ |
| 276 | - public function setIsSortable($bool=true) |
|
| 276 | + public function setIsSortable($bool = true) |
|
| 277 | 277 | { |
| 278 | 278 | $this->_sortable = $bool; |
| 279 | 279 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | return $this->_sortable; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - public function setAsIndex($bool=true) |
|
| 289 | + public function setAsIndex($bool = true) |
|
| 290 | 290 | { |
| 291 | 291 | $this->grid->setIndexedByColumn($this->key); |
| 292 | 292 | // thi is a bit gnarly but tests for yii Active record data providers specifically |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return $this->_dataCellContentFunction; |
| 355 | 355 | } |
| 356 | 356 | // check for convention |
| 357 | - $functionName = 'render' . $this->key; |
|
| 357 | + $functionName = 'render'.$this->key; |
|
| 358 | 358 | if (method_exists($this->grid, $functionName) && $functionName !== 'renderfile') { |
| 359 | 359 | return $functionName; |
| 360 | 360 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | /** |
| 426 | 426 | * @inheritDoc |
| 427 | 427 | */ |
| 428 | - public function setDbField($field){ |
|
| 428 | + public function setDbField($field) { |
|
| 429 | 429 | $this->_dbField = $field; |
| 430 | 430 | return $this; |
| 431 | 431 | } |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | /** |
| 434 | 434 | * @inheritDoc |
| 435 | 435 | */ |
| 436 | - public function getDbField(){ |
|
| 437 | - if ($this->_dbField === null){ |
|
| 436 | + public function getDbField() { |
|
| 437 | + if ($this->_dbField === null) { |
|
| 438 | 438 | // set to be the key |
| 439 | 439 | $this->_dbField = $this->key; |
| 440 | 440 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | /** |
| 452 | 452 | * @inheritDoc |
| 453 | 453 | */ |
| 454 | - public function setDbSortField($field){ |
|
| 454 | + public function setDbSortField($field) { |
|
| 455 | 455 | $this->_dbSortField = $field; |
| 456 | 456 | return $this; |
| 457 | 457 | } |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | /** |
| 460 | 460 | * @inheritDoc |
| 461 | 461 | */ |
| 462 | - public function getDbSortField(){ |
|
| 463 | - if ($this->_dbSortField === null){ |
|
| 462 | + public function getDbSortField() { |
|
| 463 | + if ($this->_dbSortField === null) { |
|
| 464 | 464 | // set to be the key |
| 465 | 465 | $this->_dbSortField = $this->dbField; |
| 466 | 466 | } |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | if ($this->grid->hasSort($this->key)) { |
| 510 | 510 | $sort = $this->grid->hasSortDescending() ? ' - ' : ' + '; |
| 511 | 511 | } |
| 512 | - $sortParam = $this->grid->hasSortDescending() ? $this->key : '-' . $this->key; |
|
| 512 | + $sortParam = $this->grid->hasSortDescending() ? $this->key : '-'.$this->key; |
|
| 513 | 513 | $url = neon()->getUrlManager()->createUrl([\Yii::$app->controller->getRoute(), $this->grid->id => ['sort' => $sortParam]]); |
| 514 | - return Html::a($this->getTitle() . $sort, $url, ['data-sort'=>$sortParam]); |
|
| 514 | + return Html::a($this->getTitle().$sort, $url, ['data-sort'=>$sortParam]); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | public function getFilterField() |
| 566 | 566 | { |
| 567 | 567 | $field = $this->getBaseFilterField(); |
| 568 | - foreach($this->filterFieldConfig as $key => $value) |
|
| 568 | + foreach ($this->filterFieldConfig as $key => $value) |
|
| 569 | 569 | $field[$key] = $value; |
| 570 | 570 | return $field; |
| 571 | 571 | } |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | public function setMemberConfig($config) |
| 583 | 583 | { |
| 584 | - foreach($config as $key => $value) { |
|
| 584 | + foreach ($config as $key => $value) { |
|
| 585 | 585 | if (isset($this->member->$key)) |
| 586 | 586 | $this->member->$key = $value; |
| 587 | 587 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | /** |
| 592 | 592 | * @inheritDoc |
| 593 | 593 | */ |
| 594 | - public function getCellData($row, $noValue='-') |
|
| 594 | + public function getCellData($row, $noValue = '-') |
|
| 595 | 595 | { |
| 596 | 596 | $data = null; |
| 597 | 597 | $key = $this->getKey(); |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | if (is_array($display)) { |
| 645 | 645 | $display = implode(',', $display); |
| 646 | 646 | } |
| 647 | - return "<span title=\"".str_replace('"',"'", html_entity_decode(strip_tags($display)))."\">$out</span>"; |
|
| 647 | + return "<span title=\"".str_replace('"', "'", html_entity_decode(strip_tags($display)))."\">$out</span>"; |
|
| 648 | 648 | } |
| 649 | 649 | return $this->getCellData($model); |
| 650 | 650 | } |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | */ |
| 655 | 655 | public function getFieldName() |
| 656 | 656 | { |
| 657 | - return $this->getGrid()->getId() . '[' . $this->key . '][search]'; |
|
| 657 | + return $this->getGrid()->getId().'['.$this->key.'][search]'; |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | /** |
@@ -728,12 +728,12 @@ discard block |
||
| 728 | 728 | throw new \Exception('Unable to call a valid search function'); |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - protected $_actions =[]; |
|
| 731 | + protected $_actions = []; |
|
| 732 | 732 | |
| 733 | 733 | /** |
| 734 | 734 | * @inheritDoc |
| 735 | 735 | */ |
| 736 | - public function addRowAction($key, $text, $linkOptions=[]) |
|
| 736 | + public function addRowAction($key, $text, $linkOptions = []) |
|
| 737 | 737 | { |
| 738 | 738 | $linkOptions['text'] = $text; |
| 739 | 739 | $linkOptions['data-action'] = $key; |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | $out = '<div class="neonGrid_rowActions">'; |
| 761 | 761 | $i = 0; |
| 762 | - foreach($this->_actions as $actionKey => $linkOptions) { |
|
| 762 | + foreach ($this->_actions as $actionKey => $linkOptions) { |
|
| 763 | 763 | if ($i > 0) $out .= ' | '; |
| 764 | 764 | if (isset($linkOptions['function'])) { |
| 765 | 765 | $func = $linkOptions['function']; |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | * @param array $arguments of arguments |
| 787 | 787 | * @return mixed |
| 788 | 788 | */ |
| 789 | - public function callFunction($function, $arguments=[]) |
|
| 789 | + public function callFunction($function, $arguments = []) |
|
| 790 | 790 | { |
| 791 | 791 | if (is_string($function)) { |
| 792 | 792 | return call_user_func_array([$this->grid, $function], $arguments); |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | if (count($columnData)) { |
| 812 | 812 | $this->member->dataMapFilters = ['uuid' => $columnData]; |
| 813 | 813 | } |
| 814 | - foreach($models as $model) { |
|
| 814 | + foreach ($models as $model) { |
|
| 815 | 815 | $this->member->makeMapRequest($this->getCellData($model, null)); |
| 816 | 816 | } |
| 817 | 817 | } |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | public function editObject($changes) |
| 42 | 42 | { |
| 43 | 43 | // check if there's anything to do |
| 44 | - if (empty($changes) || $changes == $this->data) |
|
| 45 | - return true; |
|
| 44 | + if (empty($changes) || $changes == $this->data) { |
|
| 45 | + return true; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | // extract the data and save appropriately to |
| 48 | 49 | // the associated database tables ... if any |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | public function setDataSources($sources) |
| 60 | 61 | { |
| 61 | 62 | foreach ($sources as $key=>$value) { |
| 62 | - if (empty($value)) |
|
| 63 | - unset($sources[$key]); |
|
| 63 | + if (empty($value)) { |
|
| 64 | + unset($sources[$key]); |
|
| 65 | + } |
|
| 64 | 66 | } |
| 65 | 67 | $this->dataSourceIds = $sources; |
| 66 | 68 | } |
@@ -97,8 +99,9 @@ discard block |
||
| 97 | 99 | */ |
| 98 | 100 | protected function getDataSources() |
| 99 | 101 | { |
| 100 | - foreach ($this->dataSourceIds as $key=>$id) |
|
| 101 | - $this->dataSourceObjects[$key] = $this->getDds()->getObject($id); |
|
| 102 | + foreach ($this->dataSourceIds as $key=>$id) { |
|
| 103 | + $this->dataSourceObjects[$key] = $this->getDds()->getObject($id); |
|
| 104 | + } |
|
| 102 | 105 | } |
| 103 | 106 | |
| 104 | 107 | /** |
@@ -118,8 +121,9 @@ discard block |
||
| 118 | 121 | $object = array_merge($this->getAllowedFieldsForClass($object['_classType']), $object); |
| 119 | 122 | // now update the object with the data from daedalus |
| 120 | 123 | $data = $dds->getObject($object['_uuid']); |
| 121 | - if ($data) |
|
| 122 | - $object = array_replace($object, array_intersect_key($data, $object)); |
|
| 124 | + if ($data) { |
|
| 125 | + $object = array_replace($object, array_intersect_key($data, $object)); |
|
| 126 | + } |
|
| 123 | 127 | } |
| 124 | 128 | // recursively update if this is in a tree structure |
| 125 | 129 | if ($isTree && is_array($object)) { |
@@ -179,8 +183,9 @@ discard block |
||
| 179 | 183 | } |
| 180 | 184 | } |
| 181 | 185 | } |
| 182 | - if (count($relations)) |
|
| 183 | - $this->saveLinkedObjects($relations); |
|
| 186 | + if (count($relations)) { |
|
| 187 | + $this->saveLinkedObjects($relations); |
|
| 188 | + } |
|
| 184 | 189 | } |
| 185 | 190 | |
| 186 | 191 | /** |
@@ -216,8 +221,9 @@ discard block |
||
| 216 | 221 | $relations = $renderables[$subRenderable]['relations']; |
| 217 | 222 | foreach ($relations as $relation) { |
| 218 | 223 | $memberRef = $relation['memberRef']; |
| 219 | - if (!isset($extracted['__relations'][$objId][$memberRef])) |
|
| 220 | - $extracted['__relations'][$objId][$memberRef] = []; |
|
| 224 | + if (!isset($extracted['__relations'][$objId][$memberRef])) { |
|
| 225 | + $extracted['__relations'][$objId][$memberRef] = []; |
|
| 226 | + } |
|
| 221 | 227 | $extracted['__relations'][$objId][$memberRef] = array_merge($extracted['__relations'][$objId][$memberRef], $newObjectIds); |
| 222 | 228 | } |
| 223 | 229 | } |
@@ -259,8 +265,9 @@ discard block |
||
| 259 | 265 | if (empty($fieldsForClass[$classType])) { |
| 260 | 266 | $definition = $this->getDefinition(); |
| 261 | 267 | foreach ($definition['renderables'] as $r) { |
| 262 | - if ($r['type'] == 'MemberComponent') |
|
| 263 | - $fieldsForClass[$r['class_type']][$r['member_ref']] = null; |
|
| 268 | + if ($r['type'] == 'MemberComponent') { |
|
| 269 | + $fieldsForClass[$r['class_type']][$r['member_ref']] = null; |
|
| 270 | + } |
|
| 264 | 271 | } |
| 265 | 272 | } |
| 266 | 273 | return $fieldsForClass[$classType]; |
@@ -322,8 +329,9 @@ discard block |
||
| 322 | 329 | if (isset($renderables[$phoebeKey])) { |
| 323 | 330 | // check the renderable exists and is a class component |
| 324 | 331 | $ren = $renderables[$phoebeKey]; |
| 325 | - if ($ren['type'] != 'ClassComponent') |
|
| 326 | - continue; |
|
| 332 | + if ($ren['type'] != 'ClassComponent') { |
|
| 333 | + continue; |
|
| 334 | + } |
|
| 327 | 335 | |
| 328 | 336 | // create the object and any required data params |
| 329 | 337 | $object = [ |
@@ -334,8 +342,9 @@ discard block |
||
| 334 | 342 | foreach ($ren['items'] as $item) { |
| 335 | 343 | if (isset($renderables[$item])) { |
| 336 | 344 | $iRen = $renderables[$item]; |
| 337 | - if ($iRen['type'] != 'MemberComponent') |
|
| 338 | - continue; |
|
| 345 | + if ($iRen['type'] != 'MemberComponent') { |
|
| 346 | + continue; |
|
| 347 | + } |
|
| 339 | 348 | $object[$iRen['member_ref']] = null; |
| 340 | 349 | } |
| 341 | 350 | } |
@@ -455,8 +464,9 @@ discard block |
||
| 455 | 464 | private $_class = null; |
| 456 | 465 | private function getClass() |
| 457 | 466 | { |
| 458 | - if (!$this->_class) |
|
| 459 | - $this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType); |
|
| 467 | + if (!$this->_class) { |
|
| 468 | + $this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType); |
|
| 469 | + } |
|
| 460 | 470 | return $this->_class; |
| 461 | 471 | } |
| 462 | 472 | |
@@ -469,8 +479,9 @@ discard block |
||
| 469 | 479 | private $_dds = null; |
| 470 | 480 | private function getDds() |
| 471 | 481 | { |
| 472 | - if (!$this->_dds) |
|
| 473 | - $this->_dds = neon('dds')->getIDdsObjectManagement(); |
|
| 482 | + if (!$this->_dds) { |
|
| 483 | + $this->_dds = neon('dds')->getIDdsObjectManagement(); |
|
| 484 | + } |
|
| 474 | 485 | return $this->_dds; |
| 475 | 486 | } |
| 476 | 487 | |