浏览代码

throw exception

euromark 11 年之前
父节点
当前提交
c29baa4232
共有 3 个文件被更改,包括 7 次插入6 次删除
  1. 2 2
      README.md
  2. 1 0
      docs/Contributing.md
  3. 4 4
      src/View/Helper/TreeHelper.php

+ 2 - 2
README.md

@@ -1,13 +1,13 @@
 # CakePHP Tools Plugin
 [![Build Status](https://api.travis-ci.org/dereuromark/cakephp-tools.png?branch=cake3)](https://travis-ci.org/dereuromark/cakephp-tools)
 [![Coverage Status](https://coveralls.io/repos/dereuromark/cakephp-tools/badge.png?branch=cake3)](https://coveralls.io/r/dereuromark/cakephp-tools)
+[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.4-8892BF.svg)](https://php.net/)
 [![License](https://poser.pugx.org/dereuromark/cakephp-tools/license.png)](https://packagist.org/packages/dereuromark/cakephp-tools)
 [![Total Downloads](https://poser.pugx.org/dereuromark/cakephp-tools/d/total.png)](https://packagist.org/packages/dereuromark/cakephp-tools)
-[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dereuromark/cakephp-tools?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Coding Standards](https://img.shields.io/badge/cs-PSR--2--R-yellow.svg)](https://github.com/php-fig-rectified/fig-rectified-standards)
 
 A CakePHP 3.x Plugin containing several useful tools that can be used in many projects.
 
-
 ## Version notice
 
 This cake3 branch only works for **CakePHP3.x** - please use the master branch for CakePHP 2.x!

+ 1 - 0
docs/Contributing.md

@@ -1,4 +1,5 @@
 # Contributing
+[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dereuromark/cakephp-tools?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 
 ## Getting Started
 

+ 4 - 4
src/View/Helper/TreeHelper.php

@@ -120,7 +120,7 @@ class TreeHelper extends Helper {
 	 * @param array $data data to loop on
 	 * @param array $config
 	 * @return string html representation of the passed data
-	 * @throws CakeException
+	 * @throws \Exception
 	 */
 	public function generate(array $data, array $config = array()) {
 		if (!$data) {
@@ -229,7 +229,7 @@ class TreeHelper extends Helper {
 					$lastChild = true;
 				}
 			} else {
-				throw new CakeException('Invalid Tree Structure');
+				throw new \Exception('Invalid Tree Structure');
 			}
 
 			$activePathElement = null;
@@ -525,7 +525,7 @@ class TreeHelper extends Helper {
 	 * @param array $path Tree path
 	 * @param int $level
 	 * @return void
-	 * @throws CakeException
+	 * @throws \Exception
 	 */
 	protected function _markUnrelatedAsHidden(&$tree, array $path, $level = 0) {
 		extract($this->_config);
@@ -535,7 +535,7 @@ class TreeHelper extends Helper {
 				$subTree = $subTree->toArray();
 			}
 			if (!isset($subTree['children'])) {
-				throw new CakeException('Only workes with threaded (nested children) results');
+				throw new \Exception('Only workes with threaded (nested children) results');
 			}
 
 			if (!empty($path[$level]) && $subTree['id'] == $path[$level]['id']) {