Skip to content

Commit 0b3012b

Browse files
committed
Merge pull request #238 from henriquemoody/standards
Use PSR-2 standard
2 parents 018c3fe + 9fa5f7c commit 0b3012b

File tree

193 files changed

+415
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+415
-700
lines changed

.scrutinizer.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ tools:
1010
external_code_coverage: true
1111
php_analyzer: true
1212
php_changetracking: true
13+
php_code_sniffer:
14+
config:
15+
standard: "PSR2"
1316
php_cpd: true
1417
php_mess_detector: true
1518
php_pdepend: true

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2009-2014, Alexandre Gomes Gaigalas.
1+
Copyright (c) 2009-2015, Alexandre Gomes Gaigalas.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification,

library/ExceptionIterator.php

-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ public function getChildren()
2828
return new static($this->current()->getRelated($this->fullRelated), $this->fullRelated);
2929
}
3030
}
31-

library/Exceptions/AbstractGroupedException.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AbstractGroupedException extends AbstractNestedException
1313
self::MODE_NEGATIVE => array(
1414
self::NONE => 'None of there rules must pass for {{name}}',
1515
self::SOME => 'These rules must not pass for {{name}}',
16-
)
16+
),
1717
);
1818

1919
public function chooseTemplate()
@@ -40,11 +40,11 @@ public function getTemplate()
4040

4141
if (!$isEmpty && $this->template != $parentTemplate) {
4242
return $this->template;
43-
} if ($isEmpty && 1 === count($this->related)) {
43+
}
44+
if ($isEmpty && 1 === count($this->related)) {
4445
return current($this->related)->getTemplate();
4546
} else {
4647
return $parentTemplate;
4748
}
4849
}
4950
}
50-

library/Exceptions/AbstractNestedException.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function findRelated($path)
5252
return $target;
5353
}
5454

55-
public function getIterator($full=false, $mode=self::ITERATE_ALL)
55+
public function getIterator($full = false, $mode = self::ITERATE_ALL)
5656
{
5757
$exceptionIterator = new ExceptionIterator($this, $full);
5858

@@ -74,7 +74,7 @@ public function getFullMessage()
7474
return implode(PHP_EOL, $message);
7575
}
7676

77-
public function getRelated($full=false)
77+
public function getRelated($full = false)
7878
{
7979
if (!$full && 1 === count($this->related)
8080
&& current($this->related) instanceof AbstractNestedException) {
@@ -104,4 +104,3 @@ public function setRelated(array $relatedExceptions)
104104
return $this;
105105
}
106106
}
107-

library/Exceptions/AllOfException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class AllOfException extends AbstractGroupedException
1111
self::MODE_NEGATIVE => array(
1212
self::NONE => 'None of these rules must pass for {{name}}',
1313
self::SOME => 'These rules must not pass for {{name}}',
14-
)
14+
),
1515
);
1616
}
17-

library/Exceptions/AlnumException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ class AlnumException extends AlphaException
66
public static $defaultTemplates = array(
77
self::MODE_DEFAULT => array(
88
self::STANDARD => '{{name}} must contain only letters (a-z) and digits (0-9)',
9-
self::EXTRA => '{{name}} must contain only letters (a-z), digits (0-9) and "{{additionalChars}}"'
9+
self::EXTRA => '{{name}} must contain only letters (a-z), digits (0-9) and "{{additionalChars}}"',
1010
),
1111
self::MODE_NEGATIVE => array(
1212
self::STANDARD => '{{name}} must not contain letters (a-z) or digits (0-9)',
13-
self::EXTRA => '{{name}} must not contain letters (a-z), digits (0-9) or "{{additionalChars}}"'
14-
)
13+
self::EXTRA => '{{name}} must not contain letters (a-z), digits (0-9) or "{{additionalChars}}"',
14+
),
1515
);
1616
}
17-

library/Exceptions/AlphaException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ class AlphaException extends ValidationException
88
public static $defaultTemplates = array(
99
self::MODE_DEFAULT => array(
1010
self::STANDARD => '{{name}} must contain only letters (a-z)',
11-
self::EXTRA => '{{name}} must contain only letters (a-z) and "{{additionalChars}}"'
11+
self::EXTRA => '{{name}} must contain only letters (a-z) and "{{additionalChars}}"',
1212
),
1313
self::MODE_NEGATIVE => array(
1414
self::STANDARD => '{{name}} must not contain letters (a-z)',
15-
self::EXTRA => '{{name}} must not contain letters (a-z) or "{{additionalChars}}"'
16-
)
15+
self::EXTRA => '{{name}} must not contain letters (a-z) or "{{additionalChars}}"',
16+
),
1717
);
1818

1919
public function chooseTemplate()
2020
{
2121
return $this->getParam('additionalChars') ? static::EXTRA : static::STANDARD;
2222
}
2323
}
24-

library/Exceptions/AlwaysInvalidException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class AlwaysInvalidException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} is always valid',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/AlwaysValidException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class AlwaysValidException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} is always invalid',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/ArrException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class ArrException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be an array',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/AtLeastException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class AtLeastException extends AbstractGroupedException
1111
self::MODE_NEGATIVE => array(
1212
self::NONE => 'At least {{howMany}} of the {{failed}} required rules must not pass for {{name}}',
1313
self::SOME => 'At least {{howMany}} of the {{failed}} required rules must not pass for {{name}}, only {{passed}} passed.',
14-
)
14+
),
1515
);
1616
}
17-

library/Exceptions/AttributeException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ class AttributeException extends AbstractNestedException
1313
self::MODE_NEGATIVE => array(
1414
self::NOT_PRESENT => 'Attribute {{name}} must not be present',
1515
self::INVALID => 'Attribute {{name}} must not validate',
16-
)
16+
),
1717
);
1818

1919
public function chooseTemplate()
2020
{
2121
return $this->getParam('hasReference') ? static::INVALID : static::NOT_PRESENT;
2222
}
2323
}
24-

library/Exceptions/BaseException.php

-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33

44
class BaseException extends ValidationException
55
{
6-
76
}
8-

library/Exceptions/BetweenException.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class BetweenException extends AbstractNestedException
1717
self::BOTH => '{{name}} must not be between {{minValue}} and {{maxValue}}',
1818
self::LOWER => '{{name}} must not be greater than {{minValue}}',
1919
self::GREATER => '{{name}} must not be lower than {{maxValue}}',
20-
)
20+
),
2121
);
2222

23-
public function configure($name, array $params=array())
23+
public function configure($name, array $params = array())
2424
{
2525
$params['minValue'] = static::stringify($params['minValue']);
2626
$params['maxValue'] = static::stringify($params['maxValue']);
@@ -39,4 +39,3 @@ public function chooseTemplate()
3939
}
4040
}
4141
}
42-

library/Exceptions/BoolException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class BoolException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a boolean',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CallException.php

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
class CallException extends AbstractGroupedException
55
{
66
}
7-

library/Exceptions/CallbackException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CallbackException extends AbstractNestedException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be valid',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CharsetException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ class CharsetException extends ValidationException
55
{
66
public static $defaultTemplates = array(
77
self::MODE_DEFAULT => array(
8-
self::STANDARD => '{{name}} must be in the {{charset}} charset'
8+
self::STANDARD => '{{name}} must be in the {{charset}} charset',
99
),
1010
self::MODE_NEGATIVE => array(
11-
self::STANDARD => '{{name}} must not be in the {{charset}} charset'
12-
)
11+
self::STANDARD => '{{name}} must not be in the {{charset}} charset',
12+
),
1313
);
1414
}
15-

library/Exceptions/CnhException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CnhException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a valid CNH number',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CnpjException.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
class CnpjException extends ValidationException
66
{
7-
87
public static $defaultTemplates = array(
98
self::MODE_DEFAULT => array(
109
self::STANDARD => '{{name}} must be a valid CNPJ number',
1110
),
1211
self::MODE_NEGATIVE => array(
1312
self::STANDARD => '{{name}} must not be a valid CNPJ number',
14-
)
13+
),
1514
);
16-
17-
}
15+
}

library/Exceptions/CntrlException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ class CntrlException extends AlphaException
66
public static $defaultTemplates = array(
77
self::MODE_DEFAULT => array(
88
self::STANDARD => '{{name}} must contain only control characters',
9-
self::EXTRA => '{{name}} must contain only control characters and "{{additionalChars}}"'
9+
self::EXTRA => '{{name}} must contain only control characters and "{{additionalChars}}"',
1010
),
1111
self::MODE_NEGATIVE => array(
1212
self::STANDARD => '{{name}} must not contain control characters',
13-
self::EXTRA => '{{name}} must not contain control characters or "{{additionalChars}}"'
14-
)
13+
self::EXTRA => '{{name}} must not contain control characters or "{{additionalChars}}"',
14+
),
1515
);
1616
}
17-

library/Exceptions/ComponentException.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
class ComponentException extends Exception
77
{
88
}
9-

library/Exceptions/ConsonantException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ class ConsonantException extends AlphaException
66
public static $defaultTemplates = array(
77
self::MODE_DEFAULT => array(
88
self::STANDARD => '{{name}} must contain only consonants',
9-
self::EXTRA => '{{name}} must contain only consonants and "{{additionalChars}}"'
9+
self::EXTRA => '{{name}} must contain only consonants and "{{additionalChars}}"',
1010
),
1111
self::MODE_NEGATIVE => array(
1212
self::STANDARD => '{{name}} must not contain consonants',
13-
self::EXTRA => '{{name}} must not contain consonants or "{{additionalChars}}"'
14-
)
13+
self::EXTRA => '{{name}} must not contain consonants or "{{additionalChars}}"',
14+
),
1515
);
1616
}
17-

library/Exceptions/ContainsException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class ContainsException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not contain the value "{{containsValue}}"',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CountryCodeException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CountryCodeException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a valid country',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CpfException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CpfException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a valid CPF number',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/CreditCardException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class CreditCardException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a valid Credit Card number',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/DateException.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ class DateException extends ValidationException
88
public static $defaultTemplates = array(
99
self::MODE_DEFAULT => array(
1010
self::STANDARD => '{{name}} must be a valid date',
11-
self::FORMAT => '{{name}} must be a valid date. Sample format: {{format}}'
11+
self::FORMAT => '{{name}} must be a valid date. Sample format: {{format}}',
1212
),
1313
self::MODE_NEGATIVE => array(
1414
self::STANDARD => '{{name}} must not be a valid date',
15-
self::FORMAT => '{{name}} must not be a valid date in the format {{format}}'
16-
)
15+
self::FORMAT => '{{name}} must not be a valid date in the format {{format}}',
16+
),
1717
);
1818

19-
public function configure($name, array $params=array())
19+
public function configure($name, array $params = array())
2020
{
2121
$params['format'] = date(
22-
$params['format'], strtotime('2005-12-30 01:02:03')
22+
$params['format'],
23+
strtotime('2005-12-30 01:02:03')
2324
);
2425

2526
return parent::configure($name, $params);
@@ -30,4 +31,3 @@ public function chooseTemplate()
3031
return $this->getParam('format') ? static::FORMAT : static::STANDARD;
3132
}
3233
}
33-

library/Exceptions/DigitException.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ class DigitException extends AlphaException
66
public static $defaultTemplates = array(
77
self::MODE_DEFAULT => array(
88
self::STANDARD => '{{name}} must contain only digits (0-9)',
9-
self::EXTRA => '{{name}} must contain only digits (0-9) and "{{additionalChars}}"'
9+
self::EXTRA => '{{name}} must contain only digits (0-9) and "{{additionalChars}}"',
1010
),
1111
self::MODE_NEGATIVE => array(
1212
self::STANDARD => '{{name}} must not contain digits (0-9)',
13-
self::EXTRA => '{{name}} must not contain digits (0-9) or "{{additionalChars}}"'
14-
)
13+
self::EXTRA => '{{name}} must not contain digits (0-9) or "{{additionalChars}}"',
14+
),
1515
);
1616
}
17-

library/Exceptions/DirectoryException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class DirectoryException extends ValidationException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a directory',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/DomainException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class DomainException extends AbstractNestedException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => '{{name}} must not be a valid domain',
12-
)
12+
),
1313
);
1414
}
15-

library/Exceptions/EachException.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class EachException extends AbstractNestedException
99
),
1010
self::MODE_NEGATIVE => array(
1111
self::STANDARD => 'Each item in {{name}} must not validate',
12-
)
12+
),
1313
);
1414
}
15-

0 commit comments

Comments
 (0)