Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

QA: Miscc QA fixes, including trailing commas, param documentation an…

…d line length fixes.
  • Loading branch information...
commit 30ab4c119712bfc71abc31afb5b5cd4929a8e899 1 parent 7e25f09
@daschl daschl authored
View
2  core/Object.php
@@ -122,7 +122,7 @@ protected function _init() {
if (!isset($this->_config[$key]) && !isset($this->_config[$flag])) {
continue;
}
-
+
if ($flag === 'merge') {
$this->{"_{$key}"} = $this->_config[$key] + $this->{"_{$key}"};
} else {
View
6 data/Collection.php
@@ -246,7 +246,7 @@ public function map($filter, array $options = array()) {
}
return $data;
}
-
+
/**
* Sorts the objects in the collection, useful in situations where
* you are already using the underlying datastore to sort results.
@@ -267,11 +267,11 @@ public function sort($field = 'id', array $options = array()) {
if (is_array($a)) {
$a = (object) $a;
}
-
+
if (is_array($b)) {
$b = (object) $b;
}
-
+
return strcmp($a->$field, $b->$field);
};
} else if (is_callable($field)) {
View
24 net/http/Media.php
@@ -798,15 +798,23 @@ protected static function _handlers($type = null) {
)
),
'html' => array(),
- 'json' => array('cast' => true, 'encode' => 'json_encode', 'decode' => function($data) {
- return json_decode($data, true);
- }),
+ 'json' => array(
+ 'cast' => true,
+ 'encode' => 'json_encode',
+ 'decode' => function($data) {
+ return json_decode($data, true);
+ }
+ ),
'text' => array('cast' => false, 'encode' => function($s) { return $s; }),
- 'form' => array('cast' => true, 'encode' => 'http_build_query', 'decode' => function($data) {
- $decoded = array();
- parse_str($data, $decoded);
- return $decoded;
- })
+ 'form' => array(
+ 'cast' => true,
+ 'encode' => 'http_build_query',
+ 'decode' => function($data) {
+ $decoded = array();
+ parse_str($data, $decoded);
+ return $decoded;
+ }
+ )
);
if ($type) {
View
22 storage/session/strategy/Encrypt.php
@@ -14,7 +14,7 @@
* This strategy allows you to encrypt your `Session` and / or `Cookie` data so that it
* is not stored in cleartext on the client side. You must provide a secret key, otherwise
* an exception is raised.
- *
+ *
* To use this class, you need to have the `mcrypt` extension enabled.
*
* Example configuration:
@@ -26,7 +26,7 @@
* )));
* }}}
*
- * By default, this strategy uses the AES algorithm in the CBC mode. This means that an
+ * By default, this strategy uses the AES algorithm in the CBC mode. This means that an
* initialization vector has to be generated and transported with the payload data. This
* is done transparently, but you may want to keep this in mind (the ECB mode doesn't require
* an itialization vector but is not recommended to use as it's insecure). You can override this
@@ -42,7 +42,7 @@
* ))
* )));
* }}}
- *
+ *
* Please keep in mind that it is generally not a good idea to store sensitive information in
* cookies (or generally on the client side) and this class is no exception to the rule. It allows
* you to store client side data in a more secure way, but 100% security can't be achieved.
@@ -64,7 +64,7 @@ class Encrypt extends \lithium\core\Object {
* @param array $config Configuration array. You can override the default cipher and mode.
*/
public function __construct(array $config = array()) {
- if(!static::enabled()) {
+ if (!static::enabled()) {
throw new ConfigException("The Mcrypt extension is not installed or enabled.");
}
if (!isset($config['secret'])) {
@@ -83,7 +83,7 @@ public function __construct(array $config = array()) {
/**
* Read encryption method.
- *
+ *
* @param array $data the Data being read.
* @param array $options Options for this method.
* @return mixed Returns the decrypted key or the dataset.
@@ -157,7 +157,7 @@ public static function enabled() {
/**
* Serialize and encrypt a given data array.
*
- * @param array The cleartext data to be encrypted.
+ * @param array $decrypted The cleartext data to be encrypted.
* @return string A Base64 encoded and encrypted string.
*/
protected function _encrypt($decrypted = array()) {
@@ -175,7 +175,7 @@ protected function _encrypt($decrypted = array()) {
/**
* Decrypt and unserialize a previously encrypted string.
*
- * @param string a Base64 encoded and encrypted string.
+ * @param string $encrypted The base64 encoded and encrypted string.
* @return array The cleartext data.
*/
protected function _decrypt($encrypted) {
@@ -197,8 +197,8 @@ protected function _decrypt($encrypted) {
/**
* Generates an initialization vector.
*
- * @param string The cipher for the initialization vector.
- * @param string The mode for the initialization vector.
+ * @param string $cipher The cipher for the initialization vector.
+ * @param string $mode The mode for the initialization vector.
* @return string Returns an initialization vector.
* @link http://www.php.net/manual/en/function.mcrypt-create-iv.php
*/
@@ -214,8 +214,8 @@ protected static function _vector($cipher, $mode) {
/**
* Returns the vector size vor a given cipher and mode.
*
- * @param string The cipher for the initialization vector.
- * @param string The mode for the initialization vector.
+ * @param string $cipher The cipher for the initialization vector.
+ * @param string $mode The mode for the initialization vector.
* @return number The vector size.
*/
protected static function _vectorSize($cipher, $mode) {
View
2  template/helper/Form.php
@@ -64,7 +64,7 @@ class Form extends \lithium\template\Helper {
'submit-image' => '<input type="image" src="{:url}"{:options} />',
'text' => '<input type="text" name="{:name}"{:options} />',
'textarea' => '<textarea name="{:name}"{:options}>{:value}</textarea>',
- 'fieldset' => '<fieldset{:options}><legend>{:content}</legend>{:raw}</fieldset>',
+ 'fieldset' => '<fieldset{:options}><legend>{:content}</legend>{:raw}</fieldset>'
);
/**
View
2  test/Unit.php
@@ -967,7 +967,7 @@ public function results() {
* This method is used to check for a working connection to lithify.me, both
* testing for proper dns resolution and reading the actual URL.
*
- * @param array $options Override the default URI to check.
+ * @param array $config Override the default URI to check.
* @return boolean True if a network connection is established, false otherwise.
*/
protected function _hasNetwork($config = array()) {
View
10 tests/cases/action/RequestTest.php
@@ -148,9 +148,9 @@ public function testRequestWithoutUrlQueryParam() {
'REQUEST_URI' => '/test_app'
)));
$this->assertEqual('/test_app', $request->env('base'));
- $this->assertEqual('/', $request->url);
+ $this->assertEqual('/', $request->url);
}
-
+
public function testRequestWithoutUrlQueryParamAndNoApp() {
unset($_GET['url']);
$request = new Request(array('env' => array(
@@ -158,9 +158,9 @@ public function testRequestWithoutUrlQueryParamAndNoApp() {
'REQUEST_URI' => '/test_app'
)));
$this->assertEqual('/test_app', $request->env('base'));
- $this->assertEqual('/', $request->url);
+ $this->assertEqual('/', $request->url);
}
-
+
public function testRequestWithoutUrlQueryParamAndNoAppOrWebroot() {
unset($_GET['url']);
$request = new Request(array('env' => array(
@@ -168,7 +168,7 @@ public function testRequestWithoutUrlQueryParamAndNoAppOrWebroot() {
'REQUEST_URI' => '/test_app'
)));
$this->assertEqual('/test_app', $request->env('base'));
- $this->assertEqual('/', $request->url);
+ $this->assertEqual('/', $request->url);
}
public function testBaseWithAppAndOtherDirectory() {
View
7 tests/cases/data/CollectionTest.php
@@ -9,7 +9,6 @@
namespace lithium\tests\cases\data;
use lithium\data\collection\DocumentSet;
-use lithium\data\entity\Document;
use lithium\data\Connections;
class CollectionTest extends \lithium\test\Unit {
@@ -108,7 +107,7 @@ public function testData() {
$collection->set($data);
$this->assertEqual($data, $collection->data());
}
-
+
// Tests the sort method in \lithium\data\Collection
public function testSort() {
$collection = new DocumentSet();
@@ -119,9 +118,9 @@ public function testSort() {
array('id' => 4, 'name' => 'Katarina'),
array('id' => 5, 'name' => 'Nunu')
));
-
+
$collection->sort('name');
-
+
$idsSorted = $collection->map(function ($v) { return $v['id']; })->to('array');
$this->assertEqual($idsSorted, array(1,4,5,3,2));
}
View
2  tests/cases/data/collection/RecordSetTest.php
@@ -398,7 +398,7 @@ public function testRecordSetFindFilter() {
);
$records = $this->_recordSet->find(function($item) {
- return true;
+ return true;
});
$this->assertEqual($expected, $records->to('array'));
}
View
4 tests/cases/net/http/ResponseTest.php
@@ -69,13 +69,13 @@ public function testParsingContentTypeWithEncoding() {
// Content type WITH ONE space between type and charset
$response = new Response(array('headers' => array(
- 'Content-Type' => 'application/json; charset=iso-8859-1',
+ 'Content-Type' => 'application/json; charset=iso-8859-1'
)));
$this->assertEqual('application/json', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
$response = new Response(array('headers' => array(
- 'Content-Type' => 'application/json; charset=iso-8859-1',
+ 'Content-Type' => 'application/json; charset=iso-8859-1'
)));
$this->assertEqual('application/json', $response->type);
$this->assertEqual('ISO-8859-1', $response->encoding);
View
7 tests/cases/template/helper/FormTest.php
@@ -712,7 +712,12 @@ public function testFormFieldWithCustomConfig() {
'label' => array('for' => 'Username'),
'Username',
'/label',
- 'input' => array('type' => 'text', 'name' => 'username', 'class' => 'custom-field', 'id' => 'Username'),
+ 'input' => array(
+ 'type' => 'text',
+ 'name' => 'username',
+ 'class' => 'custom-field',
+ 'id' => 'Username'
+ ),
'/div'
));
}
View
7 tests/cases/util/CollectionTest.php
@@ -292,7 +292,12 @@ public function testCollectionSort() {
// Numeric sort using custom function
$collection = new Collection(array('data' => array(5,3,4,1,2)));
- $collection->sort(function ($a,$b) { if ($a == $b) { return 0; } return ($b > $a ? 1 : -1); });
+ $collection->sort(function ($a,$b) {
+ if ($a == $b) {
+ return 0;
+ }
+ return ($b > $a ? 1 : -1);
+ });
$expected = array(5,4,3,2,1);
$this->assertEqual($expected, $collection->to('array'));
View
6 tests/cases/util/ValidatorTest.php
@@ -973,13 +973,13 @@ public function testCheckMultipleHasErrors() {
);
$this->assertEqual($expected, $result);
}
-
+
public function testCheckWithLastRule() {
$rules = array(
'title' => array('please enter a title'),
'email' => array(
array('notEmpty', 'message' => 'email is empty', 'last' => true),
- array('email', 'message' => 'email is invalid'),
+ array('email', 'message' => 'email is invalid')
)
);
$result = Validator::check(array(), $rules);
@@ -991,7 +991,7 @@ public function testCheckWithLastRule() {
);
$this->assertEqual($expected, $result);
}
-
+
public function testCheckMultipleHasFirstError() {
$rules = array(
'title' => 'please enter a title',
View
2  tests/mocks/core/MockRequest.php
@@ -17,7 +17,7 @@ class MockRequest extends \lithium\core\Object {
public $argv = array();
public function env($key) {
- if(isset($this->_config[$key])) {
+ if (isset($this->_config[$key])) {
return $this->_config[$key];
}
return null;
View
2  util/Validator.php
@@ -469,7 +469,7 @@ public static function check(array $values, array $rules, array $options = array
if (!static::rule($name, $values[$field], $rule['format'], $rule + $options)) {
$errors[$field][] = $rule['message'] ?: $key;
-
+
if ($rule['last']) {
break;
}
Please sign in to comment.
Something went wrong with that request. Please try again.