Skip to content

Commit

Permalink
phpcs run and error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelAlphonso committed May 24, 2017
1 parent 30637f4 commit cc05c3c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
12 changes: 10 additions & 2 deletions src/Charcoal/Admin/Docs/Widget/DocFormPropertyWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function hasExtraData()
public function collapsible()
{
$displayOps = $this->displayOptions();

return isset($displayOps['collapsible']) ? $displayOps['collapsible'] : false;
}

Expand All @@ -42,6 +43,7 @@ public function collapsible()
public function collapsed()
{
$displayOps = $this->displayOptions();

return isset($displayOps['collapsed']) ? $displayOps['collapsed'] : false;
}

Expand All @@ -51,6 +53,7 @@ public function collapsed()
public function parented()
{
$displayOps = $this->displayOptions();

return isset($displayOps['parented']) ? $displayOps['parented'] : false;
}

Expand Down Expand Up @@ -134,19 +137,24 @@ public function extraData()
}

/**
* @return array
* @return array|mixed
*/
public function displayOptions()
{
return $this->displayOptions;
}

/**
* @param array $displayOptions
* @param array|mixed $displayOptions The display options array.
* @throws \InvalidArgumentException If argument is not of type "array".
* @return self
*/
public function setDisplayOptions($displayOptions)
{
if (!is_array($displayOptions)) {
throw new \InvalidArgumentException('display_options should be of type array');
}

$this->displayOptions = $displayOptions;

return $this;
Expand Down
23 changes: 5 additions & 18 deletions src/Charcoal/Admin/Widget/DocWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Charcoal\Admin\Widget;

use Charcoal\Admin\Docs\Widget\DocFormPropertyWidget;
use Charcoal\Admin\Ui\FormSidebarInterface;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;
use \UnexpectedValueException;
use \InvalidArgumentException;
Expand Down Expand Up @@ -236,7 +237,7 @@ protected function dataFromObject()
}

/**
* @return FormSidebarInterface[]|Generator
* @return FormSidebarInterface[]|\Generator
*/
public function sidebars()
{
Expand All @@ -260,8 +261,7 @@ public function sidebars()
'actions' => [
[
'label' => (string)$label,
'url' => 'object/edit?main_menu='.$this->obj()['main_menu'].
'&obj_type={{obj_type}}&obj_id={{id}}'
'url' => 'object/edit?main_menu='.$this->obj()['main_menu'].'&obj_type={{obj_type}}&obj_id={{id}}'
]
]
];
Expand All @@ -274,19 +274,6 @@ public function sidebars()
yield $sidebar;
$GLOBALS['widget_template'] = '';
}

// $sidebars = $this->sidebars;
// uasort($sidebars, [ $this, 'sortSidebarsByPriority' ]);
// foreach ($sidebars as $sidebarIdent => $sidebar) {
// if ($sidebar->template()) {
// $template = $sidebar->template();
// } else {
// $template = 'charcoal/admin/widget/form.sidebar';
// }
// $GLOBALS['widget_template'] = $template;
// yield $sidebarIdent => $sidebar;
// $GLOBALS['widget_template'] = '';
// }
}

/**
Expand Down Expand Up @@ -662,7 +649,7 @@ public function showHeader()
}

/**
* @param boolean $showHeader
* @param boolean $showHeader Is the Header to be shown.
* @return self
*/
public function setShowHeader($showHeader)
Expand All @@ -681,7 +668,7 @@ public function showTitle()
}

/**
* @param boolean $showTitle
* @param boolean $showTitle Is the title to be shown.
* @return self
*/
public function setShowTitle($showTitle)
Expand Down
6 changes: 3 additions & 3 deletions src/Charcoal/Admin/Widget/FormSidebarWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public function isObjResettable()
public function isObjSavable()
{
// Overridden by permissions
if (!$this->checkPermission('save') || !$this->form() ) {
if (!$this->checkPermission('save') || !$this->form()) {
return false;
}

Expand Down Expand Up @@ -759,11 +759,11 @@ public function languages()
*/
protected function checkPermission($permissionName)
{
if (!isset($this->requiredAclPermissions[$permissionName])) {
if (!isset($this->requiredGlobalAclPermissions[$permissionName])) {
return true;
}

$permissions = $this->requiredAclPermissions[$permissionName];
$permissions = $this->requiredGlobalAclPermissions[$permissionName];

// Test sidebar vs. ACL roles
$authUser = $this->authenticator()->authenticate();
Expand Down

0 comments on commit cc05c3c

Please sign in to comment.