Mark Scherer 9 年之前
父节点
当前提交
aa7fc551ce

+ 0 - 2
src/Database/Type/YearType.php

@@ -11,8 +11,6 @@ use PDO;
  * Needs:
  * - Type::map('year', 'Tools\Database\Type\YearType'); in bootstrap
  * - Manual FormHelper $this->Form->input('published', ['type' => 'year']);
- *
- *
  */
 class YearType extends Type {
 

+ 1 - 2
src/Mailer/Email.php

@@ -488,8 +488,7 @@ class Email extends CakeEmail {
 	 * @param string $level
 	 * @return void
 	 */
-	protected function _logEmail($level = LogLevel::INFO)
-	{
+	protected function _logEmail($level = LogLevel::INFO) {
 		$content =
 			$this->_log['transport'] . (!Configure::read('Config.live') ? ' (simulated)' : '')
 			. ' - ' . 'TO:' . implode(',', array_keys($this->_log['to']))

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

@@ -81,11 +81,11 @@ class SluggedBehavior extends Behavior {
 		//'implementedMethods' => ['slug' => 'slug']
 	];
 
-/**
- * Table instance
- *
- * @var \Cake\ORM\Table
- */
+	/**
+	 * Table instance
+	 *
+	 * @var \Cake\ORM\Table
+	 */
 	protected $_table;
 
 	public function __construct(Table $table, array $config = []) {
@@ -138,8 +138,8 @@ class SluggedBehavior extends Behavior {
 	/**
 	 * SluggedBehavior::findSlugged()
 	 *
-	 * @param mixed $query
-	 * @param mixed $options
+	 * @param \Cake\ORM\Query $query
+	 * @param array $options
 	 * @return \Cake\ORM\Query
 	 * @throws \InvalidArgumentException If the 'slug' key is missing in options
 	 */
@@ -154,8 +154,8 @@ class SluggedBehavior extends Behavior {
 	/**
 	 * SluggedBehavior::beforeRules()
 	 *
-	 * @param mixed $event
-	 * @param mixed $entity
+	 * @param \Cake\Event\Event $event
+	 * @param \Cake\ORM\Entity $entity
 	 * @return void
 	 */
 	public function beforeRules(Event $event, Entity $entity) {
@@ -167,8 +167,8 @@ class SluggedBehavior extends Behavior {
 	/**
 	 * SluggedBehavior::beforeSave()
 	 *
-	 * @param mixed $event
-	 * @param mixed $entity
+	 * @param \Cake\Event\Event $event
+	 * @param \Cake\ORM\Entity $entity
 	 * @return void
 	 */
 	public function beforeSave(Event $event, Entity $entity) {
@@ -239,8 +239,8 @@ class SluggedBehavior extends Behavior {
 	 * until a unique slug is found
 	 *
 	 * @param string $string
-	 * @param \Cake\ORM\Entity $entity
-	 * @return string a slug
+	 * @param \Cake\ORM\Entity|null $entity
+	 * @return string A slug
 	 */
 	public function generateSlug($value, Entity $entity = null) {
 		$separator = $this->_config['separator'];
@@ -329,7 +329,7 @@ class SluggedBehavior extends Behavior {
 	 * Note that you should use the Reset behavior if you need additional functionality such
 	 * as callbacks or timeouts.
 	 *
-	 * @param array $conditions
+	 * @param array $params
 	 * @return bool Success
 	 */
 	public function resetSlugs($params = []) {
@@ -400,10 +400,10 @@ class SluggedBehavior extends Behavior {
 	/**
 	 * Wrapper for preg replace taking care of encoding
 	 *
-	 * @param mixed $pattern
-	 * @param mixed $replace
-	 * @param mixed $string
-	 * @return void
+	 * @param string|array $pattern
+	 * @param string|array $replace
+	 * @param string $string
+	 * @return string
 	 */
 	protected function _pregReplace($pattern, $replace, $string) {
 		return preg_replace($pattern, $replace, $string);
@@ -417,7 +417,7 @@ class SluggedBehavior extends Behavior {
 	 * understands. See the test case for info on how these regex patterns were generated.
 	 *
 	 * @param string $mode
-	 * @return string a partial regex or false on failure
+	 * @return string|null A partial regex or false on failure
 	 */
 	protected function _regex($mode) {
 		$return = '\x00-\x1f\x26\x3c\x7f-\x9f\x{fffe}-\x{ffff}';
@@ -471,7 +471,7 @@ class SluggedBehavior extends Behavior {
 			'\x{3095}-\x{3098}\x{309b}-\x{309c}\x{309f}-\x{30a0}\x{30fb}\x{30ff}-\x{3104}\x{312d}-\x{4dff}' .
 			'\x{9fa6}-\x{abff}\x{d7a4}-\x{d7ff}\x{e000}-\x{ffff}';
 		}
-		return false;
+		return null;
 	}
 
 }

+ 57 - 42
src/Model/Table/Table.php

@@ -29,41 +29,41 @@ class Table extends ShimTable {
 		return true;
 	}
 
-/**
- * Validator method used to check the uniqueness of a value for a column.
- * This is meant to be used with the validation API and not to be called
- * directly.
- *
- * ### Example:
- *
- * {{{
- * $validator->add('email', [
- *    'unique' => ['rule' => 'validateUnique', 'provider' => 'table']
- * ])
- * }}}
- *
- * Unique validation can be scoped to the value of another column:
- *
- * {{{
- * $validator->add('email', [
- *    'unique' => [
- *        'rule' => ['validateUnique', ['scope' => 'site_id']],
- *        'provider' => 'table'
- *    ]
- * ]);
- * }}}
- *
- * In the above example, the email uniqueness will be scoped to only rows having
- * the same site_id. Scoping will only be used if the scoping field is present in
- * the data to be validated.
- *
- * @override To allow multiple scoped values
- *
- * @param mixed $value The value of column to be checked for uniqueness
- * @param array $options The options array, optionally containing the 'scope' key
- * @param array $context The validation context as provided by the validation routine
- * @return bool true if the value is unique
- */
+	/**
+	 * Validator method used to check the uniqueness of a value for a column.
+	 * This is meant to be used with the validation API and not to be called
+	 * directly.
+	 *
+	 * ### Example:
+	 *
+	 * {{{
+	 * $validator->add('email', [
+	 *    'unique' => ['rule' => 'validateUnique', 'provider' => 'table']
+	 * ])
+	 * }}}
+	 *
+	 * Unique validation can be scoped to the value of another column:
+	 *
+	 * {{{
+	 * $validator->add('email', [
+	 *    'unique' => [
+	 *        'rule' => ['validateUnique', ['scope' => 'site_id']],
+	 *        'provider' => 'table'
+	 *    ]
+	 * ]);
+	 * }}}
+	 *
+	 * In the above example, the email uniqueness will be scoped to only rows having
+	 * the same site_id. Scoping will only be used if the scoping field is present in
+	 * the data to be validated.
+	 *
+	 * @override To allow multiple scoped values
+	 *
+	 * @param mixed $value The value of column to be checked for uniqueness
+	 * @param array $options The options array, optionally containing the 'scope' key
+	 * @param array $context The validation context as provided by the validation routine
+	 * @return bool true if the value is unique
+	 */
 	public function validateUniqueExt($value, array $options, array $context = []) {
 		$context += $options;
 		return parent::validateUnique($value, $context);
@@ -155,7 +155,7 @@ class Table extends ShimTable {
 	 * Get all related entries that have been used so far
 	 *
 	 * @param string $tableName The related model
-	 * @param string $groupField Field to group by
+	 * @param string|null $groupField Field to group by
 	 * @param string $type Find type
 	 * @param array $options
 	 * @return array
@@ -184,7 +184,7 @@ class Table extends ShimTable {
 	 * @param array $options
 	 * @return array
 	 */
-	public function getFieldInUse($groupField, $type = 'all', $options = []) {
+	public function getFieldInUse($groupField, $type = 'all', array $options = []) {
 		$defaults = [
 			'group' => $groupField,
 			'order' => [$this->displayField() => 'ASC'],
@@ -206,6 +206,7 @@ class Table extends ShimTable {
 	 *
 	 * @param mixed $value
 	 * @param array $options
+	 * @param array $context
 	 * @return bool Success
 	 */
 	public function validateIdentical($value, $options = [], array $context = []) {
@@ -227,17 +228,20 @@ class Table extends ShimTable {
 	}
 
 	/**
-	 * Checks if a url is valid AND accessable (returns false otherwise)
+	 * Checks if a URL is valid AND accessible (returns false otherwise)
 	 *
-	 * @param array|string $data: full url(!) starting with http://...
-	 * @options array
+	 * Options:
 	 * - allowEmpty TRUE/FALSE (TRUE: if empty => return TRUE)
 	 * - required TRUE/FALSE (TRUE: overrides allowEmpty)
 	 * - autoComplete (default: TRUE)
 	 * - deep (default: TRUE)
+	 *
+	 * @param array|string $url Full URL starting with http://...
+	 * @param array $options
+	 * @param array $context
 	 * @return bool Success
 	 */
-	public function validateUrl($url, $options = [], array $context = []) {
+	public function validateUrl($url, array $options = [], array $context = []) {
 		if (empty($url)) {
 			if (!empty($options['allowEmpty']) && empty($options['required'])) {
 				return true;
@@ -289,7 +293,7 @@ class Table extends ShimTable {
 	/**
 	 * Checks if a url is valid
 	 *
-	 * @param string url
+	 * @param string $url
 	 * @return bool Success
 	 */
 	protected function _validUrl($url) {
@@ -316,6 +320,7 @@ class Table extends ShimTable {
 	 * - allowEmpty
 	 * - after/before (fieldName to validate against)
 	 * - min/max (defaults to >= 1 - at least 1 minute apart)
+	 * @param array $context
 	 * @return bool Success
 	 */
 	public function validateDateTime($value, $options = [], array $context = []) {
@@ -369,11 +374,13 @@ class Table extends ShimTable {
 	/**
 	 * Validation of Date fields (as the core one is buggy!!!)
 	 *
+	 * @param mixed $value
 	 * @param array $options
 	 * - dateFormat (defaults to 'ymd')
 	 * - allowEmpty
 	 * - after/before (fieldName to validate against)
 	 * - min (defaults to 0 - equal is OK too)
+	 * @param array $context
 	 * @return bool Success
 	 */
 	public function validateDate($value, $options = [], array $context = []) {
@@ -415,11 +422,13 @@ class Table extends ShimTable {
 	/**
 	 * Validation of Time fields
 	 *
+	 * @param mixed $value
 	 * @param array $options
 	 * - timeFormat (defaults to 'hms')
 	 * - allowEmpty
 	 * - after/before (fieldName to validate against)
 	 * - min/max (defaults to >= 1 - at least 1 minute apart)
+	 * @param array $context
 	 * @return bool Success
 	 */
 	public function validateTime($value, $options = [], array $context = []) {
@@ -449,8 +458,11 @@ class Table extends ShimTable {
 	/**
 	 * Validation of Date Fields (>= minDate && <= maxDate)
 	 *
+	 * @param mixed $value
 	 * @param array $options
 	 * - min/max (TODO!!)
+	 * @param array $context
+	 * @return bool
 	 */
 	public function validateDateRange($value, $options = [], array $context = []) {
 	}
@@ -458,8 +470,11 @@ class Table extends ShimTable {
 	/**
 	 * Validation of Time Fields (>= minTime && <= maxTime)
 	 *
+	 * @param mixed $value
 	 * @param array $options
 	 * - min/max (TODO!!)
+	 * @param array $context
+	 * @return bool
 	 */
 	public function validateTimeRange($value, $options = [], array $context = []) {
 	}

+ 0 - 1
src/TestSuite/IntegrationTestCase.php

@@ -6,7 +6,6 @@ use Cake\TestSuite\IntegrationTestCase as CakeIntegrationTestCase;
 
 /**
  * Tools TestCase class
- *
  */
 abstract class IntegrationTestCase extends CakeIntegrationTestCase {
 

+ 0 - 1
src/TestSuite/TestCase.php

@@ -5,7 +5,6 @@ use Cake\TestSuite\TestCase as CakeTestCase;
 
 /**
  * Tools TestCase class
- *
  */
 abstract class TestCase extends CakeTestCase {
 

+ 32 - 32
src/Utility/L10n.php

@@ -13,14 +13,14 @@ namespace Tools\Utility;
  */
 class L10n {
 
-/**
- * Maps ISO 639-3 to I10n::_l10nCatalog
- * The terminological codes (first one per language) should be used if possible.
- * They are the ones building the path in `/APP/Locale/[code]/`
- * The bibliographic codes are aliases.
- *
- * @var array
- */
+	/**
+	 * Maps ISO 639-3 to I10n::_l10nCatalog
+	 * The terminological codes (first one per language) should be used if possible.
+	 * They are the ones building the path in `/APP/Locale/[code]/`
+	 * The bibliographic codes are aliases.
+	 *
+	 * @var array
+	 */
 	protected $_l10nMap = [
 		/* Afrikaans */ 'afr' => 'af',
 		/* Albanian */ 'sqi' => 'sq',
@@ -109,13 +109,13 @@ class L10n {
 		/* Zulu */ 'zul' => 'zu'
 	];
 
-/**
- * HTTP_ACCEPT_LANGUAGE catalog
- *
- * holds all information related to a language
- *
- * @var array
- */
+	/**
+	 * HTTP_ACCEPT_LANGUAGE catalog
+	 *
+	 * holds all information related to a language
+	 *
+	 * @var array
+	 */
 	protected $_l10nCatalog = [
 		'af' => ['language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr'],
 		'ar' => ['language' => 'Arabic', 'locale' => 'ara', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'],
@@ -260,19 +260,19 @@ class L10n {
 		'zu' => ['language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr']
 	];
 
-/**
- * Class constructor
- */
+	/**
+	 * Class constructor
+	 */
 	public function __construct() {
 	}
 
-/**
- * Attempts to find locale for language, or language for locale
- *
- * @param string|array $mixed 2/3 char string (language/locale), array of those strings, or null
- * @return string|array|bool string language/locale, array of those values, whole map as an array,
- *    or false when language/locale doesn't exist
- */
+	/**
+	 * Attempts to find locale for language, or language for locale
+	 *
+	 * @param string|array|null $mixed 2/3 char string (language/locale), array of those strings, or null
+	 * @return string|array|bool string language/locale, array of those values, whole map as an array,
+	 *    or false when language/locale doesn't exist
+	 */
 	public function map($mixed = null) {
 		if (is_array($mixed)) {
 			$result = [];
@@ -295,13 +295,13 @@ class L10n {
 		return $this->_l10nMap;
 	}
 
-/**
- * Attempts to find catalog record for requested language
- *
- * @param string|array $language string requested language, array of requested languages, or null for whole catalog
- * @return array|bool array catalog record for requested language, array of catalog records, whole catalog,
- *    or false when language doesn't exist
- */
+	/**
+	 * Attempts to find catalog record for requested language
+	 *
+	 * @param string|array|null $language String requested language, array of requested languages, or null for whole catalog
+	 * @return array|bool array catalog record for requested language, array of catalog records, whole catalog,
+	 *    or false when language doesn't exist
+	 */
 	public function catalog($language = null) {
 		if (is_array($language)) {
 			$result = [];

+ 0 - 1
src/Utility/Number.php

@@ -9,7 +9,6 @@ use Cake\I18n\Number as CakeNumber;
  * - config setting for format()
  * - spacer char for currency (initially from https://github.com/cakephp/cakephp/pull/1148)
  * - signed values possible
- *
  */
 class Number extends CakeNumber {
 

+ 0 - 1
src/Utility/Text.php

@@ -7,7 +7,6 @@ use Cake\Utility\Text as CakeText;
 /**
  * Extends CakeText.
  * //TODO: cleanup
- *
  */
 class Text extends CakeText {
 

+ 12 - 13
src/Utility/Time.php

@@ -7,13 +7,12 @@ use Cake\I18n\Time as CakeTime;
 /**
  * Extend CakeTime with a few important improvements:
  * - correct timezones for date only input and therefore unchanged day here
- *
  */
 class Time extends CakeTime {
 
-/**
- * {@inheritDoc}
- */
+	/**
+	 * {@inheritDoc}
+	 */
 	public function __construct($time = null, $tz = null) {
 		if (is_array($time)) {
 			$value = $time + ['hour' => 0, 'minute' => 0, 'second' => 0];
@@ -1147,15 +1146,15 @@ class Time extends CakeTime {
 		return "($fieldName >= '$begin') AND ($fieldName <= '$end')";
 	}
 
-/**
- * Returns a partial SQL string to search for all records between two times
- * occurring on the same day.
- *
- * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
- * @param string $fieldName Name of database field to compare with
- * @param string|\DateTimeZone $timezone Timezone string or DateTimeZone object
- * @return string Partial SQL string.
- */
+	/**
+	 * Returns a partial SQL string to search for all records between two times
+	 * occurring on the same day.
+	 *
+	 * @param int|string|\DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
+	 * @param string $fieldName Name of database field to compare with
+	 * @param string|\DateTimeZone $timezone Timezone string or DateTimeZone object
+	 * @return string Partial SQL string.
+	 */
 	public static function dayAsSql($dateString, $fieldName, $timezone = null) {
 		return static::daysAsSql($dateString, $dateString, $fieldName, $timezone);
 	}

+ 0 - 4
src/Utility/Utility.php

@@ -372,7 +372,6 @@ class Utility {
 	 *
 	 * @param array $array
 	 * @return bool Result
-	 *
 	 */
 	public static function logicalOr($array) {
 		foreach ($array as $result) {
@@ -442,7 +441,6 @@ class Utility {
 
 	/**
 	 * Trim recursively
-	 *
 	 */
 	public static function trimDeep($value) {
 		$value = is_array($value) ? array_map('self::trimDeep', $value) : trim($value);
@@ -451,7 +449,6 @@ class Utility {
 
 	/**
 	 * H() recursively
-	 *
 	 */
 	public static function specialcharsDeep($value) {
 		$value = is_array($value) ? array_map('self::specialcharsDeep', $value) : htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
@@ -460,7 +457,6 @@ class Utility {
 
 	/**
 	 * Main deep method
-	 *
 	 */
 	public static function deep($function, $value) {
 		$value = is_array($value) ? array_map('self::' . $function, $value) : $function($value);

+ 21 - 21
src/View/Helper/CookieHelper.php

@@ -8,35 +8,35 @@ use Cake\View\Helper;
  */
 class CookieHelper extends Helper {
 
-/**
- * Reads a cookie value for a key or return values for all keys.
- *
- * In your view: `$this->Cookie->read('key');`
- *
- * @param string $name the name of the cookie key you want to read
- * @return mixed values from the cookie vars
- */
+	/**
+	 * Reads a cookie value for a key or return values for all keys.
+	 *
+	 * In your view: `$this->Cookie->read('key');`
+	 *
+	 * @param string|null $name the name of the cookie key you want to read
+	 * @return mixed values from the cookie vars
+	 */
 	public function read($name = null) {
 		return $this->request->cookie($name);
 	}
 
-/**
- * Checks if a cookie key has been set.
- *
- * In your view: `$this->Cookie->check('key');`
- *
- * @param string $name Cookie name to check.
- * @return bool
- */
+	/**
+	 * Checks if a cookie key has been set.
+	 *
+	 * In your view: `$this->Cookie->check('key');`
+	 *
+	 * @param string $name Cookie name to check.
+	 * @return bool
+	 */
 	public function check($name) {
 		return $this->request->cookie($name) !== null;
 	}
 
-/**
- * Event listeners.
- *
- * @return array
- */
+	/**
+	 * Event listeners.
+	 *
+	 * @return array
+	 */
 	public function implementedEvents() {
 		return [];
 	}

+ 0 - 1
src/View/Helper/FormHelper.php

@@ -8,7 +8,6 @@ use Cake\Utility\Hash;
 
 /**
  * Overwrite
- *
  */
 class FormHelper extends CakeFormHelper {
 

+ 0 - 1
src/View/Helper/GravatarHelper.php

@@ -62,7 +62,6 @@ class GravatarHelper extends Helper {
 
 	/**
 	 * Constructor
-	 *
 	 */
 	public function __construct($View = null, $config = []) {
 		// Default the secure option to match the current URL.

+ 1 - 2
src/View/Helper/HtmlHelper.php

@@ -110,8 +110,7 @@ class HtmlHelper extends CoreHtmlHelper {
 	 *
 	 * @return array
 	 */
-	public function implementedEvents()
-	{
+	public function implementedEvents() {
 		return [];
 	}
 

+ 116 - 120
src/View/Helper/JsHelper.php

@@ -20,56 +20,54 @@ use Tools\Utility\Multibyte;
  */
 class JsHelper extends Helper {
 
-/**
- * Whether or not you want scripts to be buffered or output.
- *
- * @var bool
- */
+	/**
+	 * Whether or not you want scripts to be buffered or output.
+	 *
+	 * @var bool
+	 */
 	public $bufferScripts = true;
 
-/**
- * Helper dependencies
- *
- * @var array
- */
+	/**
+	 * Helper dependencies
+	 *
+	 * @var array
+	 */
 	public $helpers = ['Html', 'Form'];
 
-/**
- * Variables to pass to Javascript.
- *
- * @var array
- * @see JsHelper::set()
- */
+	/**
+	 * Variables to pass to Javascript.
+	 *
+	 * @var array
+	 */
 	protected $_jsVars = [];
 
-/**
- * Scripts that are queued for output
- *
- * @var array
- * @see JsHelper::buffer()
- */
+	/**
+	 * Scripts that are queued for output
+	 *
+	 * @var array
+	 */
 	protected $_bufferedScripts = [];
 
-/**
- * The javascript variable created by set() variables.
- *
- * @var string
- */
+	/**
+	 * The javascript variable created by set() variables.
+	 *
+	 * @var string
+	 */
 	public $setVariable = 'app';
 
-/**
- * Generates a JavaScript object in JavaScript Object Notation (JSON)
- * from an array. Will use native JSON encode method if available, and $useNative == true
- *
- * ### Options:
- *
- * - `prefix` - String prepended to the returned data.
- * - `postfix` - String appended to the returned data.
- *
- * @param array $data Data to be converted.
- * @param array $options Set of options, see above.
- * @return string A JSON code block
- */
+	/**
+	 * Generates a JavaScript object in JavaScript Object Notation (JSON)
+	 * from an array. Will use native JSON encode method if available, and $useNative == true
+	 *
+	 * ### Options:
+	 *
+	 * - `prefix` - String prepended to the returned data.
+	 * - `postfix` - String appended to the returned data.
+	 *
+	 * @param array $data Data to be converted.
+	 * @param array $options Set of options, see above.
+	 * @return string A JSON code block
+	 */
 	public function object($data = [], $options = []) {
 		$defaultOptions = [
 			'prefix' => '', 'postfix' => '',
@@ -79,15 +77,14 @@ class JsHelper extends Helper {
 		return $options['prefix'] . json_encode($data) . $options['postfix'];
 	}
 
-/**
- * Converts a PHP-native variable of any type to a JSON-equivalent representation
- *
- * @param mixed $val A PHP variable to be converted to JSON
- * @param bool $quoteString If false, leaves string values unquoted
- * @param string $key Key name.
- * @return string a JavaScript-safe/JSON representation of $val
- */
-	public function value($val = [], $quoteString = null, $key = 'value') {
+	/**
+	 * Converts a PHP-native variable of any type to a JSON-equivalent representation
+	 *
+	 * @param mixed $val A PHP variable to be converted to JSON
+	 * @param bool $quoteString If false, leaves string values unquoted
+	 * @return string a JavaScript-safe/JSON representation of $val
+	 */
+	public function value($val = [], $quoteString = true) {
 		if ($quoteString === null) {
 			$quoteString = true;
 		}
@@ -102,7 +99,6 @@ class JsHelper extends Helper {
 				$val = ($val === true) ? 'true' : 'false';
 				break;
 			case (is_int($val)):
-				$val = $val;
 				break;
 			case (is_float($val)):
 				$val = sprintf("%.11f", $val);
@@ -116,28 +112,28 @@ class JsHelper extends Helper {
 		return $val;
 	}
 
-/**
- * Escape a string to be JSON friendly.
- *
- * List of escaped elements:
- *
- * - "\r" => '\n'
- * - "\n" => '\n'
- * - '"' => '\"'
- *
- * @param string $string String that needs to get escaped.
- * @return string Escaped string.
- */
+	/**
+	 * Escape a string to be JSON friendly.
+	 *
+	 * List of escaped elements:
+	 *
+	 * - "\r" => '\n'
+	 * - "\n" => '\n'
+	 * - '"' => '\"'
+	 *
+	 * @param string $string String that needs to get escaped.
+	 * @return string Escaped string.
+	 */
 	public function escape($string) {
 		return $this->_utf8ToHex($string);
 	}
 
-/**
- * Encode a string into JSON. Converts and escapes necessary characters.
- *
- * @param string $string The string that needs to be utf8->hex encoded
- * @return void
- */
+	/**
+	 * Encode a string into JSON. Converts and escapes necessary characters.
+	 *
+	 * @param string $string The string that needs to be utf8->hex encoded
+	 * @return string
+	 */
 	protected function _utf8ToHex($string) {
 		$length = strlen($string);
 		$return = '';
@@ -227,26 +223,26 @@ class JsHelper extends Helper {
 		return $return;
 	}
 
-/**
- * Writes all Javascript generated so far to a code block or
- * caches them to a file and returns a linked script. If no scripts have been
- * buffered this method will return null. If the request is an XHR(ajax) request
- * onDomReady will be set to false. As the dom is already 'ready'.
- *
- * ### Options
- *
- * - `inline` - Set to true to have scripts output as a script block inline
- *   if `cache` is also true, a script link tag will be generated. (default true)
- * - `cache` - Set to true to have scripts cached to a file and linked in (default false)
- * - `clear` - Set to false to prevent script cache from being cleared (default true)
- * - `onDomReady` - wrap cached scripts in domready event (default true)
- * - `safe` - if an inline block is generated should it be wrapped in <![CDATA[ ... ]]> (default true)
- *
- * @param array $options options for the code block
- * @return mixed Completed javascript tag if there are scripts, if there are no buffered
- *   scripts null will be returned.
- * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::writeBuffer
- */
+	/**
+	 * Writes all Javascript generated so far to a code block or
+	 * caches them to a file and returns a linked script. If no scripts have been
+	 * buffered this method will return null. If the request is an XHR(ajax) request
+	 * onDomReady will be set to false. As the dom is already 'ready'.
+	 *
+	 * ### Options
+	 *
+	 * - `inline` - Set to true to have scripts output as a script block inline
+	 *   if `cache` is also true, a script link tag will be generated. (default true)
+	 * - `cache` - Set to true to have scripts cached to a file and linked in (default false)
+	 * - `clear` - Set to false to prevent script cache from being cleared (default true)
+	 * - `onDomReady` - wrap cached scripts in domready event (default true)
+	 * - `safe` - if an inline block is generated should it be wrapped in <![CDATA[ ... ]]> (default true)
+	 *
+	 * @param array $options options for the code block
+	 * @return mixed Completed javascript tag if there are scripts, if there are no buffered
+	 *   scripts null will be returned.
+	 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::writeBuffer
+	 */
 	public function writeBuffer($options = []) {
 		$domReady = false;
 		$defaults = [
@@ -274,15 +270,15 @@ class JsHelper extends Helper {
 		return $return;
 	}
 
-/**
- * Write a script to the buffered scripts.
- *
- * @param string $script Script string to add to the buffer.
- * @param bool $top If true the script will be added to the top of the
- *   buffered scripts array. If false the bottom.
- * @return void
- * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::buffer
- */
+	/**
+	 * Write a script to the buffered scripts.
+	 *
+	 * @param string $script Script string to add to the buffer.
+	 * @param bool $top If true the script will be added to the top of the
+	 *   buffered scripts array. If false the bottom.
+	 * @return void
+	 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::buffer
+	 */
 	public function buffer($script, $top = false) {
 		if ($top) {
 			array_unshift($this->_bufferedScripts, $script);
@@ -291,13 +287,13 @@ class JsHelper extends Helper {
 		}
 	}
 
-/**
- * Get all the buffered scripts
- *
- * @param bool $clear Whether or not to clear the script caches (default true)
- * @return array Array of scripts added to the request.
- * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::getBuffer
- */
+	/**
+	 * Get all the buffered scripts
+	 *
+	 * @param bool $clear Whether or not to clear the script caches (default true)
+	 * @return array Array of scripts added to the request.
+	 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::getBuffer
+	 */
 	public function getBuffer($clear = true) {
 		$this->_createVars();
 		$scripts = $this->_bufferedScripts;
@@ -308,11 +304,11 @@ class JsHelper extends Helper {
 		return $scripts;
 	}
 
-/**
- * Generates the object string for variables passed to javascript and adds to buffer
- *
- * @return void
- */
+	/**
+	 * Generates the object string for variables passed to javascript and adds to buffer
+	 *
+	 * @return void
+	 */
 	protected function _createVars() {
 		if (!empty($this->_jsVars)) {
 			$setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'window.' . $this->setVariable;
@@ -320,16 +316,16 @@ class JsHelper extends Helper {
 		}
 	}
 
-/**
- * Pass variables into Javascript. Allows you to set variables that will be
- * output when the buffer is fetched with `JsHelper::getBuffer()` or `JsHelper::writeBuffer()`
- * The Javascript variable used to output set variables can be controlled with `JsHelper::$setVariable`
- *
- * @param string|array $one Either an array of variables to set, or the name of the variable to set.
- * @param string|array $two If $one is a string, $two is the value for that key.
- * @return void
- * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::set
- */
+	/**
+	 * Pass variables into Javascript. Allows you to set variables that will be
+	 * output when the buffer is fetched with `JsHelper::getBuffer()` or `JsHelper::writeBuffer()`
+	 * The Javascript variable used to output set variables can be controlled with `JsHelper::$setVariable`
+	 *
+	 * @param string|array $one Either an array of variables to set, or the name of the variable to set.
+	 * @param string|array $two If $one is a string, $two is the value for that key.
+	 * @return void
+	 * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::set
+	 */
 	public function set($one, $two = null) {
 		$data = null;
 		if (is_array($one)) {
@@ -342,7 +338,7 @@ class JsHelper extends Helper {
 			$data = [$one => $two];
 		}
 		if (!$data) {
-			return false;
+			return;
 		}
 		$this->_jsVars = array_merge($this->_jsVars, $data);
 	}

+ 0 - 1
src/View/Helper/TextHelper.php

@@ -22,7 +22,6 @@ if (!defined('CHAR_HELLIP')) {
  * - stripProtocol (defaults To FALSE right now)
  * - maxLength (to shorten links in order to not mess up the layout in some cases - appends ...)
  * - escape (defaults to TRUE for security reasons regarding plain text)
- *
  */
 class TextHelper extends CakeTextHelper {
 

+ 14 - 14
src/View/Helper/TimeHelper.php

@@ -13,20 +13,20 @@ class TimeHelper extends CakeTimeHelper {
 
 	public $helpers = ['Html'];
 
-/**
- * Default config for this class
- *
- * @var mixed
- */
+	/**
+	 * Default config for this class
+	 *
+	 * @var array
+	 */
 	protected $_defaultConfig = [
 		'engine' => 'Tools\Utility\Time'
 	];
 
-/**
- * Cake\I18n\LocalizedNumber instance
- *
- * @var \Cake\I18n\Number
- */
+	/**
+	 * Cake\I18n\LocalizedNumber instance
+	 *
+	 * @var \Cake\I18n\Number
+	 */
 	protected $_engine = null;
 
 	/**
@@ -104,8 +104,8 @@ class TimeHelper extends CakeTimeHelper {
 	/**
 	 * Like localDate(), only with additional markup <span> and class="today", if today, etc
 	 *
-	 * @param null $dateString
-	 * @param null $format
+	 * @param string|null $dateString
+	 * @param string|null $format
 	 * @param array $options
 	 * @return string
 	 */
@@ -118,8 +118,8 @@ class TimeHelper extends CakeTimeHelper {
 	/**
 	 * Like niceDate(), only with additional markup <span> and class="today", if today, etc
 	 *
-	 * @param null $dateString
-	 * @param null $format
+	 * @param string|null $dateString
+	 * @param string|null $format
 	 * @param array $options
 	 * @return string
 	 */

+ 1 - 2
src/View/Helper/UrlHelper.php

@@ -70,8 +70,7 @@ class UrlHelper extends CoreUrlHelper {
 	 *
 	 * @return array
 	 */
-	public function implementedEvents()
-	{
+	public function implementedEvents() {
 		return [];
 	}