Skip to content

Commit

Permalink
Fix CS errors that fixers missed
Browse files Browse the repository at this point in the history
  • Loading branch information
bcrowe committed Dec 31, 2014
1 parent be845a3 commit 81c025b
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 46 deletions.
1 change: 0 additions & 1 deletion src/Database/Driver/Sqlite.php
Expand Up @@ -72,7 +72,6 @@ public function connect()
*
* @return bool true if it is valid to use this driver
*/

public function enabled()
{
return in_array('sqlite', PDO::getAvailableDrivers());
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Behavior/TranslateBehavior.php
Expand Up @@ -188,10 +188,10 @@ public function beforeFind(Event $event, Query $query, $options)
$select
);

if ($changeFilter) {
$filter = $options['filterByCurrentLocale'] ? 'INNER' : 'LEFT';
$contain[$alias . '_' . $field . '_translation']['joinType'] = $filter;
}
if ($changeFilter) {
$filter = $options['filterByCurrentLocale'] ? 'INNER' : 'LEFT';
$contain[$alias . '_' . $field . '_translation']['joinType'] = $filter;
}
}

$query->contain($contain);
Expand Down
2 changes: 1 addition & 1 deletion src/Network/Request.php
Expand Up @@ -1014,7 +1014,7 @@ public function accepts($type = null)
* Generally you want to use Cake\Network\Request::accept() to get a simple list
* of the accepted content types.
*
* @return array An array of prefValue => array(content/types)
* @return array An array of prefValue => [content/types]
*/
public function parseAccept()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Utility/Hash.php
Expand Up @@ -160,11 +160,12 @@ public static function extract(array $data, $path)
}
return $context[$_key];
}

/**
* Split token conditions
*
* @param string $token the token being splitted.
* @return array array(token, conditions) with token splitted
* @return array [token, conditions] with token splitted
*/
protected static function _splitConditions($token)
{
Expand Down
30 changes: 14 additions & 16 deletions src/Validation/Validation.php
Expand Up @@ -155,23 +155,21 @@ public static function cc($check, $type = 'fast', $deep = false, $regex = null)
}
$cards = array(
'all' => array(
'amex' => '/^3[4|7]\\d{13}$/',
'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/',
'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/',
'disc' => '/^(?:6011|650\\d)\\d{12}$/',
'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
'enroute' => '/^2(?:014|149)\\d{11}$/',
'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
'mc' => '/^5[1-5]\\d{14}$/',
'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
'switch' =>
'/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
'visa' => '/^4\\d{12}(\\d{3})?$/',
'voyager' => '/^8699[0-9]{11}$/'
'amex' => '/^3[4|7]\\d{13}$/',
'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/',
'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/',
'disc' => '/^(?:6011|650\\d)\\d{12}$/',
'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
'enroute' => '/^2(?:014|149)\\d{11}$/',
'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
'mc' => '/^5[1-5]\\d{14}$/',
'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
'visa' => '/^4\\d{12}(\\d{3})?$/',
'voyager' => '/^8699[0-9]{11}$/'
),
'fast' =>
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
);

if (is_array($type)) {
Expand Down
6 changes: 6 additions & 0 deletions src/View/Helper/FormHelper.php
Expand Up @@ -363,18 +363,24 @@ public function create($model = null, array $options = [])
case 'get':
$htmlAttributes['method'] = 'get';
break;
// Set enctype for form
case 'file':
$htmlAttributes['enctype'] = 'multipart/form-data';
$options['type'] = ($isCreate) ? 'post' : 'put';
// Move on
case 'post':
// Move on
case 'put':
// Move on
case 'delete':
// Set patch method
case 'patch':
$append .= $this->hidden('_method', array(
'name' => '_method',
'value' => strtoupper($options['type']),
'secure' => static::SECURE_SKIP
));
// Default to post method
default:
$htmlAttributes['method'] = 'post';
}
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Network/SocketTest.php
Expand Up @@ -57,11 +57,11 @@ public function testConstruct()
$this->Socket = new Socket();
$config = $this->Socket->config();
$this->assertSame($config, array(
'persistent' => false,
'host' => 'localhost',
'protocol' => 'tcp',
'port' => 80,
'timeout' => 30
'persistent' => false,
'host' => 'localhost',
'protocol' => 'tcp',
'port' => 80,
'timeout' => 30
));

$this->Socket->reset();
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -3261,7 +3261,7 @@ function ($article) {
public function testInitializeEvent()
{
$count = 0;
$cb = function ($event) use (&$count){
$cb = function ($event) use (&$count) {
$count++;
};
EventManager::instance()->attach($cb, 'Model.initialize');
Expand Down Expand Up @@ -3294,7 +3294,7 @@ public function testHasFinder()
public function testBuildValidatorEvent()
{
$count = 0;
$cb = function ($event) use (&$count){
$cb = function ($event) use (&$count) {
$count++;
};
EventManager::instance()->attach($cb, 'Model.buildValidator');
Expand Down
32 changes: 16 additions & 16 deletions tests/test_app/config/acl.php
Expand Up @@ -18,30 +18,30 @@
// Roles
// -------------------------------------
$config['roles'] = array(
'Role/admin' => null,
'Role/data_acquirer' => null,
'Role/accounting' => null,
'Role/database_manager' => null,
'Role/sales' => null,
'Role/data_analyst' => 'Role/data_acquirer, Role/database_manager',
'Role/reports' => 'Role/data_analyst',
'Role/admin' => null,
'Role/data_acquirer' => null,
'Role/accounting' => null,
'Role/database_manager' => null,
'Role/sales' => null,
'Role/data_analyst' => 'Role/data_acquirer, Role/database_manager',
'Role/reports' => 'Role/data_analyst',
// allow inherited roles to be defined as an array or comma separated list
'Role/manager' => array(
'Role/manager' => array(
'Role/accounting',
'Role/sales',
),
'Role/accounting_manager' => 'Role/accounting',
'Role/accounting_manager' => 'Role/accounting',
// managers
'User/hardy' => 'Role/accounting_manager, Role/reports',
'User/stan' => 'Role/manager',
'User/hardy' => 'Role/accounting_manager, Role/reports',
'User/stan' => 'Role/manager',
// accountants
'User/peter' => 'Role/accounting',
'User/jeff' => 'Role/accounting',
'User/peter' => 'Role/accounting',
'User/jeff' => 'Role/accounting',
// admins
'User/jan' => 'Role/admin',
'User/jan' => 'Role/admin',
// database
'User/db_manager_1' => 'Role/database_manager',
'User/db_manager_2' => 'Role/database_manager',
'User/db_manager_1' => 'Role/database_manager',
'User/db_manager_2' => 'Role/database_manager',
);

//-------------------------------------
Expand Down

0 comments on commit 81c025b

Please sign in to comment.