Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkingshott committed Apr 26, 2020
1 parent 23efc47 commit d38b487
Show file tree
Hide file tree
Showing 49 changed files with 17 additions and 161 deletions.
15 changes: 6 additions & 9 deletions src/Rules/CitizenIdentification.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Axiom\Support\Iso3166Alpha2;
use Axiom\Support\Iso3166Alpha3;

// Citizen identification rule
class CitizenIdentification extends Rule
{

Expand All @@ -27,15 +24,15 @@ public function passes($attribute, $value) : bool

case 'US':
case 'USA':
return $this -> verifyUnitedStates($value);
return $this->verifyUnitedStates($value);

case 'GB':
case 'GBR':
return $this -> verifyUnitedKingdom($value);
return $this->verifyUnitedKingdom($value);

case 'FR':
case 'FRA':
return $this -> verifyFrance($value);
return $this->verifyFrance($value);

default:
return false;
Expand Down Expand Up @@ -65,7 +62,7 @@ public function message() : string
**/
protected function verifyFrance($value) : bool
{
return preg_match("/^[1,2][ ]?[0-9]{2}[ ]?[0,1,2,3,5][0-9][ ]?[0-9A-Z]{5}[ ]?[0-9]{3}[ ]?[0-9]{2}$/", $value) > 0;
return preg_match('/^[1,2][ ]?[0-9]{2}[ ]?[0,1,2,3,5][0-9][ ]?[0-9A-Z]{5}[ ]?[0-9]{3}[ ]?[0-9]{2}$/', $value) > 0;
}


Expand All @@ -76,7 +73,7 @@ protected function verifyFrance($value) : bool
**/
protected function verifyUnitedKingdom($value) : bool
{
return preg_match("/^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/", $value) > 0;
return preg_match('/^[A-CEGHJ-PR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1}[0-9]{6}[A-DFM]{0,1}$/', $value) > 0;
}


Expand All @@ -87,7 +84,7 @@ protected function verifyUnitedKingdom($value) : bool
**/
protected function verifyUnitedStates($value) : bool
{
return preg_match("/^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/", $value) > 0;
return preg_match('/^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/', $value) > 0;
}

}
3 changes: 0 additions & 3 deletions src/Rules/CountryCode.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Axiom\Support\Iso3166Alpha2;
use Axiom\Support\Iso3166Alpha3;

// Country code rule
class CountryCode extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/Decimal.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Decimal rule
class Decimal extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/DisposableEmail.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Exception;
use Axiom\Types\Rule;
use Illuminate\Support\Str;

// Disposable email rule
class DisposableEmail extends Rule
{

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/Domain.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Domain rule
class Domain extends Rule
{

Expand All @@ -16,7 +13,7 @@ class Domain extends Rule
**/
public function passes($attribute, $value) : bool
{
return preg_match("/^([\w-]+\.)*[\w\-]+\.\w{2,10}$/", $value) > 0;
return preg_match('/^([\w-]+\.)*[\w\-]+\.\w{2,10}$/', $value) > 0;
}


Expand Down
6 changes: 1 addition & 5 deletions src/Rules/EncodedImage.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Illuminate\Support\Str;
use Illuminate\Http\UploadedFile;

// Encoded image rule
class EncodedImage extends Rule
{

Expand Down Expand Up @@ -51,8 +48,7 @@ public function passes($attribute, $value) : bool
return false;
}

$result = validator(['file' => $this->createTemporaryFile($value)], ['file' => 'image'])
-> passes();
$result = validator(['file' => $this->createTemporaryFile($value)], ['file' => 'image'])->passes();

fclose($this->file);

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/EvenNumber.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Even number rule
class EvenNumber extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/FileExists.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Illuminate\Support\Facades\Storage;

// File exists rule
class FileExists extends Rule
{

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/ISBN.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// ISBN rule
class ISBN extends Rule
{

Expand All @@ -17,7 +14,7 @@ class ISBN extends Rule
public function passes($attribute, $value) : bool
{
return preg_match(
"/^(?:ISBN(-1(?:(0)|3))?:?\ )?(?(1)(?(2)(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$)[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]|(?=[0-9]{13}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)97[89][- ]?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9])|(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X])$/", $value
'/^(?:ISBN(-1(?:(0)|3))?:?\ )?(?(1)(?(2)(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$)[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]|(?=[0-9]{13}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)97[89][- ]?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9])|(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X])$/', $value
) > 0;
}

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/LanguageCode.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Axiom\Support\Iso6391Alpha2;
use Axiom\Support\Iso6391Alpha3;

// Language code rule
class LanguageCode extends Rule
{

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/LocationCoordinates.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Location coordinates rule
class LocationCoordinates extends Rule
{

Expand All @@ -21,7 +18,7 @@ class LocationCoordinates extends Rule
public function passes($attribute, $value) : bool
{
return preg_match(
"/^[-]?((([0-8]?[0-9])(\.(\d{1,8}))?)|(90(\.0+)?)),\s?[-]?((((1[0-7][0-9])|([0-9]?[0-9]))(\.(\d{1,8}))?)|180(\.0+)?)$/", $value
'/^[-]?((([0-8]?[0-9])(\.(\d{1,8}))?)|(90(\.0+)?)),\s?[-]?((((1[0-7][0-9])|([0-9]?[0-9]))(\.(\d{1,8}))?)|180(\.0+)?)$/', $value
) > 0;
}

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/Lowercase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Lowercase rule
class Lowercase extends Rule
{

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/MacAddress.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Mac address rule
class MacAddress extends Rule
{

Expand All @@ -16,7 +13,7 @@ class MacAddress extends Rule
**/
public function passes($attribute, $value) : bool
{
return preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", $value) > 0;
return preg_match('/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/', $value) > 0;
}


Expand Down
3 changes: 0 additions & 3 deletions src/Rules/Missing.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Illuminate\Support\Facades\DB;

// Missing rule
class Missing extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/MonetaryFigure.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Monetary figure rule
class MonetaryFigure extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/OddNumber.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Odd number rule
class OddNumber extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/RecordOwner.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;

// Record owner rule
class RecordOwner extends Rule
{

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/StrongPassword.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Strong password rule
class StrongPassword extends Rule
{

Expand All @@ -21,7 +18,7 @@ class StrongPassword extends Rule
public function passes($attribute, $value) : bool
{
return preg_match(
"/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@()$%^&*=_{}[\]:;\"'|\\<>,.\/~`±§+-]).{12,30}$/", $value
'/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@()$%^&*=_{}[\]:;"\'|\\<>,.\/~`±§+-]).{12,30}$/', $value
) > 0;
}

Expand Down
5 changes: 1 addition & 4 deletions src/Rules/TelephoneNumber.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Telephone number rule
class TelephoneNumber extends Rule
{

Expand All @@ -19,7 +16,7 @@ class TelephoneNumber extends Rule
**/
public function passes($attribute, $value) : bool
{
return preg_match("/^[0-9]{7,15}$/", $value) > 0;
return preg_match('/^[0-9]{7,15}$/', $value) > 0;
}


Expand Down
3 changes: 0 additions & 3 deletions src/Rules/Titlecase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Titlecase rule
class Titlecase extends Rule
{

Expand Down
3 changes: 0 additions & 3 deletions src/Rules/Uppercase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php declare(strict_types = 1);

// Namespace
namespace Axiom\Rules;

// Using directives
use Axiom\Types\Rule;

// Uppercase rule
class Uppercase extends Rule
{

Expand Down
Loading

0 comments on commit d38b487

Please sign in to comment.