Skip to content

Commit

Permalink
Merge pull request #1 from KodiCMS/analysis-qMlM2X
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
butschster committed Nov 10, 2015
2 parents dfc62f4 + 1660db6 commit 3bbef14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
5 changes: 3 additions & 2 deletions src/ItemDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function isHidden()
*/
public function getIcon()
{
if (! isset($this->icon)) {
if (!isset($this->icon)) {
return;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public function getName()
*/
public function getLabel()
{
if (! is_null($label = $this->getAttribute('label'))) {
if (!is_null($label = $this->getAttribute('label'))) {
return trans($label);
}

Expand Down Expand Up @@ -238,6 +238,7 @@ public function __unset($name)
* @param $arguments array
*
* @return mixed
*
* @link http://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods
*/
public function __call($name, $arguments)
Expand Down
10 changes: 4 additions & 6 deletions src/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static function make(array $items, $uri = null)
/**
* Navigation constructor.
*
* @param array $items
* @param string|null $uri
* @param array $items
* @param string|null $uri
*/
public function __construct(array $items, $uri = null)
{
Expand All @@ -53,10 +53,8 @@ public function __construct(array $items, $uri = null)
$this->getRootSection()->sort();

Event::fire('navigation.inited', [$navigation]);

}


/**
* @return Section
*/
Expand Down Expand Up @@ -190,7 +188,7 @@ public function setCurrentPage(Page &$page)
protected function build(array $items)
{
foreach ($items as $section) {
if (! isset($section['name'])) {
if (!isset($section['name'])) {
continue;
}

Expand All @@ -203,7 +201,7 @@ protected function build(array $items)
$sectionObject = $this->findSectionOrCreate($section['name']);
$sectionObject->setAttribute(array_except($section, ['children']));

if (! empty($section['children'])) {
if (!empty($section['children'])) {
$sectionObject->addPages($section['children']);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __set($name, $value)
{
parent::__set($name, $value);

if (! is_null($this->sectionObject)) {
if (!is_null($this->sectionObject)) {
$this->getRootSection()->update();
}

Expand Down
25 changes: 12 additions & 13 deletions src/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace KodiCMS\Navigation;

use Countable;
use Gate;
use Iterator;
use Countable;
use KodiCMS\Navigation\Contracts\NavigationSectionInterface;

class Section extends ItemDecorator implements Countable, Iterator, NavigationSectionInterface
Expand Down Expand Up @@ -78,7 +78,6 @@ public function isRoot()
return $this->getName() == static::ROOT_NAME;
}


/**
* @return Section[]
*/
Expand Down Expand Up @@ -143,7 +142,7 @@ public function addPage(NavigationPageInterface &$page, $priority = 1)
intval($priority);

$permissions = $page->getPermissions();
if (! empty($permissions) and Gate::denies('navigation-page-view', $page)) {
if (!empty($permissions) and Gate::denies('navigation-page-view', $page)) {
return $this;
}

Expand Down Expand Up @@ -191,7 +190,7 @@ public function findActivePageByUri($currentUri)

$uri = substr($currentUri, $len);
$pos = strpos($uri, $url);
if (! empty($url) and $pos !== false and $pos < 5) {
if (!empty($url) and $pos !== false and $pos < 5) {
$page->setStatus(true);

$this->navigation->setCurrentPage($page);
Expand Down Expand Up @@ -228,7 +227,7 @@ public function findSection($name)

foreach ($this->getSections() as $section) {
$found = $section->findSection($name);
if (! is_null($found)) {
if (!is_null($found)) {
return $found;
}
}
Expand All @@ -251,7 +250,7 @@ public function &findPageByUri($uri)

foreach ($this->getSections() as $section) {
$found = $section->findPageByUri($uri);
if (! is_null($found)) {
if (!is_null($found)) {
return $found;
}
}
Expand Down Expand Up @@ -290,7 +289,7 @@ public function sort()
*
* echo count($result);
*
* @return int
* @return int
*/
public function count()
{
Expand All @@ -302,7 +301,7 @@ public function count()
*
* echo key($result);
*
* @return int
* @return int
*/
public function key()
{
Expand All @@ -314,7 +313,7 @@ public function key()
*
* echo key($result);
*
* @return int
* @return int
*/
public function current()
{
Expand All @@ -326,7 +325,7 @@ public function current()
*
* next($result);
*
* @return $this
* @return $this
*/
public function next()
{
Expand All @@ -338,7 +337,7 @@ public function next()
*
* prev($result);
*
* @return $this
* @return $this
*/
public function prev()
{
Expand All @@ -350,7 +349,7 @@ public function prev()
*
* rewind($result);
*
* @return $this
* @return $this
*/
public function rewind()
{
Expand All @@ -362,7 +361,7 @@ public function rewind()
*
* [!!] This method is only used internally.
*
* @return bool
* @return bool
*/
public function valid()
{
Expand Down

0 comments on commit 3bbef14

Please sign in to comment.