mscherer 3 年之前
父节点
当前提交
71cd1fb161

+ 2 - 1
src/Mailer/Message.php

@@ -5,6 +5,7 @@ namespace Tools\Mailer;
 use Cake\Core\Configure;
 use Cake\Mailer\Message as CakeMessage;
 use InvalidArgumentException;
+use RuntimeException;
 use Tools\Utility\Mime;
 use Tools\Utility\Text;
 use Tools\Utility\Utility;
@@ -377,7 +378,7 @@ class Message extends CakeMessage {
 		);
 		$content = file_get_contents($path, false, $context);
 		if (!$content) {
-			throw new \RuntimeException('No content found for ' . $path);
+			throw new RuntimeException('No content found for ' . $path);
 		}
 
 		return chunk_split(base64_encode($content));

+ 5 - 4
src/Model/Behavior/JsonableBehavior.php

@@ -10,6 +10,7 @@ use Cake\Event\EventInterface;
 use Cake\ORM\Behavior;
 use Cake\ORM\Entity;
 use Cake\ORM\Query;
+use InvalidArgumentException;
 use RuntimeException;
 use Shim\Database\Type\ArrayType;
 use Tools\Utility\Text;
@@ -193,23 +194,23 @@ class JsonableBehavior extends Behavior {
 		if (!empty($this->_config['fields'])) {
 			if ($this->_config['input'] === 'param') {
 				if (!is_string($val)) {
-					throw new \InvalidArgumentException('Only accepts string for input type `param`');
+					throw new InvalidArgumentException('Only accepts string for input type `param`');
 				}
 				$val = $this->_fromParam($val);
 			} elseif ($this->_config['input'] === 'list') {
 				if (!is_string($val)) {
-					throw new \InvalidArgumentException('Only accepts string for input type `list`');
+					throw new InvalidArgumentException('Only accepts string for input type `list`');
 				}
 				$val = $this->_fromList($val);
 				if ($this->_config['unique']) {
 					if (!is_array($val)) {
-						throw new \InvalidArgumentException('Only accepts array for input type `unique`');
+						throw new InvalidArgumentException('Only accepts array for input type `unique`');
 					}
 					$val = array_unique($val);
 				}
 				if ($this->_config['sort']) {
 					if (!is_array($val)) {
-						throw new \InvalidArgumentException('Only accepts array for input type `sort`');
+						throw new InvalidArgumentException('Only accepts array for input type `sort`');
 					}
 					sort($val);
 				}

+ 1 - 1
src/Model/Behavior/SluggedBehavior.php

@@ -398,7 +398,7 @@ class SluggedBehavior extends Behavior {
 			'page' => 1,
 			'limit' => 100,
 			'fields' => array_merge([$this->_table->getPrimaryKey()], $this->_config['label']),
-			'order' =>  $displayField . ' ASC',
+			'order' => $displayField . ' ASC',
 			'conditions' => $this->_config['scope'],
 			'overwrite' => true,
 		];

+ 4 - 3
src/Model/Table/Table.php

@@ -4,6 +4,7 @@ namespace Tools\Model\Table;
 
 use Cake\Routing\Router;
 use Cake\Validation\Validation;
+use InvalidArgumentException;
 use Shim\Model\Table\Table as ShimTable;
 use Tools\Utility\FrozenTime;
 use Tools\Utility\Utility;
@@ -229,7 +230,7 @@ class Table extends ShimTable {
 		}
 		if (!isset($options['autoComplete']) || $options['autoComplete'] !== false) {
 			if (!is_string($url)) {
-				throw new \InvalidArgumentException('Can only accept string for autoComplete case');
+				throw new InvalidArgumentException('Can only accept string for autoComplete case');
 			}
 			$url = $this->_autoCompleteUrl($url);
 		}
@@ -245,7 +246,7 @@ class Table extends ShimTable {
 		// same domain?
 		if (!empty($options['sameDomain']) && env('HTTP_HOST')) {
 			if (!is_string($url)) {
-				throw new \InvalidArgumentException('Can only accept string for sameDomain case');
+				throw new InvalidArgumentException('Can only accept string for sameDomain case');
 			}
 			/** @var string $is */
 			$is = parse_url($url, PHP_URL_HOST);
@@ -261,7 +262,7 @@ class Table extends ShimTable {
 		}
 
 		if (!is_string($url)) {
-			throw new \InvalidArgumentException('Can only accept string for deep case');
+			throw new InvalidArgumentException('Can only accept string for deep case');
 		}
 
 		return $this->_validUrl($url);