Browse Source

Fix typehints.

dereuromark 9 years ago
parent
commit
bb638a6562

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

@@ -384,7 +384,7 @@ class SluggedBehavior extends Behavior {
 	 * @return void
 	 */
 	protected function _multiSlug(Entity $entity) {
-		extract($this->_config);
+		$label = $this->config('label');
 		$field = current($label);
 		$fields = (array)$entity->get($field);
 
@@ -396,10 +396,10 @@ class SluggedBehavior extends Behavior {
 					$res = $this->generateSlug($field[$locale], $entity);
 				}
 			}
-			//$this->beforeRules($entity);
+
 			$locale[$locale] = $res;
 		}
-		$entity->set($slugField, $locale);
+		$entity->set($this->config('slugField'), $locale);
 	}
 
 	/**

+ 6 - 4
src/Model/Table/TokensTable.php

@@ -68,12 +68,14 @@ class TokensTable extends Table {
 	/**
 	 * Stores new key in DB
 	 *
+	 * Checks if this key is already used (should be unique in table)
+	 *
 	 * @param string $type Type: necessary
 	 * @param string|null $key Key: optional key, otherwise a key will be generated
 	 * @param mixed|null $uid Uid: optional (if used, only this user can use this key)
 	 * @param string|array|null $content Content: up to 255 characters of content may be added (optional)
-	 * NOW: checks if this key is already used (should be unique in table)
-	 * @return string key on SUCCESS, boolean false otherwise
+	 *
+	 * @return string|bool Key on success, boolean false otherwise
 	 */
 	public function newKey($type, $key = null, $uid = null, $content = null) {
 		if (!$type) {
@@ -118,7 +120,7 @@ class TokensTable extends Table {
 	 * @param string $key : necessary
 	 * @param mixed|null $uid : needs to be provided if this key has a user_id stored
 	 * @param bool $treatUsedAsInvalid
-	 * @return array|false Content - if successfully used or if already used (used=1), FALSE else
+	 * @return \Cake\ORM\Entity|false Content - if successfully used or if already used (used=1), FALSE else
 	 */
 	public function useKey($type, $key, $uid = null, $treatUsedAsInvalid = false) {
 		if (!$type || !$key) {
@@ -128,7 +130,7 @@ class TokensTable extends Table {
 		if ($uid) {
 			$options['conditions'][$this->alias() . '.user_id'] = $uid;
 		}
-		$res = $this->find('first', $options);
+		$res = $this->find('all', $options)->first();
 		if (!$res) {
 			return false;
 		}

+ 1 - 1
src/Shell/InflectShell.php

@@ -138,7 +138,7 @@ class InflectShell extends Shell {
 	/**
 	 * Requests words to inflect
 	 *
-	 * @return array
+	 * @return string|null
 	 */
 	protected function _getWords() {
 		$words = null;