euromark 11 years ago
parent
commit
6bb7f6f433

+ 1 - 0
Lib/RandomLib.php

@@ -192,6 +192,7 @@ class RandomLib {
 
 	/**
 	 * Few years ago i had written Joomla component AutoContent. That component generates new unique content and add it to Joomla site. In general, this is not good tool, because it does black SEO things. If search engine (ex. Google) finds that there is autogenerated text without sense then site can be banned
+	 *
 	 * @link http://www.gelembjuk.com/index.php?option=com_content&view=article&id=60&catid=37:php&Itemid=56
 	 */
 	public static function sentences($sentences, $wordscount = 2) {

+ 2 - 2
Lib/SpellLib.php

@@ -43,7 +43,7 @@ class SpellLib {
 		$defaults = array(
 			'path' => VENDORS . 'dictionaries' . DS,
 			'lang' => 'en_GB',
-			'engine' => self::ENGINE_MYSPELL
+			'engine' => static::ENGINE_MYSPELL
 		);
 		$defaults = array_merge($defaults, (array)Configure::read('Spell'));
 		$options = array_merge($defaults, $options);
@@ -70,7 +70,7 @@ class SpellLib {
 	}
 
 	/**
-	 * @return boolean Success
+	 * @return bool Success
 	 */
 	public function check($word) {
 		return enchant_dict_check($this->_Dict, $word);

+ 1 - 0
Lib/Utility/TimeLib.php

@@ -1,6 +1,7 @@
 <?php
 App::uses('CakeTime', 'Utility');
 App::uses('GeocodeLib', 'Tools.Lib');
+
 /**
  * Extend CakeNumber with a few important improvements:
  * - correct timezones for date only input and therefore unchanged day here

+ 109 - 109
Lib/View/StringTemplate.php

@@ -12,22 +12,22 @@ App::uses('PhpReader', 'Configure');
  */
 class StringTemplate {
 
-/**
- * List of attributes that can be made compact.
- *
- * @var array
- */
+	/**
+	 * List of attributes that can be made compact.
+	 *
+	 * @var array
+	 */
 	protected $_compactAttributes = array(
 		'compact', 'checked', 'declare', 'readonly', 'disabled', 'selected',
 		'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize',
 		'autoplay', 'controls', 'loop', 'muted', 'required', 'novalidate', 'formnovalidate'
 	);
 
-/**
- * The default templates this instance holds.
- *
- * @var array
- */
+	/**
+	 * The default templates this instance holds.
+	 *
+	 * @var array
+	 */
 	protected $_defaultConfig = array(
 		'attribute' => '{{name}}="{{value}}"',
 		'compactAttribute' => '{{name}}="{{value}}"',
@@ -35,30 +35,30 @@ class StringTemplate {
 
 	protected $_config;
 
-/**
- * Contains the list of compiled templates
- *
- * @var array
- */
+	/**
+	 * Contains the list of compiled templates
+	 *
+	 * @var array
+	 */
 	protected $_compiled = array();
 
-/**
- * Constructor.
- *
- * @param array $config A set of templates to add.
- */
+	/**
+	 * Constructor.
+	 *
+	 * @param array $config A set of templates to add.
+	 */
 	public function __construct(array $config = array()) {
 		$this->config($config);
 	}
 
-/**
- * StringTemplate::config()
- *
- * @param string|array|null $key The key to get/set, or a complete array of configs.
- * @param mixed|null $value The value to set.
- * @param bool $merge Whether to merge or overwrite existing config defaults to true.
- * @return mixed Config value being read, or the whole array itself on write operations.
- */
+	/**
+	 * StringTemplate::config()
+	 *
+	 * @param string|array|null $key The key to get/set, or a complete array of configs.
+	 * @param mixed|null $value The value to set.
+	 * @param bool $merge Whether to merge or overwrite existing config defaults to true.
+	 * @return mixed Config value being read, or the whole array itself on write operations.
+	 */
 	public function config($key = null, $value = null, $merge = true) {
 		if ($key === null) {
 			return $this->_config;
@@ -86,62 +86,62 @@ class StringTemplate {
 		return $this->_config[$key];
 	}
 
-/**
- * Registers a list of templates by name
- *
- * ### Example:
- *
- * {{{
- * $templater->add([
- *	'link' => '<a href="{{url}}">{{title}}</a>'
- *	'button' => '<button>{{text}}</button>'
- * ]);
- * }}}
- *
- * @param array an associative list of named templates
- * @return \Cake\View\StringTemplate same instance
- */
+	/**
+	 * Registers a list of templates by name
+	 *
+	 * ### Example:
+	 *
+	 * {{{
+	 * $templater->add([
+	 *	'link' => '<a href="{{url}}">{{title}}</a>'
+	 *	'button' => '<button>{{text}}</button>'
+	 * ]);
+	 * }}}
+	 *
+	 * @param array an associative list of named templates
+	 * @return \Cake\View\StringTemplate same instance
+	 */
 	public function add(array $templates) {
 		$this->config($templates);
 		$this->_compiled = array_diff_key($this->_compiled, $templates);
 		return $this;
 	}
 
-/**
- * Load a config file containing templates.
- *
- * Template files should define a `$config` variable containing
- * all the templates to load. Loaded templates will be merged with existing
- * templates.
- *
- * @param string $file The file to load
- * @return void
- */
+	/**
+	 * Load a config file containing templates.
+	 *
+	 * Template files should define a `$config` variable containing
+	 * all the templates to load. Loaded templates will be merged with existing
+	 * templates.
+	 *
+	 * @param string $file The file to load
+	 * @return void
+	 */
 	public function load($file) {
 		$loader = new PhpReader();
 		$templates = $loader->read($file);
 		$this->add($templates);
 	}
 
-/**
- * Remove the named template.
- *
- * @param string $name The template to remove.
- * @return void
- */
+	/**
+	 * Remove the named template.
+	 *
+	 * @param string $name The template to remove.
+	 * @return void
+	 */
 	public function remove($name) {
 		$this->config($name, null);
 		unset($this->_compiled[$name]);
 	}
 
-/**
- * Returns an array containing the compiled template to be used with
- * the sprintf function and a list of placeholder names that were found
- * in the template in the order that they should be replaced.
- *
- * @param string $name The compiled template info
- * @return array
- */
+	/**
+	 * Returns an array containing the compiled template to be used with
+	 * the sprintf function and a list of placeholder names that were found
+	 * in the template in the order that they should be replaced.
+	 *
+	 * @param string $name The compiled template info
+	 * @return array
+	 */
 	public function compile($name) {
 		if (isset($this->_compiled[$name])) {
 			return $this->_compiled[$name];
@@ -159,13 +159,13 @@ class StringTemplate {
 		);
 	}
 
-/**
- * Format a template string with $data
- *
- * @param string $name The template name.
- * @param array $data The data to insert.
- * @return string
- */
+	/**
+	 * Format a template string with $data
+	 *
+	 * @param string $name The template name.
+	 * @param array $data The data to insert.
+	 * @return string
+	 */
 	public function format($name, array $data) {
 		list($template, $placeholders) = $this->compile($name);
 		if ($template === null) {
@@ -178,32 +178,32 @@ class StringTemplate {
 		return vsprintf($template, $replace);
 	}
 
-/**
- * Returns a space-delimited string with items of the $options array. If a key
- * of $options array happens to be one of those listed
- * in `StringTemplate::$_compactAttributes` and its value is one of:
- *
- * - '1' (string)
- * - 1 (integer)
- * - true (boolean)
- * - 'true' (string)
- *
- * Then the value will be reset to be identical with key's name.
- * If the value is not one of these 4, the parameter is not output.
- *
- * 'escape' is a special option in that it controls the conversion of
- * attributes to their html-entity encoded equivalents. Set to false to disable html-encoding.
- *
- * If value for any option key is set to `null` or `false`, that option will be excluded from output.
- *
- * This method uses the 'attribute' and 'compactAttribute' templates. Each of
- * these templates uses the `name` and `value` variables. You can modify these
- * templates to change how attributes are formatted.
- *
- * @param array $options Array of options.
- * @param null|array $exclude Array of options to be excluded, the options here will not be part of the return.
- * @return string Composed attributes.
- */
+	/**
+	 * Returns a space-delimited string with items of the $options array. If a key
+	 * of $options array happens to be one of those listed
+	 * in `StringTemplate::$_compactAttributes` and its value is one of:
+	 *
+	 * - '1' (string)
+	 * - 1 (integer)
+	 * - true (boolean)
+	 * - 'true' (string)
+	 *
+	 * Then the value will be reset to be identical with key's name.
+	 * If the value is not one of these 4, the parameter is not output.
+	 *
+	 * 'escape' is a special option in that it controls the conversion of
+	 * attributes to their html-entity encoded equivalents. Set to false to disable html-encoding.
+	 *
+	 * If value for any option key is set to `null` or `false`, that option will be excluded from output.
+	 *
+	 * This method uses the 'attribute' and 'compactAttribute' templates. Each of
+	 * these templates uses the `name` and `value` variables. You can modify these
+	 * templates to change how attributes are formatted.
+	 *
+	 * @param array $options Array of options.
+	 * @param null|array $exclude Array of options to be excluded, the options here will not be part of the return.
+	 * @return string Composed attributes.
+	 */
 	public function formatAttributes($options, $exclude = null) {
 		$insertBefore = ' ';
 		$options = (array)$options + array('escape' => true);
@@ -225,15 +225,15 @@ class StringTemplate {
 		return $out ? $insertBefore . $out : '';
 	}
 
-/**
- * Formats an individual attribute, and returns the string value of the composed attribute.
- * Works with minimized attributes that have the same value as their name such as 'disabled' and 'checked'
- *
- * @param string $key The name of the attribute to create
- * @param string|array $value The value of the attribute to create.
- * @param bool $escape Define if the value must be escaped
- * @return string The composed attribute.
- */
+	/**
+	 * Formats an individual attribute, and returns the string value of the composed attribute.
+	 * Works with minimized attributes that have the same value as their name such as 'disabled' and 'checked'
+	 *
+	 * @param string $key The name of the attribute to create
+	 * @param string|array $value The value of the attribute to create.
+	 * @param bool $escape Define if the value must be escaped
+	 * @return string The composed attribute.
+	 */
 	protected function _formatAttribute($key, $value, $escape = true) {
 		if (is_array($value)) {
 			$value = implode(' ', $value);

+ 1 - 0
Model/Behavior/ConfirmableBehavior.php

@@ -1,5 +1,6 @@
 <?php
 App::uses('ModelBehavior', 'Model');
+
 /**
  * ConfirmableBehavior allows forms to easily require a checkbox toggled (confirmed).
  * Example: Terms of use on registration forms or some "confirm delete checkbox"

+ 1 - 0
Model/KeyValue.php

@@ -1,5 +1,6 @@
 <?php
 App::uses('ToolsAppModel', 'Tools.Model');
+
 /**
  * KeyValue Model
  *

+ 1 - 1
Test/Case/Lib/Utility/UtilityTest.php

@@ -357,7 +357,7 @@ class UtilityTest extends MyCakeTestCase {
 	}
 
 	/**
-	 * testCountDim method
+	 * TestCountDim method
 	 *
 	 * @return void
 	 */

+ 56 - 56
Test/Case/Lib/View/StringTemplateTest.php

@@ -3,21 +3,21 @@ App::uses('StringTemplate', 'Tools.View');
 
 class StringTemplateTest extends CakeTestCase {
 
-/**
- * setUp
- *
- * @return void
- */
+	/**
+	 * SetUp
+	 *
+	 * @return void
+	 */
 	public function setUp() {
 		parent::setUp();
 		$this->template = new StringTemplate();
 	}
 
-/**
- * Test adding templates through the constructor.
- *
- * @return void
- */
+	/**
+	 * Test adding templates through the constructor.
+	 *
+	 * @return void
+	 */
 	public function testConstructorAdd() {
 		$templates = array(
 			'link' => '<a href="{{url}}">{{text}}</a>'
@@ -27,11 +27,11 @@ class StringTemplateTest extends CakeTestCase {
 		$this->assertEquals($templates['link'], $template->config('link'));
 	}
 
-/**
- * test adding templates.
- *
- * @return void
- */
+	/**
+	 * Test adding templates.
+	 *
+	 * @return void
+	 */
 	public function testAdd() {
 		$templates = array(
 			'link' => '<a href="{{url}}">{{text}}</a>'
@@ -46,11 +46,11 @@ class StringTemplateTest extends CakeTestCase {
 		$this->assertEquals($templates['link'], $this->template->config('link'));
 	}
 
-/**
- * Test remove.
- *
- * @return void
- */
+	/**
+	 * Test remove.
+	 *
+	 * @return void
+	 */
 	public function testRemove() {
 		$templates = array(
 			'link' => '<a href="{{url}}">{{text}}</a>'
@@ -60,11 +60,11 @@ class StringTemplateTest extends CakeTestCase {
 		$this->assertNull($this->template->config('link'), 'Template should be gone.');
 	}
 
-/**
- * Test formatting strings.
- *
- * @return void
- */
+	/**
+	 * Test formatting strings.
+	 *
+	 * @return void
+	 */
 	public function testFormat() {
 		$templates = array(
 			'link' => '<a href="{{url}}">{{text}}</a>'
@@ -81,11 +81,11 @@ class StringTemplateTest extends CakeTestCase {
 		$this->assertEquals('<a href="/">example</a>', $result);
 	}
 
-/**
- * Test loading templates files in the app.
- *
- * @return void
- */
+	/**
+	 * Test loading templates files in the app.
+	 *
+	 * @return void
+	 */
 	public function testLoad() {
 		$this->skipIf(true, 'Find a way to mock the path from /Tools/Config to /Tools/Test/test_app/Config');
 
@@ -96,21 +96,21 @@ class StringTemplateTest extends CakeTestCase {
 		$this->assertEquals('<a href="{{url}}">{{text}}</a>', $this->template->config('link'));
 	}
 
-/**
- * Test that loading non-existing templates causes errors.
- *
- * @expectedException ConfigureException
- * @expectedExceptionMessage Could not load configuration file
- */
+	/**
+	 * Test that loading non-existing templates causes errors.
+	 *
+	 * @expectedException ConfigureException
+	 * @expectedExceptionMessage Could not load configuration file
+	 */
 	public function testLoadErrorNoFile() {
 		$this->template->load('no_such_file');
 	}
 
-/**
- * Test formatting compact attributes.
- *
- * @return void
- */
+	/**
+	 * Test formatting compact attributes.
+	 *
+	 * @return void
+	 */
 	public function testFormatAttributesCompact() {
 		$attrs = array('disabled' => true, 'selected' => 1, 'checked' => '1', 'multiple' => 'multiple');
 		$result = $this->template->formatAttributes($attrs);
@@ -127,11 +127,11 @@ class StringTemplateTest extends CakeTestCase {
 		);
 	}
 
-/**
- * Test formatting normal attributes.
- *
- * @return void
- */
+	/**
+	 * Test formatting normal attributes.
+	 *
+	 * @return void
+	 */
 	public function testFormatAttributes() {
 		$attrs = array('name' => 'bruce', 'data-hero' => '<batman>');
 		$result = $this->template->formatAttributes($attrs);
@@ -155,11 +155,11 @@ class StringTemplateTest extends CakeTestCase {
 		);
 	}
 
-/**
- * Test formatting array attributes.
- *
- * @return void
- */
+	/**
+	 * Test formatting array attributes.
+	 *
+	 * @return void
+	 */
 	public function testFormatAttributesArray() {
 		$attrs = array('name' => array('bruce', 'wayne'));
 		$result = $this->template->formatAttributes($attrs);
@@ -169,11 +169,11 @@ class StringTemplateTest extends CakeTestCase {
 		);
 	}
 
-/**
- * Tests that compile information is refreshed on adds and removes
- *
- * @return void
- */
+	/**
+	 * Tests that compile information is refreshed on adds and removes
+	 *
+	 * @return void
+	 */
 	public function testCopiledInfoRefresh() {
 		$compilation = $this->template->compile('link');
 		$this->template->add([

+ 8 - 8
Test/Case/Model/Behavior/SoftDeleteBehaviorTest.php

@@ -131,7 +131,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testSoftDeleteWithCounterCache
+	 * TestSoftDeleteWithCounterCache
 	 *
 	 * @return void
 	 */
@@ -149,7 +149,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testSoftDeleteWithMultipleCounterCache
+	 * TestSoftDeleteWithMultipleCounterCache
 	 *
 	 * @return void
 	 */
@@ -176,7 +176,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testSoftDeleteWithCounterCacheOnMultipleAssociations
+	 * TestSoftDeleteWithCounterCacheOnMultipleAssociations
 	 *
 	 * @return void
 	 */
@@ -212,7 +212,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testSoftDeleteWithoutCounterCache
+	 * TestSoftDeleteWithoutCounterCache
 	 *
 	 * @return void
 	 */
@@ -225,7 +225,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testUnDeleteWithCounterCache
+	 * TestUnDeleteWithCounterCache
 	 *
 	 * @return void
 	 */
@@ -243,7 +243,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testUnDeleteWithMultipleCounterCache
+	 * TestUnDeleteWithMultipleCounterCache
 	 *
 	 * @return void
 	 */
@@ -270,7 +270,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testUnDeleteWithCounterCacheOnMultipleAssociations
+	 * TestUnDeleteWithCounterCacheOnMultipleAssociations
 	 *
 	 * @return void
 	 */
@@ -304,7 +304,7 @@ class SoftDeleteBehaviorTest extends CakeTestCase {
 	}
 
 	/**
-	 * testUnDeleteWithoutCounterCache
+	 * TestUnDeleteWithoutCounterCache
 	 *
 	 * @return void
 	 */

+ 0 - 7
Test/Case/Model/MyModelTest.php

@@ -292,27 +292,21 @@ class MyModelTest extends MyCakeTestCase {
 		$is = $this->User->validateRange(array('range' => 2), 1, 3);
 		$this->assertTrue($is);
 
-
 		$is = $this->User->validateRange(array('range' => 2.4), 1.5, 2.3);
 		$this->assertFalse($is);
 
-
 		$is = $this->User->validateRange(array('range' => -5), -10, 1);
 		$this->assertTrue($is);
 
-
 		$is = $this->User->validateRange(array('range' => 'word'), 1.5, 2.3);
 		$this->assertFalse($is);
 
-
 		$is = $this->User->validateRange(array('range' => 5.1));
 		$this->assertTrue($is);
 
-
 		$is = $this->User->validateRange(array('range' => 2.1), 2.1, 3.2);
 		$this->assertTrue($is);
 
-
 		$is = $this->User->validateRange(array('range' => 3.2), 2.1, 3.2);
 		$this->assertTrue($is);
 	}
@@ -851,7 +845,6 @@ class MyModelTest extends MyCakeTestCase {
 	 */
 	public function testValidateUnique() {
 
-
 		$this->Post->validate['title'] = array(
 			'validateUnique' => array(
 				'rule' => 'validateUnique',

+ 0 - 1
Test/Case/View/Helper/FormatHelperTest.php

@@ -394,7 +394,6 @@ class FormatHelperTest extends MyCakeTestCase {
 
 		$this->assertEquals($expected, $result);
 
-
 		$this->Format->settings['fontIcons'] = array(
 			'prev' => 'fa fa-prev',
 			'next' => 'fa fa-next');