Skip to content

Commit

Permalink
passed phpcs CakePHP Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
torifat committed Feb 18, 2014
1 parent a52f0f1 commit 593d4a1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 63 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,3 @@ after_success:

notifications:
email: false

# whitelist
branches:
only:
- master
- feature/travis-ci
78 changes: 40 additions & 38 deletions Controller/Component/MenuGathererComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ class MenuGathererComponent extends Component {

protected $_menu = array();

/**
* Initialize component
*
* @param Controller $controller Instantiating controller
* @return void
*/
/**
* Initialize component
*
* @param Controller $controller Instantiating controller
* @return void
*/
public function initialize(Controller $controller) {
parent::initialize($controller);

$this->_controller = $controller;
}

/**
* MenuGathererComponent::get()
*
* @param string $menu
* @return array Menu data
*/
/**
* MenuGathererComponent::get()
*
* @param string $menu
* @return array Menu data
*/
public function get($menu = null) {
if ($menu === null) {
return $this->_menu;
Expand All @@ -33,30 +33,32 @@ public function get($menu = null) {
return $this->_menu[$menu];
}

/**
* Add an item to a menu at the specified position
*
* @return void
*/
/**
* Add an item to a menu at the specified position
*
* @param string $menu
* @param array $item
* @param integer $index
* @return void
*/
public function item($menu, $item = array(), $index = null) {
$this->_checkMenu($menu);

if ($index === null) {
$this->_menu[$menu][] = $item;

return;
}

$this->_menu = array_splice($this->_menu, $index, 0, $item);
}

/**
* MenuGathererComponent::menu()
*
* @param mixed $name
* @param mixed $menu
* @return void
*/
/**
* MenuGathererComponent::menu()
*
* @param mixed $name
* @param mixed $menu
* @return void
*/
public function menu($name, $menu = array()) {
if (is_array($name)) {
foreach ($name as $key => $val) {
Expand All @@ -68,22 +70,22 @@ public function menu($name, $menu = array()) {
$this->_menu[$name] = $menu;
}

/**
* MenuGathererComponent::set()
*
* @param mixed $menu
* @return void
*/
/**
* MenuGathererComponent::set()
*
* @param mixed $menu
* @return void
*/
public function set($menu = array()) {
$this->_menu = (array) $menu;
$this->_menu = (array)$menu;
}

/**
* MenuGathererComponent::_checkMenu()
*
* @param mixed $name
* @return void
*/
/**
* MenuGathererComponent::_checkMenu()
*
* @param mixed $name
* @return void
*/
protected function _checkMenu($name) {
if (is_array($name)) {
foreach ($name as $val) {
Expand Down
File renamed without changes.
17 changes: 12 additions & 5 deletions Test/Case/Controller/Component/MenuGathererComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@ class AuthUser extends CakeTestModel {

class Controller1Controller extends Controller {

public function action1() {}
public function action1() {
}

public function action2() {
}

public function action2() {}
}

class Controller2Controller extends Controller {

public function action1() {}
public function action1() {
}

public function action2() {}
public function action2() {
}

public function admin_action() {
}

public function admin_action() {}
}

/**
Expand Down
13 changes: 5 additions & 8 deletions Test/Case/View/Helper/MenuBuilderHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,11 @@ public function testActiveClass() {
$this->assertTags($result, $expected, true);
}

/**
* TestId Test Id
*
* @return void
*/
/**
* TestId Test Id
*
* @return void
*/
public function testId() {
// Normal Menu
$menu = array(
Expand Down Expand Up @@ -594,7 +594,6 @@ public function testId() {
* @return void
*/
public function testClass() {

// With Multi Level Sub Menu
$this->MenuBuilder->here = '/item-1.2';
$menu = array(
Expand Down Expand Up @@ -741,7 +740,6 @@ public function testMultipleMenu() {
* @return void
*/
public function testPartialMatch() {

// With Multi Level Sub Menu
$this->MenuBuilder->here = '/item-1.2/1.2.3';
$menu = array(
Expand Down Expand Up @@ -821,7 +819,6 @@ public function testPartialMatch() {
* @return void
*/
public function testPermissions() {

// With Multi Level Sub Menu
$menu = array(
array(
Expand Down
12 changes: 6 additions & 6 deletions View/Helper/MenuBuilderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(View $View, $settings = array()) {
unset($settings['defaults']);
}

$this->settings = array_merge($this->settings, (array) $settings);
$this->settings = array_merge($this->settings, (array)$settings);

if (!isset($View->viewVars[$this->settings['menuVar']])) {
return;
Expand All @@ -95,9 +95,9 @@ public function __construct(View $View, $settings = array()) {
$this->_menu = $View->viewVars[$this->settings['menuVar']];

if (isset($View->viewVars[$this->settings['authVar']]) &&
isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']]) &&
isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']])) {
$this->_group = $View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']];
isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']]) &&
isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']])) {
$this->_group = $View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']];
}

parent::__construct($View, (array)$settings);
Expand Down Expand Up @@ -247,9 +247,9 @@ protected function _buildItem(&$item, $pos = -1, &$isActive = false) {
if (isset($item['class'])) {
if (is_array($item['class'])) {
$arrClass = array_merge($arrClass, $item['class']);
} else {
$arrClass[] = $item['class'];
}

else $arrClass[] = $item['class'];
}

if (!empty($arrClass)) {
Expand Down

0 comments on commit 593d4a1

Please sign in to comment.