diff --git a/app/Application.php b/app/Application.php
index 88c10c16..b92edc86 100644
--- a/app/Application.php
+++ b/app/Application.php
@@ -2,6 +2,7 @@
namespace App;
+use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
@@ -61,16 +62,14 @@ class Application extends Model
$name = $this->name;
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
- $class = '\App\SupportedApps\\'.$name.'\\'.$name;
-
- return $class;
+ return '\App\SupportedApps\\'.$name.'\\'.$name;
}
/**
* @param $name
* @return string
*/
- public static function classFromName($name)
+ public static function classFromName($name): string
{
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
@@ -110,6 +109,7 @@ class Application extends Model
/**
* @param $appid
* @return mixed|null
+ * @throws GuzzleException
*/
public static function getApp($appid)
{
@@ -121,13 +121,12 @@ class Application extends Model
$application = ($localapp) ? $localapp : new self;
// Files missing? || app not in db || old sha version
- if (
- ! file_exists(app_path('SupportedApps/'.className($app->name))) ||
+ if (! file_exists(app_path('SupportedApps/'.className($app->name))) ||
! $localapp ||
$localapp->sha !== $app->sha
) {
$gotFiles = SupportedApps::getFiles($app);
- if($gotFiles) {
+ if ($gotFiles) {
$app = SupportedApps::saveApp($app, $application);
}
}
@@ -147,7 +146,7 @@ class Application extends Model
if ($app === null) {
// Try in db for Private App
$appModel = self::where('appid', $appid)->first();
- if($appModel) {
+ if ($appModel) {
$app = json_decode($appModel->toJson());
}
}
@@ -176,7 +175,7 @@ class Application extends Model
// Check for private apps in the db
$appsListFromDB = self::all(['appid', 'name']);
- foreach($appsListFromDB as $app) {
+ foreach ($appsListFromDB as $app) {
// Already existing keys are overwritten,
// only private apps should be added at the end
$list[$app->appid] = $app->name;
diff --git a/app/Console/Commands/RegisterApp.php b/app/Console/Commands/RegisterApp.php
index e09ef16b..8da87600 100644
--- a/app/Console/Commands/RegisterApp.php
+++ b/app/Console/Commands/RegisterApp.php
@@ -54,7 +54,12 @@ class RegisterApp extends Command
}
}
- public function addApp($folder, $remove = false)
+ /**
+ * @param $folder
+ * @param bool $remove
+ * @return void
+ */
+ public function addApp($folder, bool $remove = false)
{
$json = app_path('SupportedApps/'.$folder.'/app.json');
@@ -88,7 +93,13 @@ class RegisterApp extends Command
$this->info('Application Added - ' . $app->name . ' - ' . $app->appid);
}
- private function saveIcon($appFolder, $icon) {
+ /**
+ * @param $appFolder
+ * @param $icon
+ * @return void
+ */
+ private function saveIcon($appFolder, $icon)
+ {
$iconPath = app_path('SupportedApps/' . $appFolder . '/' . $icon);
$contents = file_get_contents($iconPath);
Storage::disk('public')->put('icons/'.$icon, $contents);
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index a8c51585..e5ecfbb1 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -19,7 +19,7 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
- * @param \Illuminate\Console\Scheduling\Schedule $schedule
+ * @param Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
diff --git a/app/Helper.php b/app/Helper.php
index 73f4b0fe..66a7e26d 100644
--- a/app/Helper.php
+++ b/app/Helper.php
@@ -2,7 +2,14 @@
use Illuminate\Support\Str;
-function format_bytes($bytes, $is_drive_size = true, $beforeunit = '', $afterunit = '')
+/**
+ * @param $bytes
+ * @param bool $is_drive_size
+ * @param string $beforeunit
+ * @param string $afterunit
+ * @return string
+ */
+function format_bytes($bytes, bool $is_drive_size = true, string $beforeunit = '', string $afterunit = ''): string
{
$btype = ($is_drive_size === true) ? 1000 : 1024;
$labels = ['B', 'KB', 'MB', 'GB', 'TB'];
@@ -18,7 +25,13 @@ function format_bytes($bytes, $is_drive_size = true, $beforeunit = '', $afteruni
}
}
-function str_slug($title, $separator = '-', $language = 'en')
+/**
+ * @param $title
+ * @param string $separator
+ * @param string $language
+ * @return string
+ */
+function str_slug($title, string $separator = '-', string $language = 'en'): string
{
return Str::slug($title, $separator, $language);
}
@@ -28,17 +41,21 @@ if (! function_exists('str_is')) {
* Determine if a given string matches a given pattern.
*
* @param string|array $pattern
- * @param string $value
+ * @param string $value
* @return bool
*
* @deprecated Str::is() should be used directly instead. Will be removed in Laravel 6.0.
*/
- function str_is($pattern, $value)
+ function str_is($pattern, string $value): bool
{
return Str::is($pattern, $value);
}
}
+/**
+ * @param $hex
+ * @return float|int
+ */
function get_brightness($hex)
{
// returns brightness value from 0 to 255
@@ -56,7 +73,11 @@ function get_brightness($hex)
return (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
}
-function title_color($hex)
+/**
+ * @param $hex
+ * @return string
+ */
+function title_color($hex): string
{
if (get_brightness($hex) > 130) {
return ' black';
@@ -65,7 +86,10 @@ function title_color($hex)
}
}
-function getLinkTargetAttribute()
+/**
+ * @return string
+ */
+function getLinkTargetAttribute(): string
{
$target = \App\Setting::fetch('window_target');
@@ -76,9 +100,11 @@ function getLinkTargetAttribute()
}
}
+/**
+ * @param $name
+ * @return array|string|string[]|null
+ */
function className($name)
{
- $name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
-
- return $name;
+ return preg_replace('/[^\p{L}\p{N}]/u', '', $name);
}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index af79a2ae..81248302 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -4,11 +4,17 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\View\Factory;
+use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;
+use Illuminate\Validation\ValidationException;
+use Symfony\Component\HttpFoundation\Response;
class LoginController extends Controller
{
@@ -30,7 +36,7 @@ class LoginController extends Controller
*
* @var string
*/
- protected $redirectTo = '/';
+ protected string $redirectTo = '/';
/**
* Create a new controller instance.
@@ -43,7 +49,10 @@ class LoginController extends Controller
$this->middleware('guest')->except('logout');
}
- public function username()
+ /**
+ * @return string
+ */
+ public function username(): string
{
return 'username';
}
@@ -51,12 +60,12 @@ class LoginController extends Controller
/**
* Handle a login request to the application.
*
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
+ * @param Request $request
+ * @return Response
*
- * @throws \Illuminate\Validation\ValidationException
+ * @throws ValidationException
*/
- public function login(Request $request)
+ public function login(Request $request): Response
{
$current_user = User::currentUser();
$request->merge(['username' => $current_user->username, 'remember' => true]);
@@ -88,7 +97,11 @@ class LoginController extends Controller
{
}
- public function setUser(User $user)
+ /**
+ * @param User $user
+ * @return RedirectResponse
+ */
+ public function setUser(User $user): RedirectResponse
{
Auth::logout();
session(['current_user' => $user]);
@@ -96,7 +109,11 @@ class LoginController extends Controller
return redirect()->route('dash');
}
- public function autologin($uuid)
+ /**
+ * @param $uuid
+ * @return RedirectResponse
+ */
+ public function autologin($uuid): RedirectResponse
{
$user = User::where('autologin', $uuid)->first();
Auth::login($user, true);
@@ -108,18 +125,26 @@ class LoginController extends Controller
/**
* Show the application's login form.
*
- * @return \Illuminate\Http\Response
+ * @return Application|Factory|View
*/
public function showLoginForm()
{
return view('auth.login');
}
- protected function authenticated(Request $request, $user)
+ /**
+ * @param Request $request
+ * @param $user
+ * @return RedirectResponse
+ */
+ protected function authenticated(Request $request, $user): RedirectResponse
{
return back();
}
+ /**
+ * @return mixed|string
+ */
public function redirectTo()
{
return Session::get('url.intended') ? Session::get('url.intended') : $this->redirectTo;
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index b9ac71f7..8d8d3053 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -27,7 +27,7 @@ class RegisterController extends Controller
*
* @var string
*/
- protected $redirectTo = '/';
+ protected string $redirectTo = '/';
/**
* Create a new controller instance.
@@ -45,7 +45,7 @@ class RegisterController extends Controller
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
- protected function validator(array $data)
+ protected function validator(array $data): \Illuminate\Contracts\Validation\Validator
{
return Validator::make($data, [
'name' => 'required|string|max:255',
@@ -58,7 +58,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration.
*
* @param array $data
- * @return \App\User
+ * @return User
*/
protected function create(array $data)
{
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index 2c863aa6..71d45949 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -25,7 +25,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
- protected $redirectTo = '/';
+ protected string $redirectTo = '/';
/**
* Create a new controller instance.
diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php
index d2667d11..c0d555b1 100644
--- a/app/Http/Controllers/ItemController.php
+++ b/app/Http/Controllers/ItemController.php
@@ -9,6 +9,7 @@ use App\User;
use Artisan;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ServerException;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
@@ -204,7 +205,7 @@ class ItemController extends Controller
"verify_peer"=>false,
"verify_peer_name"=>false,
),
- );
+ );
$contents = file_get_contents($request->input('icon'), false, stream_context_create($options));
if ($application) {
@@ -219,9 +220,9 @@ class ItemController extends Controller
// Private apps could have here duplicated icons folder
if (strpos($path, 'icons/icons/') !== false) {
- $path = str_replace('icons/icons/','icons/',$path);
+ $path = str_replace('icons/icons/', 'icons/', $path);
}
- if(! Storage::disk('public')->exists($path)) {
+ if (! Storage::disk('public')->exists($path)) {
Storage::disk('public')->put($path, $contents);
}
$request->merge([
@@ -360,6 +361,7 @@ class ItemController extends Controller
*
* @param Request $request
* @return string|null
+ * @throws GuzzleException
*/
public function appload(Request $request): ?string
{
@@ -386,9 +388,9 @@ class ItemController extends Controller
$output['colour'] = ($app->tile_background == 'light') ? '#fafbfc' : '#161b1f';
- if(strpos($app->icon, '://') !== false) {
+ if (strpos($app->icon, '://') !== false) {
$output['iconview'] = $app->icon;
- } elseif(strpos($app->icon, 'icons/') !== false) {
+ } elseif (strpos($app->icon, 'icons/') !== false) {
// Private apps have the icon locally
$output['iconview'] = URL::to('/').'/storage/'.$app->icon;
$output['icon'] = str_replace('icons/', '', $output['icon']);
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index faf750c3..e5bd0649 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -5,6 +5,8 @@ namespace App\Http\Controllers;
use App\Item;
use App\User;
use DB;
+use Illuminate\Contracts\Foundation\Application;
+use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -20,7 +22,7 @@ class TagController extends Controller
/**
* Display a listing of the resource.
*
- * @return Response
+ * @return Application|Factory|View
*/
public function index(Request $request)
{
@@ -38,7 +40,7 @@ class TagController extends Controller
/**
* Show the form for creating a new resource.
*
- * @return Response
+ * @return Application|Factory|View
*/
public function create()
{
@@ -155,6 +157,7 @@ class TagController extends Controller
/**
* Remove the specified resource from storage.
*
+ * @param Request $request
* @param int $id
* @return RedirectResponse
*/
diff --git a/app/Http/Middleware/CheckAllowed.php b/app/Http/Middleware/CheckAllowed.php
index 51e7c09b..5b3d2bc5 100644
--- a/app/Http/Middleware/CheckAllowed.php
+++ b/app/Http/Middleware/CheckAllowed.php
@@ -4,6 +4,7 @@ namespace App\Http\Middleware;
use App\User;
use Closure;
+use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Session;
@@ -13,11 +14,11 @@ class CheckAllowed
/**
* Handle an incoming request.
*
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
+ * @param Request $request
+ * @param Closure $next
* @return mixed
*/
- public function handle($request, Closure $next)
+ public function handle(Request $request, Closure $next)
{
$route = Route::currentRouteName();
$current_user = User::currentUser();
diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php
index 0d289bde..1f9e98f5 100644
--- a/app/Http/Middleware/RedirectIfAuthenticated.php
+++ b/app/Http/Middleware/RedirectIfAuthenticated.php
@@ -3,6 +3,7 @@
namespace App\Http\Middleware;
use Closure;
+use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
@@ -10,8 +11,8 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
+ * @param Request $request
+ * @param Closure $next
* @param string|null $guard
* @return mixed
*/
diff --git a/app/Item.php b/app/Item.php
index ce7e3821..39a83e84 100644
--- a/app/Item.php
+++ b/app/Item.php
@@ -2,15 +2,22 @@
namespace App;
+use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
+use stdClass;
use Symfony\Component\ClassLoader\ClassMapGenerator;
class Item extends Model
{
use SoftDeletes;
+ /**
+ * @return void
+ */
protected static function boot()
{
parent::boot();
@@ -25,9 +32,20 @@ class Item extends Model
});
}
- //
protected $fillable = [
- 'title', 'url', 'colour', 'icon', 'appdescription', 'description', 'pinned', 'order', 'type', 'class', 'user_id', 'tag_id', 'appid',
+ 'title',
+ 'url',
+ 'colour',
+ 'icon',
+ 'appdescription',
+ 'description',
+ 'pinned',
+ 'order',
+ 'type',
+ 'class',
+ 'user_id',
+ 'tag_id',
+ 'appid',
];
@@ -35,10 +53,10 @@ class Item extends Model
/**
* Scope a query to only include pinned items.
*
- * @param \Illuminate\Database\Eloquent\Builder $query
- * @return \Illuminate\Database\Eloquent\Builder
+ * @param Builder $query
+ * @return Builder
*/
- public function scopePinned($query)
+ public function scopePinned(Builder $query): Builder
{
return $query->where('pinned', 1);
}
@@ -74,16 +92,25 @@ class Item extends Model
return $tagdetails;
}
- public function parents()
+ /**
+ * @return BelongsToMany
+ */
+ public function parents(): BelongsToMany
{
- return $this->belongsToMany(\App\Item::class, 'item_tag', 'item_id', 'tag_id');
+ return $this->belongsToMany(Item::class, 'item_tag', 'item_id', 'tag_id');
}
- public function children()
+ /**
+ * @return BelongsToMany
+ */
+ public function children(): BelongsToMany
{
- return $this->belongsToMany(\App\Item::class, 'item_tag', 'tag_id', 'item_id');
+ return $this->belongsToMany(Item::class, 'item_tag', 'tag_id', 'item_id');
}
+ /**
+ * @return \Illuminate\Contracts\Foundation\Application|UrlGenerator|mixed|string
+ */
public function getLinkAttribute()
{
if ((int) $this->type === 1) {
@@ -93,7 +120,10 @@ class Item extends Model
}
}
- public function getDroppableAttribute()
+ /**
+ * @return string
+ */
+ public function getDroppableAttribute(): string
{
if ((int) $this->type === 1) {
return ' droppable';
@@ -102,7 +132,10 @@ class Item extends Model
}
}
- public function getLinkTargetAttribute()
+ /**
+ * @return string
+ */
+ public function getLinkTargetAttribute(): string
{
$target = Setting::fetch('window_target');
@@ -113,7 +146,10 @@ class Item extends Model
}
}
- public function getLinkIconAttribute()
+ /**
+ * @return string
+ */
+ public function getLinkIconAttribute(): string
{
if ((int) $this->type === 1) {
return 'fa-tag';
@@ -122,7 +158,10 @@ class Item extends Model
}
}
- public function getLinkTypeAttribute()
+ /**
+ * @return string
+ */
+ public function getLinkTypeAttribute(): string
{
if ((int) $this->type === 1) {
return 'tags';
@@ -131,6 +170,10 @@ class Item extends Model
}
}
+ /**
+ * @param $class
+ * @return false|mixed|string
+ */
public static function nameFromClass($class)
{
$explode = explode('\\', $class);
@@ -139,6 +182,11 @@ class Item extends Model
return $name;
}
+ /**
+ * @param $query
+ * @param $type
+ * @return mixed
+ */
public function scopeOfType($query, $type)
{
switch ($type) {
@@ -153,7 +201,10 @@ class Item extends Model
return $query->where('type', $typeid);
}
- public function enhanced()
+ /**
+ * @return bool
+ */
+ public function enhanced(): bool
{
/*if(isset($this->class) && !empty($this->class)) {
$app = new $this->class;
@@ -164,16 +215,24 @@ class Item extends Model
return $this->description !== null;
}
- public static function isEnhanced($class)
+ /**
+ * @param $class
+ * @return bool
+ */
+ public static function isEnhanced($class): bool
{
if (!class_exists($class, false) || $class === null || $class === 'null') {
return false;
}
$app = new $class;
- return (bool) ($app instanceof \App\EnhancedApps);
+ return (bool) ($app instanceof EnhancedApps);
}
+ /**
+ * @param $class
+ * @return false|mixed
+ */
public static function isSearchProvider($class)
{
if (!class_exists($class, false) || $class === null || $class === 'null') {
@@ -181,10 +240,13 @@ class Item extends Model
}
$app = new $class;
- return ((bool) ($app instanceof \App\SearchInterface)) ? $app : false;
+ return ((bool) ($app instanceof SearchInterface)) ? $app : false;
}
- public function enabled()
+ /**
+ * @return bool
+ */
+ public function enabled(): bool
{
if ($this->enhanced()) {
$config = $this->getconfig();
@@ -196,12 +258,15 @@ class Item extends Model
return false;
}
+ /**
+ * @return mixed|stdClass
+ */
public function getconfig()
{
// $explode = explode('\\', $this->class);
if (! isset($this->description) || empty($this->description)) {
- $config = new \stdClass;
+ $config = new stdClass;
// $config->name = end($explode);
$config->enabled = false;
$config->override_url = null;
@@ -224,7 +289,11 @@ class Item extends Model
return $config;
}
- public static function applicationDetails($class)
+ /**
+ * @param $class
+ * @return false
+ */
+ public static function applicationDetails($class): bool
{
if (! empty($class)) {
$name = self::nameFromClass($class);
@@ -237,7 +306,11 @@ class Item extends Model
return false;
}
- public static function getApplicationDescription($class)
+ /**
+ * @param $class
+ * @return string
+ */
+ public static function getApplicationDescription($class): string
{
$details = self::applicationDetails($class);
if ($details !== false) {
@@ -249,9 +322,11 @@ class Item extends Model
/**
* Get the user that owns the item.
+ *
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
- return $this->belongsTo(\App\User::class);
+ return $this->belongsTo(User::class);
}
}
diff --git a/app/Jobs/ProcessApps.php b/app/Jobs/ProcessApps.php
index 6dadc32f..73db5dc8 100644
--- a/app/Jobs/ProcessApps.php
+++ b/app/Jobs/ProcessApps.php
@@ -5,6 +5,7 @@ namespace App\Jobs;
use App\Application;
use App\Item;
use App\SupportedApps;
+use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
@@ -32,6 +33,7 @@ class ProcessApps implements ShouldQueue, ShouldBeUnique
* Execute the job.
*
* @return void
+ * @throws GuzzleException
*/
public function handle()
{
diff --git a/app/Jobs/UpdateApps.php b/app/Jobs/UpdateApps.php
index 2b1f711b..dccc2188 100644
--- a/app/Jobs/UpdateApps.php
+++ b/app/Jobs/UpdateApps.php
@@ -3,6 +3,7 @@
namespace App\Jobs;
use App\Application;
+use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
@@ -30,6 +31,7 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique
* Execute the job.
*
* @return void
+ * @throws GuzzleException
*/
public function handle()
{
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 611faadb..8b791ae5 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
class AppServiceProvider extends ServiceProvider
{
@@ -123,6 +125,8 @@ class AppServiceProvider extends ServiceProvider
* Check if database needs an update or do first time database setup
*
* @return void
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function setupDatabase(): void
{
diff --git a/app/Search.php b/app/Search.php
index 83464abc..813f7795 100644
--- a/app/Search.php
+++ b/app/Search.php
@@ -4,6 +4,7 @@ namespace App;
use Cache;
use Form;
+use Illuminate\Support\Collection;
use Yaml;
abstract class Search
@@ -11,7 +12,7 @@ abstract class Search
/**
* List of all search providers
*
- * @return \Illuminate\Support\Collection
+ * @return Collection
*/
public static function providers()
{
@@ -121,7 +122,15 @@ abstract class Search
$output .= '';
}
$output .= '';
- $output .= Form::text('q', null, ['class' => 'homesearch', 'autofocus' => 'autofocus', 'placeholder' => __('app.settings.search').'...']);
+ $output .= Form::text(
+ 'q',
+ null,
+ [
+ 'class' => 'homesearch',
+ 'autofocus' => 'autofocus',
+ 'placeholder' => __('app.settings.search').'...'
+ ]
+ );
$output .= '';
$output .= '';
$output .= '';
diff --git a/app/Setting.php b/app/Setting.php
index 10125a9f..3b1130f4 100644
--- a/app/Setting.php
+++ b/app/Setting.php
@@ -4,7 +4,11 @@ namespace App;
use Form;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Http\Request;
+use Illuminate\Session\SessionManager;
+use Illuminate\Session\Store;
use Illuminate\Support\Facades\Input;
class Setting extends Model
@@ -57,7 +61,11 @@ class Setting extends Model
switch ($this->type) {
case 'image':
if (! empty($this->value)) {
- $value = ''.__('app.settings.view').'';
+ $value = ''.
+ __('app.settings.view').
+ '';
} else {
$value = __('app.options.none');
}
@@ -75,7 +83,9 @@ class Setting extends Model
if ($this->key === 'search_provider') {
$options = Search::providers()->pluck('name', 'id')->toArray();
}
- $value = (array_key_exists($this->value, $options)) ? __($options[$this->value]) : __('app.options.none');
+ $value = (array_key_exists($this->value, $options))
+ ? __($options[$this->value])
+ : __('app.options.none');
} else {
$value = __('app.options.none');
}
@@ -100,11 +110,24 @@ class Setting extends Model
case 'image':
$value = '';
if (isset($this->value) && ! empty($this->value)) {
- $value .= '';
+ $value .= '';
}
$value .= Form::file('value', ['class' => 'form-control']);
if (isset($this->value) && ! empty($this->value)) {
- $value .= ''.__('app.settings.reset').'';
+ $value .= ''.
+ __('app.settings.reset').
+ '';
}
break;
@@ -143,7 +166,10 @@ class Setting extends Model
return $value;
}
- public function group()
+ /**
+ * @return BelongsTo
+ */
+ public function group(): BelongsTo
{
return $this->belongsTo(\App\SettingGroup::class, 'group_id');
}
@@ -153,7 +179,7 @@ class Setting extends Model
*
* @return mixed
*/
- public static function fetch($key)
+ public static function fetch(string $key)
{
$user = self::user();
@@ -220,7 +246,7 @@ class Setting extends Model
*
* @return bool
*/
- public static function cached($key)
+ public static function cached($key): bool
{
return array_key_exists($key, self::$cache);
}
@@ -228,11 +254,14 @@ class Setting extends Model
/**
* The users that belong to the setting.
*/
- public function users()
+ public function users(): BelongsToMany
{
return $this->belongsToMany(\App\User::class)->using(\App\SettingUser::class)->withPivot('uservalue');
}
+ /**
+ * @return \Illuminate\Contracts\Foundation\Application|SessionManager|Store|mixed
+ */
public static function user()
{
return User::currentUser();
diff --git a/app/SettingGroup.php b/app/SettingGroup.php
index 45d05d48..aaa64442 100644
--- a/app/SettingGroup.php
+++ b/app/SettingGroup.php
@@ -3,6 +3,7 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasMany;
class SettingGroup extends Model
{
@@ -20,7 +21,10 @@ class SettingGroup extends Model
*/
public $timestamps = false;
- public function settings()
+ /**
+ * @return HasMany
+ */
+ public function settings(): HasMany
{
return $this->hasMany(\App\Setting::class, 'group_id');
}
diff --git a/app/SupportedApps.php b/app/SupportedApps.php
index fdc06eb3..cf200c06 100644
--- a/app/SupportedApps.php
+++ b/app/SupportedApps.php
@@ -3,7 +3,9 @@
namespace App;
use GuzzleHttp\Client;
+use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
+use Psr\Http\Message\ResponseInterface;
abstract class SupportedApps
{
@@ -13,7 +15,13 @@ abstract class SupportedApps
protected $error;
- public function appTest($url, $attrs = [], $overridevars = false)
+ /**
+ * @param $url
+ * @param array $attrs
+ * @param bool $overridevars
+ * @return object
+ */
+ public function appTest($url, array $attrs = [], bool $overridevars = false): object
{
if (empty($this->config->url)) {
return (object) [
@@ -52,8 +60,20 @@ abstract class SupportedApps
];
}
- public function execute($url, $attrs = [], $overridevars = false, $overridemethod = false)
- {
+ /**
+ * @param $url
+ * @param array $attrs
+ * @param bool $overridevars
+ * @param bool $overridemethod
+ * @return ResponseInterface|null
+ * @throws GuzzleException
+ */
+ public function execute(
+ $url,
+ array $attrs = [],
+ bool $overridevars = false,
+ bool $overridemethod = false
+ ): ?ResponseInterface {
$res = null;
$vars = ($overridevars !== false) ?
@@ -82,11 +102,19 @@ abstract class SupportedApps
return $res;
}
+ /**
+ * @return void
+ */
public function login()
{
}
- public function normaliseurl($url, $addslash = true)
+ /**
+ * @param string $url
+ * @param bool $addslash
+ * @return string
+ */
+ public function normaliseurl(string $url, bool $addslash = true): string
{
$url = rtrim($url, '/');
if ($addslash) {
@@ -96,6 +124,11 @@ abstract class SupportedApps
return $url;
}
+ /**
+ * @param $status
+ * @param $data
+ * @return false|string
+ */
public function getLiveStats($status, $data)
{
$className = get_class($this);
@@ -108,7 +141,11 @@ abstract class SupportedApps
//return
}
- public static function getList()
+ /**
+ * @return ResponseInterface
+ * @throws GuzzleException
+ */
+ public static function getList(): ResponseInterface
{
// $list_url = 'https://apps.heimdall.site/list';
$list_url = config('app.appsource').'list.json';
@@ -129,7 +166,7 @@ abstract class SupportedApps
/**
* @param $app
* @return bool|false
- * @throws \GuzzleHttp\Exception\GuzzleException
+ * @throws GuzzleException
*/
public static function getFiles($app): bool
{
@@ -165,6 +202,11 @@ abstract class SupportedApps
return true;
}
+ /**
+ * @param $details
+ * @param $app
+ * @return mixed
+ */
public static function saveApp($details, $app)
{
$app->appid = $details->appid;
diff --git a/composer.json b/composer.json
index d2a62c07..d037b877 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,8 @@
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~9.0",
- "symfony/thanks": "^1.0"
+ "symfony/thanks": "^1.0",
+ "squizlabs/php_codesniffer": "3.*"
},
"autoload": {
"classmap": [
diff --git a/composer.lock b/composer.lock
index 5360fe4a..475f19f6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "5ec4ff397b3937979b48679da0338808",
+ "content-hash": "c1478972b2e1dbdb27f39255a644f4be",
"packages": [
{
"name": "brick/math",
@@ -1770,16 +1770,16 @@
},
{
"name": "laravel/tinker",
- "version": "v2.7.2",
+ "version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
- "reference": "dff39b661e827dae6e092412f976658df82dbac5"
+ "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5",
- "reference": "dff39b661e827dae6e092412f976658df82dbac5",
+ "url": "https://api.github.com/repos/laravel/tinker/zipball/5062061b4924af3392225dd482ca7b4d85d8b8ef",
+ "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef",
"shasum": ""
},
"require": {
@@ -1832,9 +1832,9 @@
],
"support": {
"issues": "https://github.com/laravel/tinker/issues",
- "source": "https://github.com/laravel/tinker/tree/v2.7.2"
+ "source": "https://github.com/laravel/tinker/tree/v2.7.3"
},
- "time": "2022-03-23T12:38:24+00:00"
+ "time": "2022-11-09T15:11:38+00:00"
},
{
"name": "laravel/ui",
@@ -2513,25 +2513,25 @@
},
{
"name": "nette/schema",
- "version": "v1.2.2",
+ "version": "v1.2.3",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
- "reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df"
+ "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/schema/zipball/9a39cef03a5b34c7de64f551538cbba05c2be5df",
- "reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df",
+ "url": "https://api.github.com/repos/nette/schema/zipball/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
+ "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"shasum": ""
},
"require": {
"nette/utils": "^2.5.7 || ^3.1.5 || ^4.0",
- "php": ">=7.1 <8.2"
+ "php": ">=7.1 <8.3"
},
"require-dev": {
"nette/tester": "^2.3 || ^2.4",
- "phpstan/phpstan-nette": "^0.12",
+ "phpstan/phpstan-nette": "^1.0",
"tracy/tracy": "^2.7"
},
"type": "library",
@@ -2569,9 +2569,9 @@
],
"support": {
"issues": "https://github.com/nette/schema/issues",
- "source": "https://github.com/nette/schema/tree/v1.2.2"
+ "source": "https://github.com/nette/schema/tree/v1.2.3"
},
- "time": "2021-10-15T11:40:02+00:00"
+ "time": "2022-10-13T01:24:26+00:00"
},
{
"name": "nette/utils",
@@ -7520,16 +7520,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.18",
+ "version": "9.2.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a"
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559",
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559",
"shasum": ""
},
"require": {
@@ -7585,7 +7585,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19"
},
"funding": [
{
@@ -7593,7 +7593,7 @@
"type": "github"
}
],
- "time": "2022-10-27T13:35:33+00:00"
+ "time": "2022-11-18T07:47:47+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -8902,6 +8902,62 @@
],
"time": "2020-09-28T06:39:44+00:00"
},
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
+ "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "bin": [
+ "bin/phpcs",
+ "bin/phpcbf"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
+ },
+ "time": "2022-06-18T07:21:10+00:00"
+ },
{
"name": "symfony/thanks",
"version": "v1.2.10",
diff --git a/vendor/bin/phpcbf b/vendor/bin/phpcbf
new file mode 100755
index 00000000..0b622008
--- /dev/null
+++ b/vendor/bin/phpcbf
@@ -0,0 +1,120 @@
+#!/usr/bin/env php
+realpath = realpath($opened_path) ?: $opened_path;
+ $opened_path = $this->realpath;
+ $this->handle = fopen($this->realpath, $mode);
+ $this->position = 0;
+
+ return (bool) $this->handle;
+ }
+
+ public function stream_read($count)
+ {
+ $data = fread($this->handle, $count);
+
+ if ($this->position === 0) {
+ $data = preg_replace('{^#!.*\r?\n}', '', $data);
+ }
+
+ $this->position += strlen($data);
+
+ return $data;
+ }
+
+ public function stream_cast($castAs)
+ {
+ return $this->handle;
+ }
+
+ public function stream_close()
+ {
+ fclose($this->handle);
+ }
+
+ public function stream_lock($operation)
+ {
+ return $operation ? flock($this->handle, $operation) : true;
+ }
+
+ public function stream_seek($offset, $whence)
+ {
+ if (0 === fseek($this->handle, $offset, $whence)) {
+ $this->position = ftell($this->handle);
+ return true;
+ }
+
+ return false;
+ }
+
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ public function stream_eof()
+ {
+ return feof($this->handle);
+ }
+
+ public function stream_stat()
+ {
+ return array();
+ }
+
+ public function stream_set_option($option, $arg1, $arg2)
+ {
+ return true;
+ }
+
+ public function url_stat($path, $flags)
+ {
+ $path = substr($path, 17);
+ if (file_exists($path)) {
+ return stat($path);
+ }
+
+ return false;
+ }
+ }
+ }
+
+ if (
+ (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
+ || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
+ ) {
+ include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf');
+ exit(0);
+ }
+}
+
+include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf';
diff --git a/vendor/bin/phpcs b/vendor/bin/phpcs
new file mode 100755
index 00000000..9eb8455a
--- /dev/null
+++ b/vendor/bin/phpcs
@@ -0,0 +1,120 @@
+#!/usr/bin/env php
+realpath = realpath($opened_path) ?: $opened_path;
+ $opened_path = $this->realpath;
+ $this->handle = fopen($this->realpath, $mode);
+ $this->position = 0;
+
+ return (bool) $this->handle;
+ }
+
+ public function stream_read($count)
+ {
+ $data = fread($this->handle, $count);
+
+ if ($this->position === 0) {
+ $data = preg_replace('{^#!.*\r?\n}', '', $data);
+ }
+
+ $this->position += strlen($data);
+
+ return $data;
+ }
+
+ public function stream_cast($castAs)
+ {
+ return $this->handle;
+ }
+
+ public function stream_close()
+ {
+ fclose($this->handle);
+ }
+
+ public function stream_lock($operation)
+ {
+ return $operation ? flock($this->handle, $operation) : true;
+ }
+
+ public function stream_seek($offset, $whence)
+ {
+ if (0 === fseek($this->handle, $offset, $whence)) {
+ $this->position = ftell($this->handle);
+ return true;
+ }
+
+ return false;
+ }
+
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ public function stream_eof()
+ {
+ return feof($this->handle);
+ }
+
+ public function stream_stat()
+ {
+ return array();
+ }
+
+ public function stream_set_option($option, $arg1, $arg2)
+ {
+ return true;
+ }
+
+ public function url_stat($path, $flags)
+ {
+ $path = substr($path, 17);
+ if (file_exists($path)) {
+ return stat($path);
+ }
+
+ return false;
+ }
+ }
+ }
+
+ if (
+ (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
+ || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
+ ) {
+ include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs');
+ exit(0);
+ }
+}
+
+include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs';
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 514b0193..7d5047c6 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -32,6 +32,7 @@ return array(
'App\\Item' => $baseDir . '/app/Item.php',
'App\\ItemTag' => $baseDir . '/app/ItemTag.php',
'App\\Jobs\\ProcessApps' => $baseDir . '/app/Jobs/ProcessApps.php',
+ 'App\\Jobs\\UpdateApps' => $baseDir . '/app/Jobs/UpdateApps.php',
'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
'App\\Providers\\AuthServiceProvider' => $baseDir . '/app/Providers/AuthServiceProvider.php',
'App\\Providers\\BroadcastServiceProvider' => $baseDir . '/app/Providers/BroadcastServiceProvider.php',
@@ -43,6 +44,33 @@ return array(
'App\\SettingGroup' => $baseDir . '/app/SettingGroup.php',
'App\\SettingUser' => $baseDir . '/app/SettingUser.php',
'App\\SupportedApps' => $baseDir . '/app/SupportedApps.php',
+ 'App\\SupportedApps\\AMP\\AMP' => $baseDir . '/app/SupportedApps/AMP/AMP.php',
+ 'App\\SupportedApps\\AdGuardHome\\AdGuardHome' => $baseDir . '/app/SupportedApps/AdGuardHome/AdGuardHome.php',
+ 'App\\SupportedApps\\Adminer\\Adminer' => $baseDir . '/app/SupportedApps/Adminer/Adminer.php',
+ 'App\\SupportedApps\\Alertmanager\\Alertmanager' => $baseDir . '/app/SupportedApps/Alertmanager/Alertmanager.php',
+ 'App\\SupportedApps\\ArchiSteamFarm\\ArchiSteamFarm' => $baseDir . '/app/SupportedApps/ArchiSteamFarm/ArchiSteamFarm.php',
+ 'App\\SupportedApps\\ArgoCD\\ArgoCD' => $baseDir . '/app/SupportedApps/ArgoCD/ArgoCD.php',
+ 'App\\SupportedApps\\AriaNg\\AriaNg' => $baseDir . '/app/SupportedApps/AriaNg/AriaNg.php',
+ 'App\\SupportedApps\\Atlantis\\Atlantis' => $baseDir . '/app/SupportedApps/Atlantis/Atlantis.php',
+ 'App\\SupportedApps\\Bastillion\\Bastillion' => $baseDir . '/app/SupportedApps/Bastillion/Bastillion.php',
+ 'App\\SupportedApps\\Jira\\Jira' => $baseDir . '/app/SupportedApps/Jira/Jira.php',
+ 'App\\SupportedApps\\Kibana\\Kibana' => $baseDir . '/app/SupportedApps/Kibana/Kibana.php',
+ 'App\\SupportedApps\\MotionEye\\MotionEye' => $baseDir . '/app/SupportedApps/MotionEye/MotionEye.php',
+ 'App\\SupportedApps\\Munin\\Munin' => $baseDir . '/app/SupportedApps/Munin/Munin.php',
+ 'App\\SupportedApps\\MusicBrainz\\MusicBrainz' => $baseDir . '/app/SupportedApps/MusicBrainz/MusicBrainz.php',
+ 'App\\SupportedApps\\Pihole\\Pihole' => $baseDir . '/app/SupportedApps/Pihole/Pihole.php',
+ 'App\\SupportedApps\\Plex\\Plex' => $baseDir . '/app/SupportedApps/Plex/Plex.php',
+ 'App\\SupportedApps\\Portainer\\Portainer' => $baseDir . '/app/SupportedApps/Portainer/Portainer.php',
+ 'App\\SupportedApps\\Poste\\Poste' => $baseDir . '/app/SupportedApps/Poste/Poste.php',
+ 'App\\SupportedApps\\Printer\\Printer' => $baseDir . '/app/SupportedApps/Printer/Printer.php',
+ 'App\\SupportedApps\\Rancher\\Rancher' => $baseDir . '/app/SupportedApps/Rancher/Rancher.php',
+ 'App\\SupportedApps\\TYPO3\\TYPO3' => $baseDir . '/app/SupportedApps/TYPO3/TYPO3.php',
+ 'App\\SupportedApps\\Tar1090\\Tar1090' => $baseDir . '/app/SupportedApps/Tar1090/Tar1090.php',
+ 'App\\SupportedApps\\Transmission\\Transmission' => $baseDir . '/app/SupportedApps/Transmission/Transmission.php',
+ 'App\\SupportedApps\\Trilium\\Trilium' => $baseDir . '/app/SupportedApps/Trilium/Trilium.php',
+ 'App\\SupportedApps\\TrueNAS\\TrueNAS' => $baseDir . '/app/SupportedApps/TrueNAS/TrueNAS.php',
+ 'App\\SupportedApps\\Ubooquity\\Ubooquity' => $baseDir . '/app/SupportedApps/Ubooquity/Ubooquity.php',
+ 'App\\SupportedApps\\UniFi\\UniFi' => $baseDir . '/app/SupportedApps/UniFi/UniFi.php',
'App\\User' => $baseDir . '/app/User.php',
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Brick\\Math\\BigDecimal' => $vendorDir . '/brick/math/src/BigDecimal.php',
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 33a291cb..65c54196 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -630,6 +630,7 @@ class ComposerStaticInitb2555e5ff7197b9e020da74bbd3b7cfa
'App\\Item' => __DIR__ . '/../..' . '/app/Item.php',
'App\\ItemTag' => __DIR__ . '/../..' . '/app/ItemTag.php',
'App\\Jobs\\ProcessApps' => __DIR__ . '/../..' . '/app/Jobs/ProcessApps.php',
+ 'App\\Jobs\\UpdateApps' => __DIR__ . '/../..' . '/app/Jobs/UpdateApps.php',
'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
'App\\Providers\\AuthServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AuthServiceProvider.php',
'App\\Providers\\BroadcastServiceProvider' => __DIR__ . '/../..' . '/app/Providers/BroadcastServiceProvider.php',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 838fe25a..863b461f 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -2015,17 +2015,17 @@
},
{
"name": "laravel/tinker",
- "version": "v2.7.2",
- "version_normalized": "2.7.2.0",
+ "version": "v2.7.3",
+ "version_normalized": "2.7.3.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
- "reference": "dff39b661e827dae6e092412f976658df82dbac5"
+ "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5",
- "reference": "dff39b661e827dae6e092412f976658df82dbac5",
+ "url": "https://api.github.com/repos/laravel/tinker/zipball/5062061b4924af3392225dd482ca7b4d85d8b8ef",
+ "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef",
"shasum": ""
},
"require": {
@@ -2043,7 +2043,7 @@
"suggest": {
"illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0)."
},
- "time": "2022-03-23T12:38:24+00:00",
+ "time": "2022-11-09T15:11:38+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -2080,7 +2080,7 @@
],
"support": {
"issues": "https://github.com/laravel/tinker/issues",
- "source": "https://github.com/laravel/tinker/tree/v2.7.2"
+ "source": "https://github.com/laravel/tinker/tree/v2.7.3"
},
"install-path": "../laravel/tinker"
},
@@ -2922,29 +2922,29 @@
},
{
"name": "nette/schema",
- "version": "v1.2.2",
- "version_normalized": "1.2.2.0",
+ "version": "v1.2.3",
+ "version_normalized": "1.2.3.0",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
- "reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df"
+ "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/schema/zipball/9a39cef03a5b34c7de64f551538cbba05c2be5df",
- "reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df",
+ "url": "https://api.github.com/repos/nette/schema/zipball/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
+ "reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"shasum": ""
},
"require": {
"nette/utils": "^2.5.7 || ^3.1.5 || ^4.0",
- "php": ">=7.1 <8.2"
+ "php": ">=7.1 <8.3"
},
"require-dev": {
"nette/tester": "^2.3 || ^2.4",
- "phpstan/phpstan-nette": "^0.12",
+ "phpstan/phpstan-nette": "^1.0",
"tracy/tracy": "^2.7"
},
- "time": "2021-10-15T11:40:02+00:00",
+ "time": "2022-10-13T01:24:26+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -2981,7 +2981,7 @@
],
"support": {
"issues": "https://github.com/nette/schema/issues",
- "source": "https://github.com/nette/schema/tree/v1.2.2"
+ "source": "https://github.com/nette/schema/tree/v1.2.3"
},
"install-path": "../nette/schema"
},
@@ -4021,17 +4021,17 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.2.18",
- "version_normalized": "9.2.18.0",
+ "version": "9.2.19",
+ "version_normalized": "9.2.19.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a"
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
- "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559",
+ "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559",
"shasum": ""
},
"require": {
@@ -4056,7 +4056,7 @@
"ext-pcov": "*",
"ext-xdebug": "*"
},
- "time": "2022-10-27T13:35:33+00:00",
+ "time": "2022-11-18T07:47:47+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -4089,7 +4089,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
- "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18"
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19"
},
"funding": [
{
@@ -6210,6 +6210,65 @@
],
"install-path": "../sebastian/version"
},
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.7.1",
+ "version_normalized": "3.7.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
+ "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "time": "2022-06-18T07:21:10+00:00",
+ "bin": [
+ "bin/phpcs",
+ "bin/phpcbf"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "support": {
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
+ },
+ "install-path": "../squizlabs/php_codesniffer"
+ },
{
"name": "swiftmailer/swiftmailer",
"version": "v6.3.0",
@@ -9412,6 +9471,7 @@
"sebastian/resource-operations",
"sebastian/type",
"sebastian/version",
+ "squizlabs/php_codesniffer",
"symfony/thanks",
"theseer/tokenizer"
]
diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php
index afcf4969..e7e6dbbd 100644
--- a/vendor/composer/installed.php
+++ b/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'laravel/laravel',
'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev',
- 'reference' => 'fdd5a78eb8a90d8b9c89baba8d5f752fc93b3140',
+ 'reference' => 'bb07ba5964270b9b986bcd4508fd4a4f5a6c2323',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -433,7 +433,7 @@
'laravel/laravel' => array(
'pretty_version' => '2.x-dev',
'version' => '2.9999999.9999999.9999999-dev',
- 'reference' => 'fdd5a78eb8a90d8b9c89baba8d5f752fc93b3140',
+ 'reference' => 'bb07ba5964270b9b986bcd4508fd4a4f5a6c2323',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -449,9 +449,9 @@
'dev_requirement' => false,
),
'laravel/tinker' => array(
- 'pretty_version' => 'v2.7.2',
- 'version' => '2.7.2.0',
- 'reference' => 'dff39b661e827dae6e092412f976658df82dbac5',
+ 'pretty_version' => 'v2.7.3',
+ 'version' => '2.7.3.0',
+ 'reference' => '5062061b4924af3392225dd482ca7b4d85d8b8ef',
'type' => 'library',
'install_path' => __DIR__ . '/../laravel/tinker',
'aliases' => array(),
@@ -554,9 +554,9 @@
'dev_requirement' => false,
),
'nette/schema' => array(
- 'pretty_version' => 'v1.2.2',
- 'version' => '1.2.2.0',
- 'reference' => '9a39cef03a5b34c7de64f551538cbba05c2be5df',
+ 'pretty_version' => 'v1.2.3',
+ 'version' => '1.2.3.0',
+ 'reference' => 'abbdbb70e0245d5f3bf77874cea1dfb0c930d06f',
'type' => 'library',
'install_path' => __DIR__ . '/../nette/schema',
'aliases' => array(),
@@ -704,9 +704,9 @@
'dev_requirement' => false,
),
'phpunit/php-code-coverage' => array(
- 'pretty_version' => '9.2.18',
- 'version' => '9.2.18.0',
- 'reference' => '12fddc491826940cf9b7e88ad9664cf51f0f6d0a',
+ 'pretty_version' => '9.2.19',
+ 'version' => '9.2.19.0',
+ 'reference' => 'c77b56b63e3d2031bd8997fcec43c1925ae46559',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
'aliases' => array(),
@@ -1065,6 +1065,15 @@
'aliases' => array(),
'dev_requirement' => true,
),
+ 'squizlabs/php_codesniffer' => array(
+ 'pretty_version' => '3.7.1',
+ 'version' => '3.7.1.0',
+ 'reference' => '1359e176e9307e906dc3d890bcc9603ff6d90619',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
+ 'aliases' => array(),
+ 'dev_requirement' => true,
+ ),
'swiftmailer/swiftmailer' => array(
'pretty_version' => 'v6.3.0',
'version' => '6.3.0.0',
diff --git a/vendor/laravel/tinker/src/Console/TinkerCommand.php b/vendor/laravel/tinker/src/Console/TinkerCommand.php
index 95d4c09f..9c12158b 100644
--- a/vendor/laravel/tinker/src/Console/TinkerCommand.php
+++ b/vendor/laravel/tinker/src/Console/TinkerCommand.php
@@ -52,6 +52,10 @@ class TinkerCommand extends Command
$this->getCasters()
);
+ if ($this->option('execute')) {
+ $config->setRawOutput(true);
+ }
+
$shell = new Shell($config);
$shell->addCommands($this->getCommands());
$shell->setIncludes($this->argument('include'));
diff --git a/vendor/nette/schema/composer.json b/vendor/nette/schema/composer.json
index b8e23e4b..bece68ac 100644
--- a/vendor/nette/schema/composer.json
+++ b/vendor/nette/schema/composer.json
@@ -15,13 +15,13 @@
}
],
"require": {
- "php": ">=7.1 <8.2",
+ "php": ">=7.1 <8.3",
"nette/utils": "^2.5.7 || ^3.1.5 || ^4.0"
},
"require-dev": {
"nette/tester": "^2.3 || ^2.4",
"tracy/tracy": "^2.7",
- "phpstan/phpstan-nette": "^0.12"
+ "phpstan/phpstan-nette": "^1.0"
},
"autoload": {
"classmap": ["src/"]
diff --git a/vendor/nette/schema/readme.md b/vendor/nette/schema/readme.md
index 330f2919..20b5de2a 100644
--- a/vendor/nette/schema/readme.md
+++ b/vendor/nette/schema/readme.md
@@ -21,7 +21,7 @@ Installation:
composer require nette/schema
```
-It requires PHP version 7.1 and supports PHP up to 8.1.
+It requires PHP version 7.1 and supports PHP up to 8.2.
[Support Me](https://github.com/sponsors/dg)
diff --git a/vendor/nette/schema/src/Schema/Elements/AnyOf.php b/vendor/nette/schema/src/Schema/Elements/AnyOf.php
index 0480b30e..475b3e22 100644
--- a/vendor/nette/schema/src/Schema/Elements/AnyOf.php
+++ b/vendor/nette/schema/src/Schema/Elements/AnyOf.php
@@ -32,6 +32,7 @@ final class AnyOf implements Schema
if (!$set) {
throw new Nette\InvalidStateException('The enumeration must not be empty.');
}
+
$this->set = $set;
}
@@ -72,6 +73,7 @@ final class AnyOf implements Schema
unset($value[Helpers::PREVENT_MERGING]);
return $value;
}
+
return Helpers::merge($value, $base);
}
@@ -88,6 +90,7 @@ final class AnyOf implements Schema
$context->warnings = array_merge($context->warnings, $dolly->warnings);
return $this->doFinalize($res, $context);
}
+
foreach ($dolly->errors as $error) {
if ($error->path !== $context->path || empty($error->variables['expected'])) {
$innerErrors[] = $error;
@@ -99,6 +102,7 @@ final class AnyOf implements Schema
if ($item === $value) {
return $this->doFinalize($value, $context);
}
+
$expecteds[] = Nette\Schema\Helpers::formatValue($item);
}
}
@@ -127,9 +131,11 @@ final class AnyOf implements Schema
);
return null;
}
+
if ($this->default instanceof Schema) {
return $this->default->completeDefault($context);
}
+
return $this->default;
}
}
diff --git a/vendor/nette/schema/src/Schema/Elements/Base.php b/vendor/nette/schema/src/Schema/Elements/Base.php
index 9dfc3d43..60817612 100644
--- a/vendor/nette/schema/src/Schema/Elements/Base.php
+++ b/vendor/nette/schema/src/Schema/Elements/Base.php
@@ -65,7 +65,7 @@ trait Base
}
- public function assert(callable $handler, string $description = null): self
+ public function assert(callable $handler, ?string $description = null): self
{
$this->asserts[] = [$handler, $description];
return $this;
@@ -89,6 +89,7 @@ trait Base
);
return null;
}
+
return $this->default;
}
@@ -98,6 +99,7 @@ trait Base
if ($this->before) {
$value = ($this->before)($value);
}
+
return $value;
}
@@ -124,6 +126,7 @@ trait Base
);
return false;
}
+
return true;
}
@@ -145,7 +148,6 @@ trait Base
);
return false;
}
-
} elseif ((is_int($value) || is_float($value)) && !self::isInRange($value, $range)) {
$context->addError(
'The %label% %path% expects to be in range %expected%, %value% given.',
@@ -154,6 +156,7 @@ trait Base
);
return false;
}
+
return true;
}
@@ -175,6 +178,7 @@ trait Base
foreach ($value as $k => $v) {
$object->$k = $v;
}
+
$value = $object;
}
}
diff --git a/vendor/nette/schema/src/Schema/Elements/Structure.php b/vendor/nette/schema/src/Schema/Elements/Structure.php
index b4ed8bfa..a622dc1b 100644
--- a/vendor/nette/schema/src/Schema/Elements/Structure.php
+++ b/vendor/nette/schema/src/Schema/Elements/Structure.php
@@ -105,10 +105,12 @@ final class Structure implements Schema
array_pop($context->path);
}
}
+
if ($prevent) {
$value[Helpers::PREVENT_MERGING] = true;
}
}
+
return $value;
}
@@ -135,6 +137,7 @@ final class Structure implements Schema
$base[$key] = $val;
}
}
+
return $base;
}
@@ -184,6 +187,7 @@ final class Structure implements Schema
$value[$itemKey] = $default;
}
}
+
array_pop($context->path);
}
diff --git a/vendor/nette/schema/src/Schema/Elements/Type.php b/vendor/nette/schema/src/Schema/Elements/Type.php
index 3059d17b..5d8b2c09 100644
--- a/vendor/nette/schema/src/Schema/Elements/Type.php
+++ b/vendor/nette/schema/src/Schema/Elements/Type.php
@@ -42,7 +42,7 @@ final class Type implements Schema
public function __construct(string $type)
{
- static $defaults = ['list' => [], 'array' => []];
+ $defaults = ['list' => [], 'array' => []];
$this->type = $type;
$this->default = strpos($type, '[]') ? [] : $defaults[$type] ?? null;
}
@@ -129,11 +129,14 @@ final class Type implements Schema
$res[$key] = $this->itemsValue->normalize($val, $context);
array_pop($context->path);
}
+
$value = $res;
}
+
if ($prevent && is_array($value)) {
$value[Helpers::PREVENT_MERGING] = true;
}
+
return $value;
}
@@ -144,6 +147,7 @@ final class Type implements Schema
unset($value[Helpers::PREVENT_MERGING]);
return $value;
}
+
if (is_array($value) && is_array($base) && $this->itemsValue) {
$index = 0;
foreach ($value as $key => $val) {
@@ -156,6 +160,7 @@ final class Type implements Schema
: $val;
}
}
+
return $base;
}
@@ -208,15 +213,18 @@ final class Type implements Schema
$res[$key] = $this->itemsValue->complete($val, $context);
array_pop($context->path);
}
+
if (count($context->errors) > $errCount) {
return null;
}
+
$value = $res;
}
if ($merge) {
$value = Helpers::merge($value, $this->default);
}
+
return $this->doFinalize($value, $context);
}
}
diff --git a/vendor/nette/schema/src/Schema/Expect.php b/vendor/nette/schema/src/Schema/Expect.php
index f8b1def8..f2999502 100644
--- a/vendor/nette/schema/src/Schema/Expect.php
+++ b/vendor/nette/schema/src/Schema/Expect.php
@@ -40,6 +40,7 @@ final class Expect
if ($args) {
$type->default($args[0]);
}
+
return $type;
}
@@ -93,6 +94,7 @@ final class Expect
}
}
}
+
return (new Structure($items))->castTo($ro->getName());
}
diff --git a/vendor/nette/schema/src/Schema/Helpers.php b/vendor/nette/schema/src/Schema/Helpers.php
index 6f97d08b..0d2f12c4 100644
--- a/vendor/nette/schema/src/Schema/Helpers.php
+++ b/vendor/nette/schema/src/Schema/Helpers.php
@@ -44,6 +44,7 @@ final class Helpers
$base[$key] = static::merge($val, $base[$key] ?? null);
}
}
+
return $base;
} elseif ($value === null && is_array($base)) {
@@ -67,6 +68,7 @@ final class Helpers
return Reflection::expandClassName($m[0], $class);
}, $type);
}
+
return null;
}
@@ -80,10 +82,12 @@ final class Helpers
if (!Reflection::areCommentsAvailable()) {
throw new Nette\InvalidStateException('You have to enable phpDoc comments in opcode cache.');
}
+
$re = '#[\s*]@' . preg_quote($name, '#') . '(?=\s|$)(?:[ \t]+([^@\s]\S*))?#';
if ($ref->getDocComment() && preg_match($re, trim($ref->getDocComment(), '/*'), $m)) {
return $m[1] ?? '';
}
+
return null;
}
diff --git a/vendor/nette/schema/src/Schema/Message.php b/vendor/nette/schema/src/Schema/Message.php
index 145c7bce..49c32bd5 100644
--- a/vendor/nette/schema/src/Schema/Message.php
+++ b/vendor/nette/schema/src/Schema/Message.php
@@ -66,7 +66,9 @@ final class Message
{
$vars = $this->variables;
$vars['label'] = empty($vars['isKey']) ? 'item' : 'key of item';
- $vars['path'] = $this->path ? "'" . implode(' › ', $this->path) . "'" : null;
+ $vars['path'] = $this->path
+ ? "'" . implode("\u{a0}›\u{a0}", $this->path) . "'"
+ : null;
$vars['value'] = Helpers::formatValue($vars['value'] ?? null);
return preg_replace_callback('~( ?)%(\w+)%~', function ($m) use ($vars) {
diff --git a/vendor/nette/schema/src/Schema/Processor.php b/vendor/nette/schema/src/Schema/Processor.php
index 392a3de8..a10a0ef6 100644
--- a/vendor/nette/schema/src/Schema/Processor.php
+++ b/vendor/nette/schema/src/Schema/Processor.php
@@ -67,6 +67,7 @@ final class Processor
$flatten = $first ? $data : $schema->merge($data, $flatten);
$first = false;
}
+
$data = $schema->complete($flatten, $this->context);
$this->throwsErrors();
return $data;
@@ -82,6 +83,7 @@ final class Processor
foreach ($this->context->warnings as $message) {
$res[] = $message->toString();
}
+
return $res;
}
diff --git a/vendor/nette/schema/src/Schema/ValidationException.php b/vendor/nette/schema/src/Schema/ValidationException.php
index 4c2af02b..04c581f9 100644
--- a/vendor/nette/schema/src/Schema/ValidationException.php
+++ b/vendor/nette/schema/src/Schema/ValidationException.php
@@ -40,6 +40,7 @@ class ValidationException extends Nette\InvalidStateException
foreach ($this->messages as $message) {
$res[] = $message->toString();
}
+
return $res;
}
diff --git a/vendor/phpunit/php-code-coverage/ChangeLog.md b/vendor/phpunit/php-code-coverage/ChangeLog.md
index fd8dc852..33466156 100644
--- a/vendor/phpunit/php-code-coverage/ChangeLog.md
+++ b/vendor/phpunit/php-code-coverage/ChangeLog.md
@@ -2,6 +2,17 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+## [9.2.19] - 2022-11-18
+
+### Fixed
+
+* [#949](https://github.com/sebastianbergmann/php-code-coverage/pull/949): Various issues related to identifying executable lines
+
+### Changed
+
+* Tweaked CSS for HTML report
+* Updated bundled CSS/JavaScript components used for HTML report: Bootstrap 4.6.2 and jQuery 3.6.1
+
## [9.2.18] - 2022-10-27
### Fixed
@@ -422,6 +433,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 7.1
+[9.2.19]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.18...9.2.19
[9.2.18]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.17...9.2.18
[9.2.17]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.16...9.2.17
[9.2.16]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.2.15...9.2.16
diff --git a/vendor/phpunit/php-code-coverage/src/RawCodeCoverageData.php b/vendor/phpunit/php-code-coverage/src/RawCodeCoverageData.php
index 422742e2..c8d3eb75 100644
--- a/vendor/phpunit/php-code-coverage/src/RawCodeCoverageData.php
+++ b/vendor/phpunit/php-code-coverage/src/RawCodeCoverageData.php
@@ -15,8 +15,12 @@ use function array_flip;
use function array_intersect;
use function array_intersect_key;
use function count;
+use function explode;
+use function file_get_contents;
use function in_array;
+use function is_file;
use function range;
+use function trim;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\StaticAnalysis\FileAnalyser;
diff --git a/vendor/phpunit/php-code-coverage/src/Version.php b/vendor/phpunit/php-code-coverage/src/Version.php
index 338f6c2f..1b778649 100644
--- a/vendor/phpunit/php-code-coverage/src/Version.php
+++ b/vendor/phpunit/php-code-coverage/src/Version.php
@@ -22,7 +22,7 @@ final class Version
public static function id(): string
{
if (self::$version === null) {
- self::$version = (new VersionId('9.2.18', dirname(__DIR__)))->getVersion();
+ self::$version = (new VersionId('9.2.19', dirname(__DIR__)))->getVersion();
}
return self::$version;
diff --git a/vendor/squizlabs/php_codesniffer/CONTRIBUTING.md b/vendor/squizlabs/php_codesniffer/CONTRIBUTING.md
new file mode 100644
index 00000000..5cc73635
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/CONTRIBUTING.md
@@ -0,0 +1,13 @@
+Contributing
+-------------
+
+Before you contribute code to PHP\_CodeSniffer, please make sure it conforms to the PHPCS coding standard and that the PHP\_CodeSniffer unit tests still pass. The easiest way to contribute is to work on a checkout of the repository, or your own fork, rather than an installed PEAR version. If you do this, you can run the following commands to check if everything is ready to submit:
+
+ cd PHP_CodeSniffer
+ php bin/phpcs
+
+Which should display no coding standard errors. And then:
+
+ phpunit
+
+Which should give you no failures or errors. You can ignore any skipped tests as these are for external tools.
diff --git a/vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist b/vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist
new file mode 100644
index 00000000..f95058fa
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist
@@ -0,0 +1,9 @@
+ 'PSR2',
+ 'report_format' => 'summary',
+ 'show_warnings' => '0',
+ 'show_progress' => '1',
+ 'report_width' => '120',
+);
+?>
diff --git a/vendor/squizlabs/php_codesniffer/README.md b/vendor/squizlabs/php_codesniffer/README.md
new file mode 100644
index 00000000..859de432
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/README.md
@@ -0,0 +1,134 @@
+## About
+
+PHP_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
+
+[![Build Status](https://github.com/squizlabs/PHP_CodeSniffer/workflows/Validate/badge.svg?branch=master)](https://github.com/squizlabs/PHP_CodeSniffer/actions)
+[![Build Status](https://github.com/squizlabs/PHP_CodeSniffer/workflows/Test/badge.svg?branch=master)](https://github.com/squizlabs/PHP_CodeSniffer/actions)
+[![Code consistency](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer/grade.svg)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer)
+[![Join the chat at https://gitter.im/squizlabs/PHP_CodeSniffer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/squizlabs/PHP_CodeSniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+## Requirements
+
+PHP_CodeSniffer requires PHP version 5.4.0 or greater, although individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options manual page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options) for a list of these requirements.
+
+If you're using PHP_CodeSniffer as part of a team, or you're running it on a [CI](https://en.wikipedia.org/wiki/Continuous_integration) server, you may want to configure your project's settings [using a configuration file](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file).
+
+
+## Installation
+
+The easiest way to get started with PHP_CodeSniffer is to download the Phar files for each of the commands:
+```
+# Download using curl
+curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
+curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
+
+# Or download using wget
+wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
+wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
+
+# Then test the downloaded PHARs
+php phpcs.phar -h
+php phpcbf.phar -h
+```
+
+### Composer
+If you use Composer, you can install PHP_CodeSniffer system-wide with the following command:
+```bash
+composer global require "squizlabs/php_codesniffer=*"
+```
+Make sure you have the composer bin dir in your PATH. The default value is `~/.composer/vendor/bin/`, but you can check the value that you need to use by running `composer global config bin-dir --absolute`.
+
+Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
+
+```json
+{
+ "require-dev": {
+ "squizlabs/php_codesniffer": "3.*"
+ }
+}
+```
+
+You will then be able to run PHP_CodeSniffer from the vendor bin directory:
+```bash
+./vendor/bin/phpcs -h
+./vendor/bin/phpcbf -h
+```
+### Phive
+If you use Phive, you can install PHP_CodeSniffer as a project tool using the following commands:
+```bash
+phive install phpcs
+phive install phpcbf
+```
+You will then be able to run PHP_CodeSniffer from the tools directory:
+```bash
+./tools/phpcs -h
+./tools/phpcbf -h
+```
+### PEAR
+If you use PEAR, you can install PHP_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:
+```bash
+pear install PHP_CodeSniffer
+```
+### Git Clone
+You can also download the PHP_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:
+```bash
+git clone https://github.com/squizlabs/PHP_CodeSniffer.git
+cd PHP_CodeSniffer
+php bin/phpcs -h
+php bin/phpcbf -h
+```
+## Getting Started
+
+The default coding standard used by PHP_CodeSniffer is the PEAR coding standard. To check a file against the PEAR coding standard, simply specify the file's location:
+```bash
+phpcs /path/to/code/myfile.php
+```
+Or if you wish to check an entire directory you can specify the directory location instead of a file.
+```bash
+phpcs /path/to/code-directory
+```
+If you wish to check your code against the PSR-12 coding standard, use the `--standard` command line argument:
+```bash
+phpcs --standard=PSR12 /path/to/code-directory
+```
+
+If PHP_CodeSniffer finds any coding standard errors, a report will be shown after running the command.
+
+Full usage information and example reports are available on the [usage page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage).
+
+## Documentation
+
+The documentation for PHP_CodeSniffer is available on the [Github wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki).
+
+## Issues
+
+Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/squizlabs/PHP_CodeSniffer/issues).
+
+## Contributing
+
+See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
+
+## Versioning
+
+PHP_CodeSniffer uses a `MAJOR.MINOR.PATCH` version number format.
+
+The `MAJOR` version is incremented when:
+- backwards-incompatible changes are made to how the `phpcs` or `phpcbf` commands are used, or
+- backwards-incompatible changes are made to the `ruleset.xml` format, or
+- backwards-incompatible changes are made to the API used by sniff developers, or
+- custom PHP_CodeSniffer token types are removed, or
+- existing sniffs are removed from PHP_CodeSniffer entirely
+
+The `MINOR` version is incremented when:
+- new backwards-compatible features are added to the `phpcs` and `phpcbf` commands, or
+- backwards-compatible changes are made to the `ruleset.xml` format, or
+- backwards-compatible changes are made to the API used by sniff developers, or
+- new sniffs are added to an included standard, or
+- existing sniffs are removed from an included standard
+
+> NOTE: Backwards-compatible changes to the API used by sniff developers will allow an existing sniff to continue running without producing fatal errors but may not result in the sniff reporting the same errors as it did previously without changes being required.
+
+The `PATCH` version is incremented when:
+- backwards-compatible bug fixes are made
+
+> NOTE: As PHP_CodeSniffer exists to report and fix issues, most bugs are the result of coding standard errors being incorrectly reported or coding standard errors not being reported when they should be. This means that the messages produced by PHP_CodeSniffer, and the fixes it makes, are likely to be different between PATCH versions.
diff --git a/vendor/squizlabs/php_codesniffer/autoload.php b/vendor/squizlabs/php_codesniffer/autoload.php
new file mode 100644
index 00000000..0dcf1b4c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/autoload.php
@@ -0,0 +1,342 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+if (class_exists('PHP_CodeSniffer\Autoload', false) === false) {
+ class Autoload
+ {
+
+ /**
+ * The composer autoloader.
+ *
+ * @var \Composer\Autoload\ClassLoader
+ */
+ private static $composerAutoloader = null;
+
+ /**
+ * A mapping of file names to class names.
+ *
+ * @var array
+ */
+ private static $loadedClasses = [];
+
+ /**
+ * A mapping of class names to file names.
+ *
+ * @var array
+ */
+ private static $loadedFiles = [];
+
+ /**
+ * A list of additional directories to search during autoloading.
+ *
+ * This is typically a list of coding standard directories.
+ *
+ * @var string[]
+ */
+ private static $searchPaths = [];
+
+
+ /**
+ * Loads a class.
+ *
+ * This method only loads classes that exist in the PHP_CodeSniffer namespace.
+ * All other classes are ignored and loaded by subsequent autoloaders.
+ *
+ * @param string $class The name of the class to load.
+ *
+ * @return bool
+ */
+ public static function load($class)
+ {
+ // Include the composer autoloader if there is one, but re-register it
+ // so this autoloader runs before the composer one as we need to include
+ // all files so we can figure out what the class/interface/trait name is.
+ if (self::$composerAutoloader === null) {
+ // Make sure we don't try to load any of Composer's classes
+ // while the autoloader is being setup.
+ if (strpos($class, 'Composer\\') === 0) {
+ return;
+ }
+
+ if (strpos(__DIR__, 'phar://') !== 0
+ && @file_exists(__DIR__.'/../../autoload.php') === true
+ ) {
+ self::$composerAutoloader = include __DIR__.'/../../autoload.php';
+ if (self::$composerAutoloader instanceof \Composer\Autoload\ClassLoader) {
+ self::$composerAutoloader->unregister();
+ self::$composerAutoloader->register();
+ } else {
+ // Something went wrong, so keep going without the autoloader
+ // although namespaced sniffs might error.
+ self::$composerAutoloader = false;
+ }
+ } else {
+ self::$composerAutoloader = false;
+ }
+ }//end if
+
+ $ds = DIRECTORY_SEPARATOR;
+ $path = false;
+
+ if (substr($class, 0, 16) === 'PHP_CodeSniffer\\') {
+ if (substr($class, 0, 22) === 'PHP_CodeSniffer\Tests\\') {
+ $isInstalled = !is_dir(__DIR__.$ds.'tests');
+ if ($isInstalled === false) {
+ $path = __DIR__.$ds.'tests';
+ } else {
+ $path = '@test_dir@'.$ds.'PHP_CodeSniffer'.$ds.'CodeSniffer';
+ }
+
+ $path .= $ds.substr(str_replace('\\', $ds, $class), 22).'.php';
+ } else {
+ $path = __DIR__.$ds.'src'.$ds.substr(str_replace('\\', $ds, $class), 16).'.php';
+ }
+ }
+
+ // See if the composer autoloader knows where the class is.
+ if ($path === false && self::$composerAutoloader !== false) {
+ $path = self::$composerAutoloader->findFile($class);
+ }
+
+ // See if the class is inside one of our alternate search paths.
+ if ($path === false) {
+ foreach (self::$searchPaths as $searchPath => $nsPrefix) {
+ $className = $class;
+ if ($nsPrefix !== '' && substr($class, 0, strlen($nsPrefix)) === $nsPrefix) {
+ $className = substr($class, (strlen($nsPrefix) + 1));
+ }
+
+ $path = $searchPath.$ds.str_replace('\\', $ds, $className).'.php';
+ if (is_file($path) === true) {
+ break;
+ }
+
+ $path = false;
+ }
+ }
+
+ if ($path !== false && is_file($path) === true) {
+ self::loadFile($path);
+ return true;
+ }
+
+ return false;
+
+ }//end load()
+
+
+ /**
+ * Includes a file and tracks what class or interface was loaded as a result.
+ *
+ * @param string $path The path of the file to load.
+ *
+ * @return string The fully qualified name of the class in the loaded file.
+ */
+ public static function loadFile($path)
+ {
+ if (strpos(__DIR__, 'phar://') !== 0) {
+ $path = realpath($path);
+ if ($path === false) {
+ return false;
+ }
+ }
+
+ if (isset(self::$loadedClasses[$path]) === true) {
+ return self::$loadedClasses[$path];
+ }
+
+ $classesBeforeLoad = [
+ 'classes' => get_declared_classes(),
+ 'interfaces' => get_declared_interfaces(),
+ 'traits' => get_declared_traits(),
+ ];
+
+ include $path;
+
+ $classesAfterLoad = [
+ 'classes' => get_declared_classes(),
+ 'interfaces' => get_declared_interfaces(),
+ 'traits' => get_declared_traits(),
+ ];
+
+ $className = self::determineLoadedClass($classesBeforeLoad, $classesAfterLoad);
+
+ self::$loadedClasses[$path] = $className;
+ self::$loadedFiles[$className] = $path;
+ return self::$loadedClasses[$path];
+
+ }//end loadFile()
+
+
+ /**
+ * Determine which class was loaded based on the before and after lists of loaded classes.
+ *
+ * @param array $classesBeforeLoad The classes/interfaces/traits before the file was included.
+ * @param array $classesAfterLoad The classes/interfaces/traits after the file was included.
+ *
+ * @return string The fully qualified name of the class in the loaded file.
+ */
+ public static function determineLoadedClass($classesBeforeLoad, $classesAfterLoad)
+ {
+ $className = null;
+
+ $newClasses = array_diff($classesAfterLoad['classes'], $classesBeforeLoad['classes']);
+ if (PHP_VERSION_ID < 70400) {
+ $newClasses = array_reverse($newClasses);
+ }
+
+ // Since PHP 7.4 get_declared_classes() does not guarantee any order, making
+ // it impossible to use order to determine which is the parent an which is the child.
+ // Let's reduce the list of candidates by removing all the classes known to be "parents".
+ // That way, at the end, only the "main" class just included will remain.
+ $newClasses = array_reduce(
+ $newClasses,
+ function ($remaining, $current) {
+ return array_diff($remaining, class_parents($current));
+ },
+ $newClasses
+ );
+
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+
+ if ($className === null) {
+ $newClasses = array_reverse(array_diff($classesAfterLoad['interfaces'], $classesBeforeLoad['interfaces']));
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+ }
+
+ if ($className === null) {
+ $newClasses = array_reverse(array_diff($classesAfterLoad['traits'], $classesBeforeLoad['traits']));
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+ }
+
+ return $className;
+
+ }//end determineLoadedClass()
+
+
+ /**
+ * Adds a directory to search during autoloading.
+ *
+ * @param string $path The path to the directory to search.
+ * @param string $nsPrefix The namespace prefix used by files under this path.
+ *
+ * @return void
+ */
+ public static function addSearchPath($path, $nsPrefix='')
+ {
+ self::$searchPaths[$path] = rtrim(trim((string) $nsPrefix), '\\');
+
+ }//end addSearchPath()
+
+
+ /**
+ * Retrieve the namespaces and paths registered by external standards.
+ *
+ * @return array
+ */
+ public static function getSearchPaths()
+ {
+ return self::$searchPaths;
+
+ }//end getSearchPaths()
+
+
+ /**
+ * Gets the class name for the given file path.
+ *
+ * @param string $path The name of the file.
+ *
+ * @throws \Exception If the file path has not been loaded.
+ * @return string
+ */
+ public static function getLoadedClassName($path)
+ {
+ if (isset(self::$loadedClasses[$path]) === false) {
+ throw new \Exception("Cannot get class name for $path; file has not been included");
+ }
+
+ return self::$loadedClasses[$path];
+
+ }//end getLoadedClassName()
+
+
+ /**
+ * Gets the file path for the given class name.
+ *
+ * @param string $class The name of the class.
+ *
+ * @throws \Exception If the class name has not been loaded
+ * @return string
+ */
+ public static function getLoadedFileName($class)
+ {
+ if (isset(self::$loadedFiles[$class]) === false) {
+ throw new \Exception("Cannot get file name for $class; class has not been included");
+ }
+
+ return self::$loadedFiles[$class];
+
+ }//end getLoadedFileName()
+
+
+ /**
+ * Gets the mapping of file names to class names.
+ *
+ * @return array
+ */
+ public static function getLoadedClasses()
+ {
+ return self::$loadedClasses;
+
+ }//end getLoadedClasses()
+
+
+ /**
+ * Gets the mapping of class names to file names.
+ *
+ * @return array
+ */
+ public static function getLoadedFiles()
+ {
+ return self::$loadedFiles;
+
+ }//end getLoadedFiles()
+
+
+ }//end class
+
+ // Register the autoloader before any existing autoloaders to ensure
+ // it gets a chance to hear about every autoload request, and record
+ // the file and class name for it.
+ spl_autoload_register(__NAMESPACE__.'\Autoload::load', true, true);
+}//end if
diff --git a/vendor/squizlabs/php_codesniffer/bin/phpcbf b/vendor/squizlabs/php_codesniffer/bin/phpcbf
new file mode 100755
index 00000000..45b43f43
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcbf
@@ -0,0 +1,19 @@
+#!/usr/bin/env php
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+if (is_file(__DIR__.'/../autoload.php') === true) {
+ include_once __DIR__.'/../autoload.php';
+} else {
+ include_once 'PHP/CodeSniffer/autoload.php';
+}
+
+$runner = new PHP_CodeSniffer\Runner();
+$exitCode = $runner->runPHPCBF();
+exit($exitCode);
diff --git a/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat b/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat
new file mode 100644
index 00000000..5b07a7d9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat
@@ -0,0 +1,12 @@
+@echo off
+REM PHP Code Beautifier and Fixer fixes violations of a defined coding standard.
+REM
+REM @author Greg Sherwood
+REM @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+REM @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+
+if "%PHP_PEAR_PHP_BIN%" neq "" (
+ set PHPBIN=%PHP_PEAR_PHP_BIN%
+) else set PHPBIN=php
+
+"%PHPBIN%" "%~dp0\phpcbf" %*
diff --git a/vendor/squizlabs/php_codesniffer/bin/phpcs b/vendor/squizlabs/php_codesniffer/bin/phpcs
new file mode 100755
index 00000000..52d28cdf
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcs
@@ -0,0 +1,19 @@
+#!/usr/bin/env php
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+if (is_file(__DIR__.'/../autoload.php') === true) {
+ include_once __DIR__.'/../autoload.php';
+} else {
+ include_once 'PHP/CodeSniffer/autoload.php';
+}
+
+$runner = new PHP_CodeSniffer\Runner();
+$exitCode = $runner->runPHPCS();
+exit($exitCode);
diff --git a/vendor/squizlabs/php_codesniffer/bin/phpcs.bat b/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
new file mode 100755
index 00000000..9f9be720
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
@@ -0,0 +1,12 @@
+@echo off
+REM PHP_CodeSniffer detects violations of a defined coding standard.
+REM
+REM @author Greg Sherwood
+REM @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+REM @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+
+if "%PHP_PEAR_PHP_BIN%" neq "" (
+ set PHPBIN=%PHP_PEAR_PHP_BIN%
+) else set PHPBIN=php
+
+"%PHPBIN%" "%~dp0\phpcs" %*
diff --git a/vendor/squizlabs/php_codesniffer/composer.json b/vendor/squizlabs/php_codesniffer/composer.json
new file mode 100644
index 00000000..7605a5df
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/composer.json
@@ -0,0 +1,40 @@
+{
+ "name": "squizlabs/php_codesniffer",
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "type": "library",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
+ "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
+ "source": "https://github.com/squizlabs/PHP_CodeSniffer"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "require": {
+ "php": ">=5.4.0",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "ext-simplexml": "*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "bin": [
+ "bin/phpcs",
+ "bin/phpcbf"
+ ]
+}
diff --git a/vendor/squizlabs/php_codesniffer/licence.txt b/vendor/squizlabs/php_codesniffer/licence.txt
new file mode 100644
index 00000000..9f95b677
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/licence.txt
@@ -0,0 +1,24 @@
+Copyright (c) 2012, Squiz Pty Ltd (ABN 77 084 670 600)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/squizlabs/php_codesniffer/phpcs.xsd b/vendor/squizlabs/php_codesniffer/phpcs.xsd
new file mode 100644
index 00000000..d93dd868
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/phpcs.xsd
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Config.php b/vendor/squizlabs/php_codesniffer/src/Config.php
new file mode 100644
index 00000000..915ad003
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Config.php
@@ -0,0 +1,1704 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Util\Common;
+
+/**
+ * Stores the configuration used to run PHPCS and PHPCBF.
+ *
+ * @property string[] $files The files and directories to check.
+ * @property string[] $standards The standards being used for checking.
+ * @property int $verbosity How verbose the output should be.
+ * 0: no unnecessary output
+ * 1: basic output for files being checked
+ * 2: ruleset and file parsing output
+ * 3: sniff execution output
+ * @property bool $interactive Enable interactive checking mode.
+ * @property bool $parallel Check files in parallel.
+ * @property bool $cache Enable the use of the file cache.
+ * @property bool $cacheFile A file where the cache data should be written
+ * @property bool $colors Display colours in output.
+ * @property bool $explain Explain the coding standards.
+ * @property bool $local Process local files in directories only (no recursion).
+ * @property bool $showSources Show sniff source codes in report output.
+ * @property bool $showProgress Show basic progress information while running.
+ * @property bool $quiet Quiet mode; disables progress and verbose output.
+ * @property bool $annotations Process phpcs: annotations.
+ * @property int $tabWidth How many spaces each tab is worth.
+ * @property string $encoding The encoding of the files being checked.
+ * @property string[] $sniffs The sniffs that should be used for checking.
+ * If empty, all sniffs in the supplied standards will be used.
+ * @property string[] $exclude The sniffs that should be excluded from checking.
+ * If empty, all sniffs in the supplied standards will be used.
+ * @property string[] $ignored Regular expressions used to ignore files and folders during checking.
+ * @property string $reportFile A file where the report output should be written.
+ * @property string $generator The documentation generator to use.
+ * @property string $filter The filter to use for the run.
+ * @property string[] $bootstrap One of more files to include before the run begins.
+ * @property int $reportWidth The maximum number of columns that reports should use for output.
+ * Set to "auto" for have this value changed to the width of the terminal.
+ * @property int $errorSeverity The minimum severity an error must have to be displayed.
+ * @property int $warningSeverity The minimum severity a warning must have to be displayed.
+ * @property bool $recordErrors Record the content of error messages as well as error counts.
+ * @property string $suffix A suffix to add to fixed files.
+ * @property string $basepath A file system location to strip from the paths of files shown in reports.
+ * @property bool $stdin Read content from STDIN instead of supplied files.
+ * @property string $stdinContent Content passed directly to PHPCS on STDIN.
+ * @property string $stdinPath The path to use for content passed on STDIN.
+ *
+ * @property array $extensions File extensions that should be checked, and what tokenizer to use.
+ * E.g., array('inc' => 'PHP');
+ * @property array $reports The reports to use for printing output after the run.
+ * The format of the array is:
+ * array(
+ * 'reportName1' => 'outputFile',
+ * 'reportName2' => null,
+ * );
+ * If the array value is NULL, the report will be written to the screen.
+ *
+ * @property string[] $unknown Any arguments gathered on the command line that are unknown to us.
+ * E.g., using `phpcs -c` will give array('c');
+ */
+class Config
+{
+
+ /**
+ * The current version.
+ *
+ * @var string
+ */
+ const VERSION = '3.7.1';
+
+ /**
+ * Package stability; either stable, beta or alpha.
+ *
+ * @var string
+ */
+ const STABILITY = 'stable';
+
+ /**
+ * An array of settings that PHPCS and PHPCBF accept.
+ *
+ * This array is not meant to be accessed directly. Instead, use the settings
+ * as if they are class member vars so the __get() and __set() magic methods
+ * can be used to validate the values. For example, to set the verbosity level to
+ * level 2, use $this->verbosity = 2; instead of accessing this property directly.
+ *
+ * Each of these settings is described in the class comment property list.
+ *
+ * @var array
+ */
+ private $settings = [
+ 'files' => null,
+ 'standards' => null,
+ 'verbosity' => null,
+ 'interactive' => null,
+ 'parallel' => null,
+ 'cache' => null,
+ 'cacheFile' => null,
+ 'colors' => null,
+ 'explain' => null,
+ 'local' => null,
+ 'showSources' => null,
+ 'showProgress' => null,
+ 'quiet' => null,
+ 'annotations' => null,
+ 'tabWidth' => null,
+ 'encoding' => null,
+ 'extensions' => null,
+ 'sniffs' => null,
+ 'exclude' => null,
+ 'ignored' => null,
+ 'reportFile' => null,
+ 'generator' => null,
+ 'filter' => null,
+ 'bootstrap' => null,
+ 'reports' => null,
+ 'basepath' => null,
+ 'reportWidth' => null,
+ 'errorSeverity' => null,
+ 'warningSeverity' => null,
+ 'recordErrors' => null,
+ 'suffix' => null,
+ 'stdin' => null,
+ 'stdinContent' => null,
+ 'stdinPath' => null,
+ 'unknown' => null,
+ ];
+
+ /**
+ * Whether or not to kill the process when an unknown command line arg is found.
+ *
+ * If FALSE, arguments that are not command line options or file/directory paths
+ * will be ignored and execution will continue. These values will be stored in
+ * $this->unknown.
+ *
+ * @var boolean
+ */
+ public $dieOnUnknownArg;
+
+ /**
+ * The current command line arguments we are processing.
+ *
+ * @var string[]
+ */
+ private $cliArgs = [];
+
+ /**
+ * Command line values that the user has supplied directly.
+ *
+ * @var array
+ */
+ private static $overriddenDefaults = [];
+
+ /**
+ * Config file data that has been loaded for the run.
+ *
+ * @var array
+ */
+ private static $configData = null;
+
+ /**
+ * The full path to the config data file that has been loaded.
+ *
+ * @var string
+ */
+ private static $configDataFile = null;
+
+ /**
+ * Automatically discovered executable utility paths.
+ *
+ * @var array
+ */
+ private static $executablePaths = [];
+
+
+ /**
+ * Get the value of an inaccessible property.
+ *
+ * @param string $name The name of the property.
+ *
+ * @return mixed
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the setting name is invalid.
+ */
+ public function __get($name)
+ {
+ if (array_key_exists($name, $this->settings) === false) {
+ throw new RuntimeException("ERROR: unable to get value of property \"$name\"");
+ }
+
+ return $this->settings[$name];
+
+ }//end __get()
+
+
+ /**
+ * Set the value of an inaccessible property.
+ *
+ * @param string $name The name of the property.
+ * @param mixed $value The value of the property.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the setting name is invalid.
+ */
+ public function __set($name, $value)
+ {
+ if (array_key_exists($name, $this->settings) === false) {
+ throw new RuntimeException("Can't __set() $name; setting doesn't exist");
+ }
+
+ switch ($name) {
+ case 'reportWidth' :
+ // Support auto terminal width.
+ if ($value === 'auto'
+ && function_exists('shell_exec') === true
+ && preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1
+ ) {
+ $value = (int) $matches[1];
+ } else {
+ $value = (int) $value;
+ }
+ break;
+ case 'standards' :
+ $cleaned = [];
+
+ // Check if the standard name is valid, or if the case is invalid.
+ $installedStandards = Util\Standards::getInstalledStandards();
+ foreach ($value as $standard) {
+ foreach ($installedStandards as $validStandard) {
+ if (strtolower($standard) === strtolower($validStandard)) {
+ $standard = $validStandard;
+ break;
+ }
+ }
+
+ $cleaned[] = $standard;
+ }
+
+ $value = $cleaned;
+ break;
+ default :
+ // No validation required.
+ break;
+ }//end switch
+
+ $this->settings[$name] = $value;
+
+ }//end __set()
+
+
+ /**
+ * Check if the value of an inaccessible property is set.
+ *
+ * @param string $name The name of the property.
+ *
+ * @return bool
+ */
+ public function __isset($name)
+ {
+ return isset($this->settings[$name]);
+
+ }//end __isset()
+
+
+ /**
+ * Unset the value of an inaccessible property.
+ *
+ * @param string $name The name of the property.
+ *
+ * @return void
+ */
+ public function __unset($name)
+ {
+ $this->settings[$name] = null;
+
+ }//end __unset()
+
+
+ /**
+ * Get the array of all config settings.
+ *
+ * @return array
+ */
+ public function getSettings()
+ {
+ return $this->settings;
+
+ }//end getSettings()
+
+
+ /**
+ * Set the array of all config settings.
+ *
+ * @param array $settings The array of config settings.
+ *
+ * @return void
+ */
+ public function setSettings($settings)
+ {
+ return $this->settings = $settings;
+
+ }//end setSettings()
+
+
+ /**
+ * Creates a Config object and populates it with command line values.
+ *
+ * @param array $cliArgs An array of values gathered from CLI args.
+ * @param bool $dieOnUnknownArg Whether or not to kill the process when an
+ * unknown command line arg is found.
+ *
+ * @return void
+ */
+ public function __construct(array $cliArgs=[], $dieOnUnknownArg=true)
+ {
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
+ // Let everything through during testing so that we can
+ // make use of PHPUnit command line arguments as well.
+ $this->dieOnUnknownArg = false;
+ } else {
+ $this->dieOnUnknownArg = $dieOnUnknownArg;
+ }
+
+ if (empty($cliArgs) === true) {
+ $cliArgs = $_SERVER['argv'];
+ array_shift($cliArgs);
+ }
+
+ $this->restoreDefaults();
+ $this->setCommandLineValues($cliArgs);
+
+ if (isset(self::$overriddenDefaults['standards']) === false) {
+ // They did not supply a standard to use.
+ // Look for a default ruleset in the current directory or higher.
+ $currentDir = getcwd();
+
+ $defaultFiles = [
+ '.phpcs.xml',
+ 'phpcs.xml',
+ '.phpcs.xml.dist',
+ 'phpcs.xml.dist',
+ ];
+
+ do {
+ foreach ($defaultFiles as $defaultFilename) {
+ $default = $currentDir.DIRECTORY_SEPARATOR.$defaultFilename;
+ if (is_file($default) === true) {
+ $this->standards = [$default];
+ break(2);
+ }
+ }
+
+ $lastDir = $currentDir;
+ $currentDir = dirname($currentDir);
+ } while ($currentDir !== '.' && $currentDir !== $lastDir && Common::isReadable($currentDir) === true);
+ }//end if
+
+ if (defined('STDIN') === false
+ || stripos(PHP_OS, 'WIN') === 0
+ ) {
+ return;
+ }
+
+ $handle = fopen('php://stdin', 'r');
+
+ // Check for content on STDIN.
+ if ($this->stdin === true
+ || (Util\Common::isStdinATTY() === false
+ && feof($handle) === false)
+ ) {
+ $readStreams = [$handle];
+ $writeSteams = null;
+
+ $fileContents = '';
+ while (is_resource($handle) === true && feof($handle) === false) {
+ // Set a timeout of 200ms.
+ if (stream_select($readStreams, $writeSteams, $writeSteams, 0, 200000) === 0) {
+ break;
+ }
+
+ $fileContents .= fgets($handle);
+ }
+
+ if (trim($fileContents) !== '') {
+ $this->stdin = true;
+ $this->stdinContent = $fileContents;
+ self::$overriddenDefaults['stdin'] = true;
+ self::$overriddenDefaults['stdinContent'] = true;
+ }
+ }//end if
+
+ fclose($handle);
+
+ }//end __construct()
+
+
+ /**
+ * Set the command line values.
+ *
+ * @param array $args An array of command line arguments to set.
+ *
+ * @return void
+ */
+ public function setCommandLineValues($args)
+ {
+ $this->cliArgs = $args;
+ $numArgs = count($args);
+
+ for ($i = 0; $i < $numArgs; $i++) {
+ $arg = $this->cliArgs[$i];
+ if ($arg === '') {
+ continue;
+ }
+
+ if ($arg[0] === '-') {
+ if ($arg === '-') {
+ // Asking to read from STDIN.
+ $this->stdin = true;
+ self::$overriddenDefaults['stdin'] = true;
+ continue;
+ }
+
+ if ($arg === '--') {
+ // Empty argument, ignore it.
+ continue;
+ }
+
+ if ($arg[1] === '-') {
+ $this->processLongArgument(substr($arg, 2), $i);
+ } else {
+ $switches = str_split($arg);
+ foreach ($switches as $switch) {
+ if ($switch === '-') {
+ continue;
+ }
+
+ $this->processShortArgument($switch, $i);
+ }
+ }
+ } else {
+ $this->processUnknownArgument($arg, $i);
+ }//end if
+ }//end for
+
+ }//end setCommandLineValues()
+
+
+ /**
+ * Restore default values for all possible command line arguments.
+ *
+ * @return void
+ */
+ public function restoreDefaults()
+ {
+ $this->files = [];
+ $this->standards = ['PEAR'];
+ $this->verbosity = 0;
+ $this->interactive = false;
+ $this->cache = false;
+ $this->cacheFile = null;
+ $this->colors = false;
+ $this->explain = false;
+ $this->local = false;
+ $this->showSources = false;
+ $this->showProgress = false;
+ $this->quiet = false;
+ $this->annotations = true;
+ $this->parallel = 1;
+ $this->tabWidth = 0;
+ $this->encoding = 'utf-8';
+ $this->extensions = [
+ 'php' => 'PHP',
+ 'inc' => 'PHP',
+ 'js' => 'JS',
+ 'css' => 'CSS',
+ ];
+ $this->sniffs = [];
+ $this->exclude = [];
+ $this->ignored = [];
+ $this->reportFile = null;
+ $this->generator = null;
+ $this->filter = null;
+ $this->bootstrap = [];
+ $this->basepath = null;
+ $this->reports = ['full' => null];
+ $this->reportWidth = 'auto';
+ $this->errorSeverity = 5;
+ $this->warningSeverity = 5;
+ $this->recordErrors = true;
+ $this->suffix = '';
+ $this->stdin = false;
+ $this->stdinContent = null;
+ $this->stdinPath = null;
+ $this->unknown = [];
+
+ $standard = self::getConfigData('default_standard');
+ if ($standard !== null) {
+ $this->standards = explode(',', $standard);
+ }
+
+ $reportFormat = self::getConfigData('report_format');
+ if ($reportFormat !== null) {
+ $this->reports = [$reportFormat => null];
+ }
+
+ $tabWidth = self::getConfigData('tab_width');
+ if ($tabWidth !== null) {
+ $this->tabWidth = (int) $tabWidth;
+ }
+
+ $encoding = self::getConfigData('encoding');
+ if ($encoding !== null) {
+ $this->encoding = strtolower($encoding);
+ }
+
+ $severity = self::getConfigData('severity');
+ if ($severity !== null) {
+ $this->errorSeverity = (int) $severity;
+ $this->warningSeverity = (int) $severity;
+ }
+
+ $severity = self::getConfigData('error_severity');
+ if ($severity !== null) {
+ $this->errorSeverity = (int) $severity;
+ }
+
+ $severity = self::getConfigData('warning_severity');
+ if ($severity !== null) {
+ $this->warningSeverity = (int) $severity;
+ }
+
+ $showWarnings = self::getConfigData('show_warnings');
+ if ($showWarnings !== null) {
+ $showWarnings = (bool) $showWarnings;
+ if ($showWarnings === false) {
+ $this->warningSeverity = 0;
+ }
+ }
+
+ $reportWidth = self::getConfigData('report_width');
+ if ($reportWidth !== null) {
+ $this->reportWidth = $reportWidth;
+ }
+
+ $showProgress = self::getConfigData('show_progress');
+ if ($showProgress !== null) {
+ $this->showProgress = (bool) $showProgress;
+ }
+
+ $quiet = self::getConfigData('quiet');
+ if ($quiet !== null) {
+ $this->quiet = (bool) $quiet;
+ }
+
+ $colors = self::getConfigData('colors');
+ if ($colors !== null) {
+ $this->colors = (bool) $colors;
+ }
+
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
+ $cache = self::getConfigData('cache');
+ if ($cache !== null) {
+ $this->cache = (bool) $cache;
+ }
+
+ $parallel = self::getConfigData('parallel');
+ if ($parallel !== null) {
+ $this->parallel = max((int) $parallel, 1);
+ }
+ }
+
+ }//end restoreDefaults()
+
+
+ /**
+ * Processes a short (-e) command line argument.
+ *
+ * @param string $arg The command line argument.
+ * @param int $pos The position of the argument on the command line.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function processShortArgument($arg, $pos)
+ {
+ switch ($arg) {
+ case 'h':
+ case '?':
+ ob_start();
+ $this->printUsage();
+ $output = ob_get_contents();
+ ob_end_clean();
+ throw new DeepExitException($output, 0);
+ case 'i' :
+ ob_start();
+ Util\Standards::printInstalledStandards();
+ $output = ob_get_contents();
+ ob_end_clean();
+ throw new DeepExitException($output, 0);
+ case 'v' :
+ if ($this->quiet === true) {
+ // Ignore when quiet mode is enabled.
+ break;
+ }
+
+ $this->verbosity++;
+ self::$overriddenDefaults['verbosity'] = true;
+ break;
+ case 'l' :
+ $this->local = true;
+ self::$overriddenDefaults['local'] = true;
+ break;
+ case 's' :
+ $this->showSources = true;
+ self::$overriddenDefaults['showSources'] = true;
+ break;
+ case 'a' :
+ $this->interactive = true;
+ self::$overriddenDefaults['interactive'] = true;
+ break;
+ case 'e':
+ $this->explain = true;
+ self::$overriddenDefaults['explain'] = true;
+ break;
+ case 'p' :
+ if ($this->quiet === true) {
+ // Ignore when quiet mode is enabled.
+ break;
+ }
+
+ $this->showProgress = true;
+ self::$overriddenDefaults['showProgress'] = true;
+ break;
+ case 'q' :
+ // Quiet mode disables a few other settings as well.
+ $this->quiet = true;
+ $this->showProgress = false;
+ $this->verbosity = 0;
+
+ self::$overriddenDefaults['quiet'] = true;
+ break;
+ case 'm' :
+ $this->recordErrors = false;
+ self::$overriddenDefaults['recordErrors'] = true;
+ break;
+ case 'd' :
+ $ini = explode('=', $this->cliArgs[($pos + 1)]);
+ $this->cliArgs[($pos + 1)] = '';
+ if (isset($ini[1]) === true) {
+ ini_set($ini[0], $ini[1]);
+ } else {
+ ini_set($ini[0], true);
+ }
+ break;
+ case 'n' :
+ if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
+ $this->warningSeverity = 0;
+ self::$overriddenDefaults['warningSeverity'] = true;
+ }
+ break;
+ case 'w' :
+ if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
+ $this->warningSeverity = $this->errorSeverity;
+ self::$overriddenDefaults['warningSeverity'] = true;
+ }
+ break;
+ default:
+ if ($this->dieOnUnknownArg === false) {
+ $unknown = $this->unknown;
+ $unknown[] = $arg;
+ $this->unknown = $unknown;
+ } else {
+ $this->processUnknownArgument('-'.$arg, $pos);
+ }
+ }//end switch
+
+ }//end processShortArgument()
+
+
+ /**
+ * Processes a long (--example) command line argument.
+ *
+ * @param string $arg The command line argument.
+ * @param int $pos The position of the argument on the command line.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function processLongArgument($arg, $pos)
+ {
+ switch ($arg) {
+ case 'help':
+ ob_start();
+ $this->printUsage();
+ $output = ob_get_contents();
+ ob_end_clean();
+ throw new DeepExitException($output, 0);
+ case 'version':
+ $output = 'PHP_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') ';
+ $output .= 'by Squiz (http://www.squiz.net)'.PHP_EOL;
+ throw new DeepExitException($output, 0);
+ case 'colors':
+ if (isset(self::$overriddenDefaults['colors']) === true) {
+ break;
+ }
+
+ $this->colors = true;
+ self::$overriddenDefaults['colors'] = true;
+ break;
+ case 'no-colors':
+ if (isset(self::$overriddenDefaults['colors']) === true) {
+ break;
+ }
+
+ $this->colors = false;
+ self::$overriddenDefaults['colors'] = true;
+ break;
+ case 'cache':
+ if (isset(self::$overriddenDefaults['cache']) === true) {
+ break;
+ }
+
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
+ $this->cache = true;
+ self::$overriddenDefaults['cache'] = true;
+ }
+ break;
+ case 'no-cache':
+ if (isset(self::$overriddenDefaults['cache']) === true) {
+ break;
+ }
+
+ $this->cache = false;
+ self::$overriddenDefaults['cache'] = true;
+ break;
+ case 'ignore-annotations':
+ if (isset(self::$overriddenDefaults['annotations']) === true) {
+ break;
+ }
+
+ $this->annotations = false;
+ self::$overriddenDefaults['annotations'] = true;
+ break;
+ case 'config-set':
+ if (isset($this->cliArgs[($pos + 1)]) === false
+ || isset($this->cliArgs[($pos + 2)]) === false
+ ) {
+ $error = 'ERROR: Setting a config option requires a name and value'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $key = $this->cliArgs[($pos + 1)];
+ $value = $this->cliArgs[($pos + 2)];
+ $current = self::getConfigData($key);
+
+ try {
+ $this->setConfigData($key, $value);
+ } catch (\Exception $e) {
+ throw new DeepExitException($e->getMessage().PHP_EOL, 3);
+ }
+
+ $output = 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
+
+ if ($current === null) {
+ $output .= "Config value \"$key\" added successfully".PHP_EOL;
+ } else {
+ $output .= "Config value \"$key\" updated successfully; old value was \"$current\"".PHP_EOL;
+ }
+ throw new DeepExitException($output, 0);
+ case 'config-delete':
+ if (isset($this->cliArgs[($pos + 1)]) === false) {
+ $error = 'ERROR: Deleting a config option requires the name of the option'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $output = 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
+
+ $key = $this->cliArgs[($pos + 1)];
+ $current = self::getConfigData($key);
+ if ($current === null) {
+ $output .= "Config value \"$key\" has not been set".PHP_EOL;
+ } else {
+ try {
+ $this->setConfigData($key, null);
+ } catch (\Exception $e) {
+ throw new DeepExitException($e->getMessage().PHP_EOL, 3);
+ }
+
+ $output .= "Config value \"$key\" removed successfully; old value was \"$current\"".PHP_EOL;
+ }
+ throw new DeepExitException($output, 0);
+ case 'config-show':
+ ob_start();
+ $data = self::getAllConfigData();
+ echo 'Using config file: '.self::$configDataFile.PHP_EOL.PHP_EOL;
+ $this->printConfigData($data);
+ $output = ob_get_contents();
+ ob_end_clean();
+ throw new DeepExitException($output, 0);
+ case 'runtime-set':
+ if (isset($this->cliArgs[($pos + 1)]) === false
+ || isset($this->cliArgs[($pos + 2)]) === false
+ ) {
+ $error = 'ERROR: Setting a runtime config option requires a name and value'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $key = $this->cliArgs[($pos + 1)];
+ $value = $this->cliArgs[($pos + 2)];
+ $this->cliArgs[($pos + 1)] = '';
+ $this->cliArgs[($pos + 2)] = '';
+ self::setConfigData($key, $value, true);
+ if (isset(self::$overriddenDefaults['runtime-set']) === false) {
+ self::$overriddenDefaults['runtime-set'] = [];
+ }
+
+ self::$overriddenDefaults['runtime-set'][$key] = true;
+ break;
+ default:
+ if (substr($arg, 0, 7) === 'sniffs=') {
+ if (isset(self::$overriddenDefaults['sniffs']) === true) {
+ break;
+ }
+
+ $sniffs = explode(',', substr($arg, 7));
+ foreach ($sniffs as $sniff) {
+ if (substr_count($sniff, '.') !== 2) {
+ $error = 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ }
+
+ $this->sniffs = $sniffs;
+ self::$overriddenDefaults['sniffs'] = true;
+ } else if (substr($arg, 0, 8) === 'exclude=') {
+ if (isset(self::$overriddenDefaults['exclude']) === true) {
+ break;
+ }
+
+ $sniffs = explode(',', substr($arg, 8));
+ foreach ($sniffs as $sniff) {
+ if (substr_count($sniff, '.') !== 2) {
+ $error = 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ }
+
+ $this->exclude = $sniffs;
+ self::$overriddenDefaults['exclude'] = true;
+ } else if (defined('PHP_CODESNIFFER_IN_TESTS') === false
+ && substr($arg, 0, 6) === 'cache='
+ ) {
+ if ((isset(self::$overriddenDefaults['cache']) === true
+ && $this->cache === false)
+ || isset(self::$overriddenDefaults['cacheFile']) === true
+ ) {
+ break;
+ }
+
+ // Turn caching on.
+ $this->cache = true;
+ self::$overriddenDefaults['cache'] = true;
+
+ $this->cacheFile = Util\Common::realpath(substr($arg, 6));
+
+ // It may not exist and return false instead.
+ if ($this->cacheFile === false) {
+ $this->cacheFile = substr($arg, 6);
+
+ $dir = dirname($this->cacheFile);
+ if (is_dir($dir) === false) {
+ $error = 'ERROR: The specified cache file path "'.$this->cacheFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ if ($dir === '.') {
+ // Passed cache file is a file in the current directory.
+ $this->cacheFile = getcwd().'/'.basename($this->cacheFile);
+ } else {
+ if ($dir[0] === '/') {
+ // An absolute path.
+ $dir = Util\Common::realpath($dir);
+ } else {
+ $dir = Util\Common::realpath(getcwd().'/'.$dir);
+ }
+
+ if ($dir !== false) {
+ // Cache file path is relative.
+ $this->cacheFile = $dir.'/'.basename($this->cacheFile);
+ }
+ }
+ }//end if
+
+ self::$overriddenDefaults['cacheFile'] = true;
+
+ if (is_dir($this->cacheFile) === true) {
+ $error = 'ERROR: The specified cache file path "'.$this->cacheFile.'" is a directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ } else if (substr($arg, 0, 10) === 'bootstrap=') {
+ $files = explode(',', substr($arg, 10));
+ $bootstrap = [];
+ foreach ($files as $file) {
+ $path = Util\Common::realpath($file);
+ if ($path === false) {
+ $error = 'ERROR: The specified bootstrap file "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $bootstrap[] = $path;
+ }
+
+ $this->bootstrap = array_merge($this->bootstrap, $bootstrap);
+ self::$overriddenDefaults['bootstrap'] = true;
+ } else if (substr($arg, 0, 10) === 'file-list=') {
+ $fileList = substr($arg, 10);
+ $path = Util\Common::realpath($fileList);
+ if ($path === false) {
+ $error = 'ERROR: The specified file list "'.$fileList.'" does not exist'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $files = file($path);
+ foreach ($files as $inputFile) {
+ $inputFile = trim($inputFile);
+
+ // Skip empty lines.
+ if ($inputFile === '') {
+ continue;
+ }
+
+ $this->processFilePath($inputFile);
+ }
+ } else if (substr($arg, 0, 11) === 'stdin-path=') {
+ if (isset(self::$overriddenDefaults['stdinPath']) === true) {
+ break;
+ }
+
+ $this->stdinPath = Util\Common::realpath(substr($arg, 11));
+
+ // It may not exist and return false instead, so use whatever they gave us.
+ if ($this->stdinPath === false) {
+ $this->stdinPath = trim(substr($arg, 11));
+ }
+
+ self::$overriddenDefaults['stdinPath'] = true;
+ } else if (PHP_CODESNIFFER_CBF === false && substr($arg, 0, 12) === 'report-file=') {
+ if (isset(self::$overriddenDefaults['reportFile']) === true) {
+ break;
+ }
+
+ $this->reportFile = Util\Common::realpath(substr($arg, 12));
+
+ // It may not exist and return false instead.
+ if ($this->reportFile === false) {
+ $this->reportFile = substr($arg, 12);
+
+ $dir = Util\Common::realpath(dirname($this->reportFile));
+ if (is_dir($dir) === false) {
+ $error = 'ERROR: The specified report file path "'.$this->reportFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $this->reportFile = $dir.'/'.basename($this->reportFile);
+ }//end if
+
+ self::$overriddenDefaults['reportFile'] = true;
+
+ if (is_dir($this->reportFile) === true) {
+ $error = 'ERROR: The specified report file path "'.$this->reportFile.'" is a directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ } else if (substr($arg, 0, 13) === 'report-width=') {
+ if (isset(self::$overriddenDefaults['reportWidth']) === true) {
+ break;
+ }
+
+ $this->reportWidth = substr($arg, 13);
+ self::$overriddenDefaults['reportWidth'] = true;
+ } else if (substr($arg, 0, 9) === 'basepath=') {
+ if (isset(self::$overriddenDefaults['basepath']) === true) {
+ break;
+ }
+
+ self::$overriddenDefaults['basepath'] = true;
+
+ if (substr($arg, 9) === '') {
+ $this->basepath = null;
+ break;
+ }
+
+ $this->basepath = Util\Common::realpath(substr($arg, 9));
+
+ // It may not exist and return false instead.
+ if ($this->basepath === false) {
+ $this->basepath = substr($arg, 9);
+ }
+
+ if (is_dir($this->basepath) === false) {
+ $error = 'ERROR: The specified basepath "'.$this->basepath.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ } else if ((substr($arg, 0, 7) === 'report=' || substr($arg, 0, 7) === 'report-')) {
+ $reports = [];
+
+ if ($arg[6] === '-') {
+ // This is a report with file output.
+ $split = strpos($arg, '=');
+ if ($split === false) {
+ $report = substr($arg, 7);
+ $output = null;
+ } else {
+ $report = substr($arg, 7, ($split - 7));
+ $output = substr($arg, ($split + 1));
+ if ($output === false) {
+ $output = null;
+ } else {
+ $dir = Util\Common::realpath(dirname($output));
+ if (is_dir($dir) === false) {
+ $error = 'ERROR: The specified '.$report.' report file path "'.$output.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $output = $dir.'/'.basename($output);
+
+ if (is_dir($output) === true) {
+ $error = 'ERROR: The specified '.$report.' report file path "'.$output.'" is a directory'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+ }//end if
+ }//end if
+
+ $reports[$report] = $output;
+ } else {
+ // This is a single report.
+ if (isset(self::$overriddenDefaults['reports']) === true) {
+ break;
+ }
+
+ $reportNames = explode(',', substr($arg, 7));
+ foreach ($reportNames as $report) {
+ $reports[$report] = null;
+ }
+ }//end if
+
+ // Remove the default value so the CLI value overrides it.
+ if (isset(self::$overriddenDefaults['reports']) === false) {
+ $this->reports = $reports;
+ } else {
+ $this->reports = array_merge($this->reports, $reports);
+ }
+
+ self::$overriddenDefaults['reports'] = true;
+ } else if (substr($arg, 0, 7) === 'filter=') {
+ if (isset(self::$overriddenDefaults['filter']) === true) {
+ break;
+ }
+
+ $this->filter = substr($arg, 7);
+ self::$overriddenDefaults['filter'] = true;
+ } else if (substr($arg, 0, 9) === 'standard=') {
+ $standards = trim(substr($arg, 9));
+ if ($standards !== '') {
+ $this->standards = explode(',', $standards);
+ }
+
+ self::$overriddenDefaults['standards'] = true;
+ } else if (substr($arg, 0, 11) === 'extensions=') {
+ if (isset(self::$overriddenDefaults['extensions']) === true) {
+ break;
+ }
+
+ $extensions = explode(',', substr($arg, 11));
+ $newExtensions = [];
+ foreach ($extensions as $ext) {
+ $slash = strpos($ext, '/');
+ if ($slash !== false) {
+ // They specified the tokenizer too.
+ list($ext, $tokenizer) = explode('/', $ext);
+ $newExtensions[$ext] = strtoupper($tokenizer);
+ continue;
+ }
+
+ if (isset($this->extensions[$ext]) === true) {
+ $newExtensions[$ext] = $this->extensions[$ext];
+ } else {
+ $newExtensions[$ext] = 'PHP';
+ }
+ }
+
+ $this->extensions = $newExtensions;
+ self::$overriddenDefaults['extensions'] = true;
+ } else if (substr($arg, 0, 7) === 'suffix=') {
+ if (isset(self::$overriddenDefaults['suffix']) === true) {
+ break;
+ }
+
+ $this->suffix = substr($arg, 7);
+ self::$overriddenDefaults['suffix'] = true;
+ } else if (substr($arg, 0, 9) === 'parallel=') {
+ if (isset(self::$overriddenDefaults['parallel']) === true) {
+ break;
+ }
+
+ $this->parallel = max((int) substr($arg, 9), 1);
+ self::$overriddenDefaults['parallel'] = true;
+ } else if (substr($arg, 0, 9) === 'severity=') {
+ $this->errorSeverity = (int) substr($arg, 9);
+ $this->warningSeverity = $this->errorSeverity;
+ if (isset(self::$overriddenDefaults['errorSeverity']) === false) {
+ self::$overriddenDefaults['errorSeverity'] = true;
+ }
+
+ if (isset(self::$overriddenDefaults['warningSeverity']) === false) {
+ self::$overriddenDefaults['warningSeverity'] = true;
+ }
+ } else if (substr($arg, 0, 15) === 'error-severity=') {
+ if (isset(self::$overriddenDefaults['errorSeverity']) === true) {
+ break;
+ }
+
+ $this->errorSeverity = (int) substr($arg, 15);
+ self::$overriddenDefaults['errorSeverity'] = true;
+ } else if (substr($arg, 0, 17) === 'warning-severity=') {
+ if (isset(self::$overriddenDefaults['warningSeverity']) === true) {
+ break;
+ }
+
+ $this->warningSeverity = (int) substr($arg, 17);
+ self::$overriddenDefaults['warningSeverity'] = true;
+ } else if (substr($arg, 0, 7) === 'ignore=') {
+ if (isset(self::$overriddenDefaults['ignored']) === true) {
+ break;
+ }
+
+ // Split the ignore string on commas, unless the comma is escaped
+ // using 1 or 3 slashes (\, or \\\,).
+ $patterns = preg_split(
+ '/(?<=(?ignored = $ignored;
+ self::$overriddenDefaults['ignored'] = true;
+ } else if (substr($arg, 0, 10) === 'generator='
+ && PHP_CODESNIFFER_CBF === false
+ ) {
+ if (isset(self::$overriddenDefaults['generator']) === true) {
+ break;
+ }
+
+ $this->generator = substr($arg, 10);
+ self::$overriddenDefaults['generator'] = true;
+ } else if (substr($arg, 0, 9) === 'encoding=') {
+ if (isset(self::$overriddenDefaults['encoding']) === true) {
+ break;
+ }
+
+ $this->encoding = strtolower(substr($arg, 9));
+ self::$overriddenDefaults['encoding'] = true;
+ } else if (substr($arg, 0, 10) === 'tab-width=') {
+ if (isset(self::$overriddenDefaults['tabWidth']) === true) {
+ break;
+ }
+
+ $this->tabWidth = (int) substr($arg, 10);
+ self::$overriddenDefaults['tabWidth'] = true;
+ } else {
+ if ($this->dieOnUnknownArg === false) {
+ $eqPos = strpos($arg, '=');
+ try {
+ if ($eqPos === false) {
+ $this->values[$arg] = $arg;
+ } else {
+ $value = substr($arg, ($eqPos + 1));
+ $arg = substr($arg, 0, $eqPos);
+ $this->values[$arg] = $value;
+ }
+ } catch (RuntimeException $e) {
+ // Value is not valid, so just ignore it.
+ }
+ } else {
+ $this->processUnknownArgument('--'.$arg, $pos);
+ }
+ }//end if
+ break;
+ }//end switch
+
+ }//end processLongArgument()
+
+
+ /**
+ * Processes an unknown command line argument.
+ *
+ * Assumes all unknown arguments are files and folders to check.
+ *
+ * @param string $arg The command line argument.
+ * @param int $pos The position of the argument on the command line.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function processUnknownArgument($arg, $pos)
+ {
+ // We don't know about any additional switches; just files.
+ if ($arg[0] === '-') {
+ if ($this->dieOnUnknownArg === false) {
+ return;
+ }
+
+ $error = "ERROR: option \"$arg\" not known".PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ $this->processFilePath($arg);
+
+ }//end processUnknownArgument()
+
+
+ /**
+ * Processes a file path and add it to the file list.
+ *
+ * @param string $path The path to the file to add.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function processFilePath($path)
+ {
+ // If we are processing STDIN, don't record any files to check.
+ if ($this->stdin === true) {
+ return;
+ }
+
+ $file = Util\Common::realpath($path);
+ if (file_exists($file) === false) {
+ if ($this->dieOnUnknownArg === false) {
+ return;
+ }
+
+ $error = 'ERROR: The file "'.$path.'" does not exist.'.PHP_EOL.PHP_EOL;
+ $error .= $this->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ } else {
+ // Can't modify the files array directly because it's not a real
+ // class member, so need to use this little get/modify/set trick.
+ $files = $this->files;
+ $files[] = $file;
+ $this->files = $files;
+ self::$overriddenDefaults['files'] = true;
+ }
+
+ }//end processFilePath()
+
+
+ /**
+ * Prints out the usage information for this script.
+ *
+ * @return void
+ */
+ public function printUsage()
+ {
+ echo PHP_EOL;
+
+ if (PHP_CODESNIFFER_CBF === true) {
+ $this->printPHPCBFUsage();
+ } else {
+ $this->printPHPCSUsage();
+ }
+
+ echo PHP_EOL;
+
+ }//end printUsage()
+
+
+ /**
+ * Prints out the short usage information for this script.
+ *
+ * @param bool $return If TRUE, the usage string is returned
+ * instead of output to screen.
+ *
+ * @return string|void
+ */
+ public function printShortUsage($return=false)
+ {
+ if (PHP_CODESNIFFER_CBF === true) {
+ $usage = 'Run "phpcbf --help" for usage information';
+ } else {
+ $usage = 'Run "phpcs --help" for usage information';
+ }
+
+ $usage .= PHP_EOL.PHP_EOL;
+
+ if ($return === true) {
+ return $usage;
+ }
+
+ echo $usage;
+
+ }//end printShortUsage()
+
+
+ /**
+ * Prints out the usage information for PHPCS.
+ *
+ * @return void
+ */
+ public function printPHPCSUsage()
+ {
+ echo 'Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors]'.PHP_EOL;
+ echo ' [--cache[=]] [--no-cache] [--tab-width=]'.PHP_EOL;
+ echo ' [--report=] [--report-file=] [--report-=]'.PHP_EOL;
+ echo ' [--report-width=] [--basepath=] [--bootstrap=]'.PHP_EOL;
+ echo ' [--severity=] [--error-severity=] [--warning-severity=]'.PHP_EOL;
+ echo ' [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show]'.PHP_EOL;
+ echo ' [--standard=] [--sniffs=] [--exclude=]'.PHP_EOL;
+ echo ' [--encoding=] [--parallel=] [--generator=]'.PHP_EOL;
+ echo ' [--extensions=] [--ignore=] [--ignore-annotations]'.PHP_EOL;
+ echo ' [--stdin-path=] [--file-list=] [--filter=] - ...'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' - Check STDIN instead of local files and directories'.PHP_EOL;
+ echo ' -n Do not print warnings (shortcut for --warning-severity=0)'.PHP_EOL;
+ echo ' -w Print both warnings and errors (this is the default)'.PHP_EOL;
+ echo ' -l Local directory only, no recursion'.PHP_EOL;
+ echo ' -s Show sniff codes in all reports'.PHP_EOL;
+ echo ' -a Run interactively'.PHP_EOL;
+ echo ' -e Explain a standard by showing the sniffs it includes'.PHP_EOL;
+ echo ' -p Show progress of the run'.PHP_EOL;
+ echo ' -q Quiet mode; disables progress and verbose output'.PHP_EOL;
+ echo ' -m Stop error messages from being recorded'.PHP_EOL;
+ echo ' (saves a lot of memory, but stops many reports from being used)'.PHP_EOL;
+ echo ' -v Print processed files'.PHP_EOL;
+ echo ' -vv Print ruleset and token output'.PHP_EOL;
+ echo ' -vvv Print sniff processing information'.PHP_EOL;
+ echo ' -i Show a list of installed coding standards'.PHP_EOL;
+ echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' --help Print this help message'.PHP_EOL;
+ echo ' --version Print version information'.PHP_EOL;
+ echo ' --colors Use colors in output'.PHP_EOL;
+ echo ' --no-colors Do not use colors in output (this is the default)'.PHP_EOL;
+ echo ' --cache Cache results between runs'.PHP_EOL;
+ echo ' --no-cache Do not cache results between runs (this is the default)'.PHP_EOL;
+ echo ' --ignore-annotations Ignore all phpcs: annotations in code comments'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' Use a specific file for caching (uses a temporary file by default)'.PHP_EOL;
+ echo ' A path to strip from the front of file paths inside reports'.PHP_EOL;
+ echo ' A comma separated list of files to run before processing begins'.PHP_EOL;
+ echo ' The encoding of the files being checked (default is utf-8)'.PHP_EOL;
+ echo ' A comma separated list of file extensions to check'.PHP_EOL;
+ echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
+ echo ' e.g., module/php,es/js'.PHP_EOL;
+ echo ' One or more files and/or directories to check'.PHP_EOL;
+ echo ' A file containing a list of files and/or directories to check (one per line)'.PHP_EOL;
+ echo ' Use either the "gitmodified" or "gitstaged" filter,'.PHP_EOL;
+ echo ' or specify the path to a custom filter class'.PHP_EOL;
+ echo ' Use either the "HTML", "Markdown" or "Text" generator'.PHP_EOL;
+ echo ' (forces documentation generation instead of checking)'.PHP_EOL;
+ echo ' A comma separated list of patterns to ignore files and directories'.PHP_EOL;
+ echo ' How many files should be checked simultaneously (default is 1)'.PHP_EOL;
+ echo ' Print either the "full", "xml", "checkstyle", "csv"'.PHP_EOL;
+ echo ' "json", "junit", "emacs", "source", "summary", "diff"'.PHP_EOL;
+ echo ' "svnblame", "gitblame", "hgblame" or "notifysend" report,'.PHP_EOL;
+ echo ' or specify the path to a custom report class'.PHP_EOL;
+ echo ' (the "full" report is printed by default)'.PHP_EOL;
+ echo ' Write the report to the specified file path'.PHP_EOL;
+ echo ' How many columns wide screen reports should be printed'.PHP_EOL;
+ echo ' or set to "auto" to use current screen width, where supported'.PHP_EOL;
+ echo ' The minimum severity required to display an error or warning'.PHP_EOL;
+ echo ' A comma separated list of sniff codes to include or exclude from checking'.PHP_EOL;
+ echo ' (all sniffs must be part of the specified standard)'.PHP_EOL;
+ echo ' The name or path of the coding standard to use'.PHP_EOL;
+ echo ' If processing STDIN, the file path that STDIN will be processed as'.PHP_EOL;
+ echo ' The number of spaces each tab represents'.PHP_EOL;
+
+ }//end printPHPCSUsage()
+
+
+ /**
+ * Prints out the usage information for PHPCBF.
+ *
+ * @return void
+ */
+ public function printPHPCBFUsage()
+ {
+ echo 'Usage: phpcbf [-nwli] [-d key[=value]] [--ignore-annotations] [--bootstrap=]'.PHP_EOL;
+ echo ' [--standard=] [--sniffs=] [--exclude=] [--suffix=]'.PHP_EOL;
+ echo ' [--severity=] [--error-severity=] [--warning-severity=]'.PHP_EOL;
+ echo ' [--tab-width=] [--encoding=] [--parallel=]'.PHP_EOL;
+ echo ' [--basepath=] [--extensions=] [--ignore=]'.PHP_EOL;
+ echo ' [--stdin-path=] [--file-list=] [--filter=] - ...'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' - Fix STDIN instead of local files and directories'.PHP_EOL;
+ echo ' -n Do not fix warnings (shortcut for --warning-severity=0)'.PHP_EOL;
+ echo ' -w Fix both warnings and errors (on by default)'.PHP_EOL;
+ echo ' -l Local directory only, no recursion'.PHP_EOL;
+ echo ' -p Show progress of the run'.PHP_EOL;
+ echo ' -q Quiet mode; disables progress and verbose output'.PHP_EOL;
+ echo ' -v Print processed files'.PHP_EOL;
+ echo ' -vv Print ruleset and token output'.PHP_EOL;
+ echo ' -vvv Print sniff processing information'.PHP_EOL;
+ echo ' -i Show a list of installed coding standards'.PHP_EOL;
+ echo ' -d Set the [key] php.ini value to [value] or [true] if value is omitted'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' --help Print this help message'.PHP_EOL;
+ echo ' --version Print version information'.PHP_EOL;
+ echo ' --ignore-annotations Ignore all phpcs: annotations in code comments'.PHP_EOL;
+ echo PHP_EOL;
+ echo ' A path to strip from the front of file paths inside reports'.PHP_EOL;
+ echo ' A comma separated list of files to run before processing begins'.PHP_EOL;
+ echo ' The encoding of the files being fixed (default is utf-8)'.PHP_EOL;
+ echo ' A comma separated list of file extensions to fix'.PHP_EOL;
+ echo ' The type of the file can be specified using: ext/type'.PHP_EOL;
+ echo ' e.g., module/php,es/js'.PHP_EOL;
+ echo ' One or more files and/or directories to fix'.PHP_EOL;
+ echo ' A file containing a list of files and/or directories to fix (one per line)'.PHP_EOL;
+ echo ' Use either the "gitmodified" or "gitstaged" filter,'.PHP_EOL;
+ echo ' or specify the path to a custom filter class'.PHP_EOL;
+ echo ' A comma separated list of patterns to ignore files and directories'.PHP_EOL;
+ echo ' How many files should be fixed simultaneously (default is 1)'.PHP_EOL;
+ echo ' The minimum severity required to fix an error or warning'.PHP_EOL;
+ echo ' A comma separated list of sniff codes to include or exclude from fixing'.PHP_EOL;
+ echo ' (all sniffs must be part of the specified standard)'.PHP_EOL;
+ echo ' The name or path of the coding standard to use'.PHP_EOL;
+ echo ' If processing STDIN, the file path that STDIN will be processed as'.PHP_EOL;
+ echo ' Write modified files to a filename using this suffix'.PHP_EOL;
+ echo ' ("diff" and "patch" are not used in this mode)'.PHP_EOL;
+ echo ' The number of spaces each tab represents'.PHP_EOL;
+
+ }//end printPHPCBFUsage()
+
+
+ /**
+ * Get a single config value.
+ *
+ * @param string $key The name of the config value.
+ *
+ * @return string|null
+ * @see setConfigData()
+ * @see getAllConfigData()
+ */
+ public static function getConfigData($key)
+ {
+ $phpCodeSnifferConfig = self::getAllConfigData();
+
+ if ($phpCodeSnifferConfig === null) {
+ return null;
+ }
+
+ if (isset($phpCodeSnifferConfig[$key]) === false) {
+ return null;
+ }
+
+ return $phpCodeSnifferConfig[$key];
+
+ }//end getConfigData()
+
+
+ /**
+ * Get the path to an executable utility.
+ *
+ * @param string $name The name of the executable utility.
+ *
+ * @return string|null
+ * @see getConfigData()
+ */
+ public static function getExecutablePath($name)
+ {
+ $data = self::getConfigData($name.'_path');
+ if ($data !== null) {
+ return $data;
+ }
+
+ if ($name === "php") {
+ // For php, we know the executable path. There's no need to look it up.
+ return PHP_BINARY;
+ }
+
+ if (array_key_exists($name, self::$executablePaths) === true) {
+ return self::$executablePaths[$name];
+ }
+
+ if (stripos(PHP_OS, 'WIN') === 0) {
+ $cmd = 'where '.escapeshellarg($name).' 2> nul';
+ } else {
+ $cmd = 'which '.escapeshellarg($name).' 2> /dev/null';
+ }
+
+ $result = exec($cmd, $output, $retVal);
+ if ($retVal !== 0) {
+ $result = null;
+ }
+
+ self::$executablePaths[$name] = $result;
+ return $result;
+
+ }//end getExecutablePath()
+
+
+ /**
+ * Set a single config value.
+ *
+ * @param string $key The name of the config value.
+ * @param string|null $value The value to set. If null, the config
+ * entry is deleted, reverting it to the
+ * default value.
+ * @param boolean $temp Set this config data temporarily for this
+ * script run. This will not write the config
+ * data to the config file.
+ *
+ * @return bool
+ * @see getConfigData()
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file can not be written.
+ */
+ public static function setConfigData($key, $value, $temp=false)
+ {
+ if (isset(self::$overriddenDefaults['runtime-set']) === true
+ && isset(self::$overriddenDefaults['runtime-set'][$key]) === true
+ ) {
+ return false;
+ }
+
+ if ($temp === false) {
+ $path = '';
+ if (is_callable('\Phar::running') === true) {
+ $path = \Phar::running(false);
+ }
+
+ if ($path !== '') {
+ $configFile = dirname($path).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
+ } else {
+ $configFile = dirname(__DIR__).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
+ if (is_file($configFile) === false
+ && strpos('@data_dir@', '@data_dir') === false
+ ) {
+ // If data_dir was replaced, this is a PEAR install and we can
+ // use the PEAR data dir to store the conf file.
+ $configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf';
+ }
+ }
+
+ if (is_file($configFile) === true
+ && is_writable($configFile) === false
+ ) {
+ $error = 'ERROR: Config file '.$configFile.' is not writable'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+ }//end if
+
+ $phpCodeSnifferConfig = self::getAllConfigData();
+
+ if ($value === null) {
+ if (isset($phpCodeSnifferConfig[$key]) === true) {
+ unset($phpCodeSnifferConfig[$key]);
+ }
+ } else {
+ $phpCodeSnifferConfig[$key] = $value;
+ }
+
+ if ($temp === false) {
+ $output = '<'.'?php'."\n".' $phpCodeSnifferConfig = ';
+ $output .= var_export($phpCodeSnifferConfig, true);
+ $output .= ";\n?".'>';
+
+ if (file_put_contents($configFile, $output) === false) {
+ $error = 'ERROR: Config file '.$configFile.' could not be written'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ self::$configDataFile = $configFile;
+ }
+
+ self::$configData = $phpCodeSnifferConfig;
+
+ // If the installed paths are being set, make sure all known
+ // standards paths are added to the autoloader.
+ if ($key === 'installed_paths') {
+ $installedStandards = Util\Standards::getInstalledStandardDetails();
+ foreach ($installedStandards as $name => $details) {
+ Autoload::addSearchPath($details['path'], $details['namespace']);
+ }
+ }
+
+ return true;
+
+ }//end setConfigData()
+
+
+ /**
+ * Get all config data.
+ *
+ * @return array
+ * @see getConfigData()
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file could not be read.
+ */
+ public static function getAllConfigData()
+ {
+ if (self::$configData !== null) {
+ return self::$configData;
+ }
+
+ $path = '';
+ if (is_callable('\Phar::running') === true) {
+ $path = \Phar::running(false);
+ }
+
+ if ($path !== '') {
+ $configFile = dirname($path).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
+ } else {
+ $configFile = dirname(__DIR__).DIRECTORY_SEPARATOR.'CodeSniffer.conf';
+ if (is_file($configFile) === false
+ && strpos('@data_dir@', '@data_dir') === false
+ ) {
+ $configFile = '@data_dir@/PHP_CodeSniffer/CodeSniffer.conf';
+ }
+ }
+
+ if (is_file($configFile) === false) {
+ self::$configData = [];
+ return [];
+ }
+
+ if (Common::isReadable($configFile) === false) {
+ $error = 'ERROR: Config file '.$configFile.' is not readable'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ include $configFile;
+ self::$configDataFile = $configFile;
+ self::$configData = $phpCodeSnifferConfig;
+ return self::$configData;
+
+ }//end getAllConfigData()
+
+
+ /**
+ * Prints out the gathered config data.
+ *
+ * @param array $data The config data to print.
+ *
+ * @return void
+ */
+ public function printConfigData($data)
+ {
+ $max = 0;
+ $keys = array_keys($data);
+ foreach ($keys as $key) {
+ $len = strlen($key);
+ if (strlen($key) > $max) {
+ $max = $len;
+ }
+ }
+
+ if ($max === 0) {
+ return;
+ }
+
+ $max += 2;
+ ksort($data);
+ foreach ($data as $name => $value) {
+ echo str_pad($name.': ', $max).$value.PHP_EOL;
+ }
+
+ }//end printConfigData()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Exceptions/DeepExitException.php b/vendor/squizlabs/php_codesniffer/src/Exceptions/DeepExitException.php
new file mode 100644
index 00000000..b1440944
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Exceptions/DeepExitException.php
@@ -0,0 +1,18 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Exceptions;
+
+class DeepExitException extends \Exception
+{
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Exceptions/RuntimeException.php b/vendor/squizlabs/php_codesniffer/src/Exceptions/RuntimeException.php
new file mode 100644
index 00000000..093bf13d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Exceptions/RuntimeException.php
@@ -0,0 +1,15 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Exceptions;
+
+class RuntimeException extends \RuntimeException
+{
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Exceptions/TokenizerException.php b/vendor/squizlabs/php_codesniffer/src/Exceptions/TokenizerException.php
new file mode 100644
index 00000000..ceba00cc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Exceptions/TokenizerException.php
@@ -0,0 +1,15 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Exceptions;
+
+class TokenizerException extends \Exception
+{
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Files/DummyFile.php b/vendor/squizlabs/php_codesniffer/src/Files/DummyFile.php
new file mode 100644
index 00000000..60143030
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/DummyFile.php
@@ -0,0 +1,82 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Files;
+
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+
+class DummyFile extends File
+{
+
+
+ /**
+ * Creates a DummyFile object and sets the content.
+ *
+ * @param string $content The content of the file.
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ *
+ * @return void
+ */
+ public function __construct($content, Ruleset $ruleset, Config $config)
+ {
+ $this->setContent($content);
+
+ // See if a filename was defined in the content.
+ // This is done by including: phpcs_input_file: [file path]
+ // as the first line of content.
+ $path = 'STDIN';
+ if ($content !== '') {
+ if (substr($content, 0, 17) === 'phpcs_input_file:') {
+ $eolPos = strpos($content, $this->eolChar);
+ $filename = trim(substr($content, 17, ($eolPos - 17)));
+ $content = substr($content, ($eolPos + strlen($this->eolChar)));
+ $path = $filename;
+
+ $this->setContent($content);
+ }
+ }
+
+ // The CLI arg overrides anything passed in the content.
+ if ($config->stdinPath !== null) {
+ $path = $config->stdinPath;
+ }
+
+ parent::__construct($path, $ruleset, $config);
+
+ }//end __construct()
+
+
+ /**
+ * Set the error, warning, and fixable counts for the file.
+ *
+ * @param int $errorCount The number of errors found.
+ * @param int $warningCount The number of warnings found.
+ * @param int $fixableCount The number of fixable errors found.
+ * @param int $fixedCount The number of errors that were fixed.
+ *
+ * @return void
+ */
+ public function setErrorCounts($errorCount, $warningCount, $fixableCount, $fixedCount)
+ {
+ $this->errorCount = $errorCount;
+ $this->warningCount = $warningCount;
+ $this->fixableCount = $fixableCount;
+ $this->fixedCount = $fixedCount;
+
+ }//end setErrorCounts()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Files/File.php b/vendor/squizlabs/php_codesniffer/src/Files/File.php
new file mode 100644
index 00000000..a15af762
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/File.php
@@ -0,0 +1,2829 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Files;
+
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Fixer;
+use PHP_CodeSniffer\Util;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Exceptions\TokenizerException;
+
+class File
+{
+
+ /**
+ * The absolute path to the file associated with this object.
+ *
+ * @var string
+ */
+ public $path = '';
+
+ /**
+ * The content of the file.
+ *
+ * @var string
+ */
+ protected $content = '';
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ public $config = null;
+
+ /**
+ * The ruleset used for the run.
+ *
+ * @var \PHP_CodeSniffer\Ruleset
+ */
+ public $ruleset = null;
+
+ /**
+ * If TRUE, the entire file is being ignored.
+ *
+ * @var boolean
+ */
+ public $ignored = false;
+
+ /**
+ * The EOL character this file uses.
+ *
+ * @var string
+ */
+ public $eolChar = '';
+
+ /**
+ * The Fixer object to control fixing errors.
+ *
+ * @var \PHP_CodeSniffer\Fixer
+ */
+ public $fixer = null;
+
+ /**
+ * The tokenizer being used for this file.
+ *
+ * @var \PHP_CodeSniffer\Tokenizers\Tokenizer
+ */
+ public $tokenizer = null;
+
+ /**
+ * The name of the tokenizer being used for this file.
+ *
+ * @var string
+ */
+ public $tokenizerType = 'PHP';
+
+ /**
+ * Was the file loaded from cache?
+ *
+ * If TRUE, the file was loaded from a local cache.
+ * If FALSE, the file was tokenized and processed fully.
+ *
+ * @var boolean
+ */
+ public $fromCache = false;
+
+ /**
+ * The number of tokens in this file.
+ *
+ * Stored here to save calling count() everywhere.
+ *
+ * @var integer
+ */
+ public $numTokens = 0;
+
+ /**
+ * The tokens stack map.
+ *
+ * @var array
+ */
+ protected $tokens = [];
+
+ /**
+ * The errors raised from sniffs.
+ *
+ * @var array
+ * @see getErrors()
+ */
+ protected $errors = [];
+
+ /**
+ * The warnings raised from sniffs.
+ *
+ * @var array
+ * @see getWarnings()
+ */
+ protected $warnings = [];
+
+ /**
+ * The metrics recorded by sniffs.
+ *
+ * @var array
+ * @see getMetrics()
+ */
+ protected $metrics = [];
+
+ /**
+ * The metrics recorded for each token.
+ *
+ * Stops the same metric being recorded for the same token twice.
+ *
+ * @var array
+ * @see getMetrics()
+ */
+ private $metricTokens = [];
+
+ /**
+ * The total number of errors raised.
+ *
+ * @var integer
+ */
+ protected $errorCount = 0;
+
+ /**
+ * The total number of warnings raised.
+ *
+ * @var integer
+ */
+ protected $warningCount = 0;
+
+ /**
+ * The total number of errors and warnings that can be fixed.
+ *
+ * @var integer
+ */
+ protected $fixableCount = 0;
+
+ /**
+ * The total number of errors and warnings that were fixed.
+ *
+ * @var integer
+ */
+ protected $fixedCount = 0;
+
+ /**
+ * TRUE if errors are being replayed from the cache.
+ *
+ * @var boolean
+ */
+ protected $replayingErrors = false;
+
+ /**
+ * An array of sniffs that are being ignored.
+ *
+ * @var array
+ */
+ protected $ignoredListeners = [];
+
+ /**
+ * An array of message codes that are being ignored.
+ *
+ * @var array
+ */
+ protected $ignoredCodes = [];
+
+ /**
+ * An array of sniffs listening to this file's processing.
+ *
+ * @var \PHP_CodeSniffer\Sniffs\Sniff[]
+ */
+ protected $listeners = [];
+
+ /**
+ * The class name of the sniff currently processing the file.
+ *
+ * @var string
+ */
+ protected $activeListener = '';
+
+ /**
+ * An array of sniffs being processed and how long they took.
+ *
+ * @var array
+ */
+ protected $listenerTimes = [];
+
+ /**
+ * A cache of often used config settings to improve performance.
+ *
+ * Storing them here saves 10k+ calls to __get() in the Config class.
+ *
+ * @var array
+ */
+ protected $configCache = [];
+
+
+ /**
+ * Constructs a file.
+ *
+ * @param string $path The absolute path to the file to process.
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ *
+ * @return void
+ */
+ public function __construct($path, Ruleset $ruleset, Config $config)
+ {
+ $this->path = $path;
+ $this->ruleset = $ruleset;
+ $this->config = $config;
+ $this->fixer = new Fixer();
+
+ $parts = explode('.', $path);
+ $extension = array_pop($parts);
+ if (isset($config->extensions[$extension]) === true) {
+ $this->tokenizerType = $config->extensions[$extension];
+ } else {
+ // Revert to default.
+ $this->tokenizerType = 'PHP';
+ }
+
+ $this->configCache['cache'] = $this->config->cache;
+ $this->configCache['sniffs'] = array_map('strtolower', $this->config->sniffs);
+ $this->configCache['exclude'] = array_map('strtolower', $this->config->exclude);
+ $this->configCache['errorSeverity'] = $this->config->errorSeverity;
+ $this->configCache['warningSeverity'] = $this->config->warningSeverity;
+ $this->configCache['recordErrors'] = $this->config->recordErrors;
+ $this->configCache['ignorePatterns'] = $this->ruleset->ignorePatterns;
+ $this->configCache['includePatterns'] = $this->ruleset->includePatterns;
+
+ }//end __construct()
+
+
+ /**
+ * Set the content of the file.
+ *
+ * Setting the content also calculates the EOL char being used.
+ *
+ * @param string $content The file content.
+ *
+ * @return void
+ */
+ public function setContent($content)
+ {
+ $this->content = $content;
+ $this->tokens = [];
+
+ try {
+ $this->eolChar = Util\Common::detectLineEndings($content);
+ } catch (RuntimeException $e) {
+ $this->addWarningOnLine($e->getMessage(), 1, 'Internal.DetectLineEndings');
+ return;
+ }
+
+ }//end setContent()
+
+
+ /**
+ * Reloads the content of the file.
+ *
+ * By default, we have no idea where our content comes from,
+ * so we can't do anything.
+ *
+ * @return void
+ */
+ public function reloadContent()
+ {
+
+ }//end reloadContent()
+
+
+ /**
+ * Disables caching of this file.
+ *
+ * @return void
+ */
+ public function disableCaching()
+ {
+ $this->configCache['cache'] = false;
+
+ }//end disableCaching()
+
+
+ /**
+ * Starts the stack traversal and tells listeners when tokens are found.
+ *
+ * @return void
+ */
+ public function process()
+ {
+ if ($this->ignored === true) {
+ return;
+ }
+
+ $this->errors = [];
+ $this->warnings = [];
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+
+ $this->parse();
+
+ // Check if tokenizer errors cause this file to be ignored.
+ if ($this->ignored === true) {
+ return;
+ }
+
+ $this->fixer->startFile($this);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ echo "\t*** START TOKEN PROCESSING ***".PHP_EOL;
+ }
+
+ $foundCode = false;
+ $listenerIgnoreTo = [];
+ $inTests = defined('PHP_CODESNIFFER_IN_TESTS');
+ $checkAnnotations = $this->config->annotations;
+
+ // Foreach of the listeners that have registered to listen for this
+ // token, get them to process it.
+ foreach ($this->tokens as $stackPtr => $token) {
+ // Check for ignored lines.
+ if ($checkAnnotations === true
+ && ($token['code'] === T_COMMENT
+ || $token['code'] === T_PHPCS_IGNORE_FILE
+ || $token['code'] === T_PHPCS_SET
+ || $token['code'] === T_DOC_COMMENT_STRING
+ || $token['code'] === T_DOC_COMMENT_TAG
+ || ($inTests === true && $token['code'] === T_INLINE_HTML))
+ ) {
+ $commentText = ltrim($this->tokens[$stackPtr]['content'], " \t/*#");
+ $commentTextLower = strtolower($commentText);
+ if (strpos($commentText, '@codingStandards') !== false) {
+ if (strpos($commentText, '@codingStandardsIgnoreFile') !== false) {
+ // Ignoring the whole file, just a little late.
+ $this->errors = [];
+ $this->warnings = [];
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+ return;
+ } else if (strpos($commentText, '@codingStandardsChangeSetting') !== false) {
+ $start = strpos($commentText, '@codingStandardsChangeSetting');
+ $comment = substr($commentText, ($start + 30));
+ $parts = explode(' ', $comment);
+ if (count($parts) >= 2) {
+ $sniffParts = explode('.', $parts[0]);
+ if (count($sniffParts) >= 3) {
+ // If the sniff code is not known to us, it has not been registered in this run.
+ // But don't throw an error as it could be there for a different standard to use.
+ if (isset($this->ruleset->sniffCodes[$parts[0]]) === true) {
+ $listenerCode = array_shift($parts);
+ $propertyCode = array_shift($parts);
+ $propertyValue = rtrim(implode(' ', $parts), " */\r\n");
+ $listenerClass = $this->ruleset->sniffCodes[$listenerCode];
+ $this->ruleset->setSniffProperty($listenerClass, $propertyCode, $propertyValue);
+ }
+ }
+ }
+ }//end if
+ } else if (substr($commentTextLower, 0, 16) === 'phpcs:ignorefile'
+ || substr($commentTextLower, 0, 17) === '@phpcs:ignorefile'
+ ) {
+ // Ignoring the whole file, just a little late.
+ $this->errors = [];
+ $this->warnings = [];
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+ return;
+ } else if (substr($commentTextLower, 0, 9) === 'phpcs:set'
+ || substr($commentTextLower, 0, 10) === '@phpcs:set'
+ ) {
+ if (isset($token['sniffCode']) === true) {
+ $listenerCode = $token['sniffCode'];
+ if (isset($this->ruleset->sniffCodes[$listenerCode]) === true) {
+ $propertyCode = $token['sniffProperty'];
+ $propertyValue = $token['sniffPropertyValue'];
+ $listenerClass = $this->ruleset->sniffCodes[$listenerCode];
+ $this->ruleset->setSniffProperty($listenerClass, $propertyCode, $propertyValue);
+ }
+ }
+ }//end if
+ }//end if
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ $type = $token['type'];
+ $content = Util\Common::prepareForOutput($token['content']);
+ echo "\t\tProcess token $stackPtr: $type => $content".PHP_EOL;
+ }
+
+ if ($token['code'] !== T_INLINE_HTML) {
+ $foundCode = true;
+ }
+
+ if (isset($this->ruleset->tokenListeners[$token['code']]) === false) {
+ continue;
+ }
+
+ foreach ($this->ruleset->tokenListeners[$token['code']] as $listenerData) {
+ if (isset($this->ignoredListeners[$listenerData['class']]) === true
+ || (isset($listenerIgnoreTo[$listenerData['class']]) === true
+ && $listenerIgnoreTo[$listenerData['class']] > $stackPtr)
+ ) {
+ // This sniff is ignoring past this token, or the whole file.
+ continue;
+ }
+
+ // Make sure this sniff supports the tokenizer
+ // we are currently using.
+ $class = $listenerData['class'];
+
+ if (isset($listenerData['tokenizers'][$this->tokenizerType]) === false) {
+ continue;
+ }
+
+ if (trim($this->path, '\'"') !== 'STDIN') {
+ // If the file path matches one of our ignore patterns, skip it.
+ // While there is support for a type of each pattern
+ // (absolute or relative) we don't actually support it here.
+ foreach ($listenerData['ignore'] as $pattern) {
+ // We assume a / directory separator, as do the exclude rules
+ // most developers write, so we need a special case for any system
+ // that is different.
+ if (DIRECTORY_SEPARATOR === '\\') {
+ $pattern = str_replace('/', '\\\\', $pattern);
+ }
+
+ $pattern = '`'.$pattern.'`i';
+ if (preg_match($pattern, $this->path) === 1) {
+ $this->ignoredListeners[$class] = true;
+ continue(2);
+ }
+ }
+
+ // If the file path does not match one of our include patterns, skip it.
+ // While there is support for a type of each pattern
+ // (absolute or relative) we don't actually support it here.
+ if (empty($listenerData['include']) === false) {
+ $included = false;
+ foreach ($listenerData['include'] as $pattern) {
+ // We assume a / directory separator, as do the exclude rules
+ // most developers write, so we need a special case for any system
+ // that is different.
+ if (DIRECTORY_SEPARATOR === '\\') {
+ $pattern = str_replace('/', '\\\\', $pattern);
+ }
+
+ $pattern = '`'.$pattern.'`i';
+ if (preg_match($pattern, $this->path) === 1) {
+ $included = true;
+ break;
+ }
+ }
+
+ if ($included === false) {
+ $this->ignoredListeners[$class] = true;
+ continue;
+ }
+ }//end if
+ }//end if
+
+ $this->activeListener = $class;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ $startTime = microtime(true);
+ echo "\t\t\tProcessing ".$this->activeListener.'... ';
+ }
+
+ $ignoreTo = $this->ruleset->sniffs[$class]->process($this, $stackPtr);
+ if ($ignoreTo !== null) {
+ $listenerIgnoreTo[$this->activeListener] = $ignoreTo;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ $timeTaken = (microtime(true) - $startTime);
+ if (isset($this->listenerTimes[$this->activeListener]) === false) {
+ $this->listenerTimes[$this->activeListener] = 0;
+ }
+
+ $this->listenerTimes[$this->activeListener] += $timeTaken;
+
+ $timeTaken = round(($timeTaken), 4);
+ echo "DONE in $timeTaken seconds".PHP_EOL;
+ }
+
+ $this->activeListener = '';
+ }//end foreach
+ }//end foreach
+
+ // If short open tags are off but the file being checked uses
+ // short open tags, the whole content will be inline HTML
+ // and nothing will be checked. So try and handle this case.
+ // We don't show this error for STDIN because we can't be sure the content
+ // actually came directly from the user. It could be something like
+ // refs from a Git pre-push hook.
+ if ($foundCode === false && $this->tokenizerType === 'PHP' && $this->path !== 'STDIN') {
+ $shortTags = (bool) ini_get('short_open_tag');
+ if ($shortTags === false) {
+ $error = 'No PHP code was found in this file and short open tags are not allowed by this install of PHP. This file may be using short open tags but PHP does not allow them.';
+ $this->addWarning($error, null, 'Internal.NoCodeFound');
+ }
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ echo "\t*** END TOKEN PROCESSING ***".PHP_EOL;
+ echo "\t*** START SNIFF PROCESSING REPORT ***".PHP_EOL;
+
+ asort($this->listenerTimes, SORT_NUMERIC);
+ $this->listenerTimes = array_reverse($this->listenerTimes, true);
+ foreach ($this->listenerTimes as $listener => $timeTaken) {
+ echo "\t$listener: ".round(($timeTaken), 4).' secs'.PHP_EOL;
+ }
+
+ echo "\t*** END SNIFF PROCESSING REPORT ***".PHP_EOL;
+ }
+
+ $this->fixedCount += $this->fixer->getFixCount();
+
+ }//end process()
+
+
+ /**
+ * Tokenizes the file and prepares it for the test run.
+ *
+ * @return void
+ */
+ public function parse()
+ {
+ if (empty($this->tokens) === false) {
+ // File has already been parsed.
+ return;
+ }
+
+ try {
+ $tokenizerClass = 'PHP_CodeSniffer\Tokenizers\\'.$this->tokenizerType;
+ $this->tokenizer = new $tokenizerClass($this->content, $this->config, $this->eolChar);
+ $this->tokens = $this->tokenizer->getTokens();
+ } catch (TokenizerException $e) {
+ $this->ignored = true;
+ $this->addWarning($e->getMessage(), null, 'Internal.Tokenizer.Exception');
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo "[$this->tokenizerType => tokenizer error]... ";
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+ }
+
+ return;
+ }
+
+ $this->numTokens = count($this->tokens);
+
+ // Check for mixed line endings as these can cause tokenizer errors and we
+ // should let the user know that the results they get may be incorrect.
+ // This is done by removing all backslashes, removing the newline char we
+ // detected, then converting newlines chars into text. If any backslashes
+ // are left at the end, we have additional newline chars in use.
+ $contents = str_replace('\\', '', $this->content);
+ $contents = str_replace($this->eolChar, '', $contents);
+ $contents = str_replace("\n", '\n', $contents);
+ $contents = str_replace("\r", '\r', $contents);
+ if (strpos($contents, '\\') !== false) {
+ $error = 'File has mixed line endings; this may cause incorrect results';
+ $this->addWarningOnLine($error, 1, 'Internal.LineEndings.Mixed');
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ if ($this->numTokens === 0) {
+ $numLines = 0;
+ } else {
+ $numLines = $this->tokens[($this->numTokens - 1)]['line'];
+ }
+
+ echo "[$this->tokenizerType => $this->numTokens tokens in $numLines lines]... ";
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+ }
+
+ }//end parse()
+
+
+ /**
+ * Returns the token stack for this file.
+ *
+ * @return array
+ */
+ public function getTokens()
+ {
+ return $this->tokens;
+
+ }//end getTokens()
+
+
+ /**
+ * Remove vars stored in this file that are no longer required.
+ *
+ * @return void
+ */
+ public function cleanUp()
+ {
+ $this->listenerTimes = null;
+ $this->content = null;
+ $this->tokens = null;
+ $this->metricTokens = null;
+ $this->tokenizer = null;
+ $this->fixer = null;
+ $this->config = null;
+ $this->ruleset = null;
+
+ }//end cleanUp()
+
+
+ /**
+ * Records an error against a specific token in the file.
+ *
+ * @param string $error The error message.
+ * @param int $stackPtr The stack position where the error occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the error message.
+ * @param int $severity The severity level for this error. A value of 0
+ * will be converted into the default severity level.
+ * @param boolean $fixable Can the error be fixed by the sniff?
+ *
+ * @return boolean
+ */
+ public function addError(
+ $error,
+ $stackPtr,
+ $code,
+ $data=[],
+ $severity=0,
+ $fixable=false
+ ) {
+ if ($stackPtr === null) {
+ $line = 1;
+ $column = 1;
+ } else {
+ $line = $this->tokens[$stackPtr]['line'];
+ $column = $this->tokens[$stackPtr]['column'];
+ }
+
+ return $this->addMessage(true, $error, $line, $column, $code, $data, $severity, $fixable);
+
+ }//end addError()
+
+
+ /**
+ * Records a warning against a specific token in the file.
+ *
+ * @param string $warning The error message.
+ * @param int $stackPtr The stack position where the error occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the warning message.
+ * @param int $severity The severity level for this warning. A value of 0
+ * will be converted into the default severity level.
+ * @param boolean $fixable Can the warning be fixed by the sniff?
+ *
+ * @return boolean
+ */
+ public function addWarning(
+ $warning,
+ $stackPtr,
+ $code,
+ $data=[],
+ $severity=0,
+ $fixable=false
+ ) {
+ if ($stackPtr === null) {
+ $line = 1;
+ $column = 1;
+ } else {
+ $line = $this->tokens[$stackPtr]['line'];
+ $column = $this->tokens[$stackPtr]['column'];
+ }
+
+ return $this->addMessage(false, $warning, $line, $column, $code, $data, $severity, $fixable);
+
+ }//end addWarning()
+
+
+ /**
+ * Records an error against a specific line in the file.
+ *
+ * @param string $error The error message.
+ * @param int $line The line on which the error occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the error message.
+ * @param int $severity The severity level for this error. A value of 0
+ * will be converted into the default severity level.
+ *
+ * @return boolean
+ */
+ public function addErrorOnLine(
+ $error,
+ $line,
+ $code,
+ $data=[],
+ $severity=0
+ ) {
+ return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false);
+
+ }//end addErrorOnLine()
+
+
+ /**
+ * Records a warning against a specific token in the file.
+ *
+ * @param string $warning The error message.
+ * @param int $line The line on which the warning occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the warning message.
+ * @param int $severity The severity level for this warning. A value of 0 will
+ * will be converted into the default severity level.
+ *
+ * @return boolean
+ */
+ public function addWarningOnLine(
+ $warning,
+ $line,
+ $code,
+ $data=[],
+ $severity=0
+ ) {
+ return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false);
+
+ }//end addWarningOnLine()
+
+
+ /**
+ * Records a fixable error against a specific token in the file.
+ *
+ * Returns true if the error was recorded and should be fixed.
+ *
+ * @param string $error The error message.
+ * @param int $stackPtr The stack position where the error occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the error message.
+ * @param int $severity The severity level for this error. A value of 0
+ * will be converted into the default severity level.
+ *
+ * @return boolean
+ */
+ public function addFixableError(
+ $error,
+ $stackPtr,
+ $code,
+ $data=[],
+ $severity=0
+ ) {
+ $recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true);
+ if ($recorded === true && $this->fixer->enabled === true) {
+ return true;
+ }
+
+ return false;
+
+ }//end addFixableError()
+
+
+ /**
+ * Records a fixable warning against a specific token in the file.
+ *
+ * Returns true if the warning was recorded and should be fixed.
+ *
+ * @param string $warning The error message.
+ * @param int $stackPtr The stack position where the error occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the warning message.
+ * @param int $severity The severity level for this warning. A value of 0
+ * will be converted into the default severity level.
+ *
+ * @return boolean
+ */
+ public function addFixableWarning(
+ $warning,
+ $stackPtr,
+ $code,
+ $data=[],
+ $severity=0
+ ) {
+ $recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true);
+ if ($recorded === true && $this->fixer->enabled === true) {
+ return true;
+ }
+
+ return false;
+
+ }//end addFixableWarning()
+
+
+ /**
+ * Adds an error to the error stack.
+ *
+ * @param boolean $error Is this an error message?
+ * @param string $message The text of the message.
+ * @param int $line The line on which the message occurred.
+ * @param int $column The column at which the message occurred.
+ * @param string $code A violation code unique to the sniff message.
+ * @param array $data Replacements for the message.
+ * @param int $severity The severity level for this message. A value of 0
+ * will be converted into the default severity level.
+ * @param boolean $fixable Can the problem be fixed by the sniff?
+ *
+ * @return boolean
+ */
+ protected function addMessage($error, $message, $line, $column, $code, $data, $severity, $fixable)
+ {
+ // Check if this line is ignoring all message codes.
+ if (isset($this->tokenizer->ignoredLines[$line]['.all']) === true) {
+ return false;
+ }
+
+ // Work out which sniff generated the message.
+ $parts = explode('.', $code);
+ if ($parts[0] === 'Internal') {
+ // An internal message.
+ $listenerCode = Util\Common::getSniffCode($this->activeListener);
+ $sniffCode = $code;
+ $checkCodes = [$sniffCode];
+ } else {
+ if ($parts[0] !== $code) {
+ // The full message code has been passed in.
+ $sniffCode = $code;
+ $listenerCode = substr($sniffCode, 0, strrpos($sniffCode, '.'));
+ } else {
+ $listenerCode = Util\Common::getSniffCode($this->activeListener);
+ $sniffCode = $listenerCode.'.'.$code;
+ $parts = explode('.', $sniffCode);
+ }
+
+ $checkCodes = [
+ $sniffCode,
+ $parts[0].'.'.$parts[1].'.'.$parts[2],
+ $parts[0].'.'.$parts[1],
+ $parts[0],
+ ];
+ }//end if
+
+ if (isset($this->tokenizer->ignoredLines[$line]) === true) {
+ // Check if this line is ignoring this specific message.
+ $ignored = false;
+ foreach ($checkCodes as $checkCode) {
+ if (isset($this->tokenizer->ignoredLines[$line][$checkCode]) === true) {
+ $ignored = true;
+ break;
+ }
+ }
+
+ // If it is ignored, make sure it's not whitelisted.
+ if ($ignored === true
+ && isset($this->tokenizer->ignoredLines[$line]['.except']) === true
+ ) {
+ foreach ($checkCodes as $checkCode) {
+ if (isset($this->tokenizer->ignoredLines[$line]['.except'][$checkCode]) === true) {
+ $ignored = false;
+ break;
+ }
+ }
+ }
+
+ if ($ignored === true) {
+ return false;
+ }
+ }//end if
+
+ $includeAll = true;
+ if ($this->configCache['cache'] === false
+ || $this->configCache['recordErrors'] === false
+ ) {
+ $includeAll = false;
+ }
+
+ // Filter out any messages for sniffs that shouldn't have run
+ // due to the use of the --sniffs command line argument.
+ if ($includeAll === false
+ && ((empty($this->configCache['sniffs']) === false
+ && in_array(strtolower($listenerCode), $this->configCache['sniffs'], true) === false)
+ || (empty($this->configCache['exclude']) === false
+ && in_array(strtolower($listenerCode), $this->configCache['exclude'], true) === true))
+ ) {
+ return false;
+ }
+
+ // If we know this sniff code is being ignored for this file, return early.
+ foreach ($checkCodes as $checkCode) {
+ if (isset($this->ignoredCodes[$checkCode]) === true) {
+ return false;
+ }
+ }
+
+ $oppositeType = 'warning';
+ if ($error === false) {
+ $oppositeType = 'error';
+ }
+
+ foreach ($checkCodes as $checkCode) {
+ // Make sure this message type has not been set to the opposite message type.
+ if (isset($this->ruleset->ruleset[$checkCode]['type']) === true
+ && $this->ruleset->ruleset[$checkCode]['type'] === $oppositeType
+ ) {
+ $error = !$error;
+ break;
+ }
+ }
+
+ if ($error === true) {
+ $configSeverity = $this->configCache['errorSeverity'];
+ $messageCount = &$this->errorCount;
+ $messages = &$this->errors;
+ } else {
+ $configSeverity = $this->configCache['warningSeverity'];
+ $messageCount = &$this->warningCount;
+ $messages = &$this->warnings;
+ }
+
+ if ($includeAll === false && $configSeverity === 0) {
+ // Don't bother doing any processing as these messages are just going to
+ // be hidden in the reports anyway.
+ return false;
+ }
+
+ if ($severity === 0) {
+ $severity = 5;
+ }
+
+ foreach ($checkCodes as $checkCode) {
+ // Make sure we are interested in this severity level.
+ if (isset($this->ruleset->ruleset[$checkCode]['severity']) === true) {
+ $severity = $this->ruleset->ruleset[$checkCode]['severity'];
+ break;
+ }
+ }
+
+ if ($includeAll === false && $configSeverity > $severity) {
+ return false;
+ }
+
+ // Make sure we are not ignoring this file.
+ $included = null;
+ if (trim($this->path, '\'"') === 'STDIN') {
+ $included = true;
+ } else {
+ foreach ($checkCodes as $checkCode) {
+ $patterns = null;
+
+ if (isset($this->configCache['includePatterns'][$checkCode]) === true) {
+ $patterns = $this->configCache['includePatterns'][$checkCode];
+ $excluding = false;
+ } else if (isset($this->configCache['ignorePatterns'][$checkCode]) === true) {
+ $patterns = $this->configCache['ignorePatterns'][$checkCode];
+ $excluding = true;
+ }
+
+ if ($patterns === null) {
+ continue;
+ }
+
+ foreach ($patterns as $pattern => $type) {
+ // While there is support for a type of each pattern
+ // (absolute or relative) we don't actually support it here.
+ $replacements = [
+ '\\,' => ',',
+ '*' => '.*',
+ ];
+
+ // We assume a / directory separator, as do the exclude rules
+ // most developers write, so we need a special case for any system
+ // that is different.
+ if (DIRECTORY_SEPARATOR === '\\') {
+ $replacements['/'] = '\\\\';
+ }
+
+ $pattern = '`'.strtr($pattern, $replacements).'`i';
+ $matched = preg_match($pattern, $this->path);
+
+ if ($matched === 0) {
+ if ($excluding === false && $included === null) {
+ // This file path is not being included.
+ $included = false;
+ }
+
+ continue;
+ }
+
+ if ($excluding === true) {
+ // This file path is being excluded.
+ $this->ignoredCodes[$checkCode] = true;
+ return false;
+ }
+
+ // This file path is being included.
+ $included = true;
+ break;
+ }//end foreach
+ }//end foreach
+ }//end if
+
+ if ($included === false) {
+ // There were include rules set, but this file
+ // path didn't match any of them.
+ return false;
+ }
+
+ $messageCount++;
+ if ($fixable === true) {
+ $this->fixableCount++;
+ }
+
+ if ($this->configCache['recordErrors'] === false
+ && $includeAll === false
+ ) {
+ return true;
+ }
+
+ // See if there is a custom error message format to use.
+ // But don't do this if we are replaying errors because replayed
+ // errors have already used the custom format and have had their
+ // data replaced.
+ if ($this->replayingErrors === false
+ && isset($this->ruleset->ruleset[$sniffCode]['message']) === true
+ ) {
+ $message = $this->ruleset->ruleset[$sniffCode]['message'];
+ }
+
+ if (empty($data) === false) {
+ $message = vsprintf($message, $data);
+ }
+
+ if (isset($messages[$line]) === false) {
+ $messages[$line] = [];
+ }
+
+ if (isset($messages[$line][$column]) === false) {
+ $messages[$line][$column] = [];
+ }
+
+ $messages[$line][$column][] = [
+ 'message' => $message,
+ 'source' => $sniffCode,
+ 'listener' => $this->activeListener,
+ 'severity' => $severity,
+ 'fixable' => $fixable,
+ ];
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1
+ && $this->fixer->enabled === true
+ && $fixable === true
+ ) {
+ @ob_end_clean();
+ echo "\tE: [Line $line] $message ($sniffCode)".PHP_EOL;
+ ob_start();
+ }
+
+ return true;
+
+ }//end addMessage()
+
+
+ /**
+ * Record a metric about the file being examined.
+ *
+ * @param int $stackPtr The stack position where the metric was recorded.
+ * @param string $metric The name of the metric being recorded.
+ * @param string $value The value of the metric being recorded.
+ *
+ * @return boolean
+ */
+ public function recordMetric($stackPtr, $metric, $value)
+ {
+ if (isset($this->metrics[$metric]) === false) {
+ $this->metrics[$metric] = ['values' => [$value => 1]];
+ $this->metricTokens[$metric][$stackPtr] = true;
+ } else if (isset($this->metricTokens[$metric][$stackPtr]) === false) {
+ $this->metricTokens[$metric][$stackPtr] = true;
+ if (isset($this->metrics[$metric]['values'][$value]) === false) {
+ $this->metrics[$metric]['values'][$value] = 1;
+ } else {
+ $this->metrics[$metric]['values'][$value]++;
+ }
+ }
+
+ return true;
+
+ }//end recordMetric()
+
+
+ /**
+ * Returns the number of errors raised.
+ *
+ * @return int
+ */
+ public function getErrorCount()
+ {
+ return $this->errorCount;
+
+ }//end getErrorCount()
+
+
+ /**
+ * Returns the number of warnings raised.
+ *
+ * @return int
+ */
+ public function getWarningCount()
+ {
+ return $this->warningCount;
+
+ }//end getWarningCount()
+
+
+ /**
+ * Returns the number of fixable errors/warnings raised.
+ *
+ * @return int
+ */
+ public function getFixableCount()
+ {
+ return $this->fixableCount;
+
+ }//end getFixableCount()
+
+
+ /**
+ * Returns the number of fixed errors/warnings.
+ *
+ * @return int
+ */
+ public function getFixedCount()
+ {
+ return $this->fixedCount;
+
+ }//end getFixedCount()
+
+
+ /**
+ * Returns the list of ignored lines.
+ *
+ * @return array
+ */
+ public function getIgnoredLines()
+ {
+ return $this->tokenizer->ignoredLines;
+
+ }//end getIgnoredLines()
+
+
+ /**
+ * Returns the errors raised from processing this file.
+ *
+ * @return array
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+
+ }//end getErrors()
+
+
+ /**
+ * Returns the warnings raised from processing this file.
+ *
+ * @return array
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+
+ }//end getWarnings()
+
+
+ /**
+ * Returns the metrics found while processing this file.
+ *
+ * @return array
+ */
+ public function getMetrics()
+ {
+ return $this->metrics;
+
+ }//end getMetrics()
+
+
+ /**
+ * Returns the absolute filename of this file.
+ *
+ * @return string
+ */
+ public function getFilename()
+ {
+ return $this->path;
+
+ }//end getFilename()
+
+
+ /**
+ * Returns the declaration name for classes, interfaces, traits, enums, and functions.
+ *
+ * @param int $stackPtr The position of the declaration token which
+ * declared the class, interface, trait, or function.
+ *
+ * @return string|null The name of the class, interface, trait, or function;
+ * or NULL if the function or class is anonymous.
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified token is not of type
+ * T_FUNCTION, T_CLASS, T_ANON_CLASS,
+ * T_CLOSURE, T_TRAIT, T_ENUM, or T_INTERFACE.
+ */
+ public function getDeclarationName($stackPtr)
+ {
+ $tokenCode = $this->tokens[$stackPtr]['code'];
+
+ if ($tokenCode === T_ANON_CLASS || $tokenCode === T_CLOSURE) {
+ return null;
+ }
+
+ if ($tokenCode !== T_FUNCTION
+ && $tokenCode !== T_CLASS
+ && $tokenCode !== T_INTERFACE
+ && $tokenCode !== T_TRAIT
+ && $tokenCode !== T_ENUM
+ ) {
+ throw new RuntimeException('Token type "'.$this->tokens[$stackPtr]['type'].'" is not T_FUNCTION, T_CLASS, T_INTERFACE, T_TRAIT or T_ENUM');
+ }
+
+ if ($tokenCode === T_FUNCTION
+ && strtolower($this->tokens[$stackPtr]['content']) !== 'function'
+ ) {
+ // This is a function declared without the "function" keyword.
+ // So this token is the function name.
+ return $this->tokens[$stackPtr]['content'];
+ }
+
+ $content = null;
+ for ($i = $stackPtr; $i < $this->numTokens; $i++) {
+ if ($this->tokens[$i]['code'] === T_STRING) {
+ $content = $this->tokens[$i]['content'];
+ break;
+ }
+ }
+
+ return $content;
+
+ }//end getDeclarationName()
+
+
+ /**
+ * Returns the method parameters for the specified function token.
+ *
+ * Also supports passing in a USE token for a closure use group.
+ *
+ * Each parameter is in the following format:
+ *
+ *
+ * 0 => array(
+ * 'name' => '$var', // The variable name.
+ * 'token' => integer, // The stack pointer to the variable name.
+ * 'content' => string, // The full content of the variable definition.
+ * 'has_attributes' => boolean, // Does the parameter have one or more attributes attached ?
+ * 'pass_by_reference' => boolean, // Is the variable passed by reference?
+ * 'reference_token' => integer, // The stack pointer to the reference operator
+ * // or FALSE if the param is not passed by reference.
+ * 'variable_length' => boolean, // Is the param of variable length through use of `...` ?
+ * 'variadic_token' => integer, // The stack pointer to the ... operator
+ * // or FALSE if the param is not variable length.
+ * 'type_hint' => string, // The type hint for the variable.
+ * 'type_hint_token' => integer, // The stack pointer to the start of the type hint
+ * // or FALSE if there is no type hint.
+ * 'type_hint_end_token' => integer, // The stack pointer to the end of the type hint
+ * // or FALSE if there is no type hint.
+ * 'nullable_type' => boolean, // TRUE if the type is preceded by the nullability
+ * // operator.
+ * 'comma_token' => integer, // The stack pointer to the comma after the param
+ * // or FALSE if this is the last param.
+ * )
+ *
+ *
+ * Parameters with default values have additional array indexes of:
+ * 'default' => string, // The full content of the default value.
+ * 'default_token' => integer, // The stack pointer to the start of the default value.
+ * 'default_equal_token' => integer, // The stack pointer to the equals sign.
+ *
+ * Parameters declared using PHP 8 constructor property promotion, have these additional array indexes:
+ * 'property_visibility' => string, // The property visibility as declared.
+ * 'visibility_token' => integer, // The stack pointer to the visibility modifier token.
+ * 'property_readonly' => bool, // TRUE if the readonly keyword was found.
+ * 'readonly_token' => integer, // The stack pointer to the readonly modifier token.
+ *
+ * @param int $stackPtr The position in the stack of the function token
+ * to acquire the parameters for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified $stackPtr is not of
+ * type T_FUNCTION, T_CLOSURE, T_USE,
+ * or T_FN.
+ */
+ public function getMethodParameters($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
+ && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
+ && $this->tokens[$stackPtr]['code'] !== T_USE
+ && $this->tokens[$stackPtr]['code'] !== T_FN
+ ) {
+ throw new RuntimeException('$stackPtr must be of type T_FUNCTION or T_CLOSURE or T_USE or T_FN');
+ }
+
+ if ($this->tokens[$stackPtr]['code'] === T_USE) {
+ $opener = $this->findNext(T_OPEN_PARENTHESIS, ($stackPtr + 1));
+ if ($opener === false || isset($this->tokens[$opener]['parenthesis_owner']) === true) {
+ throw new RuntimeException('$stackPtr was not a valid T_USE');
+ }
+ } else {
+ if (isset($this->tokens[$stackPtr]['parenthesis_opener']) === false) {
+ // Live coding or syntax error, so no params to find.
+ return [];
+ }
+
+ $opener = $this->tokens[$stackPtr]['parenthesis_opener'];
+ }
+
+ if (isset($this->tokens[$opener]['parenthesis_closer']) === false) {
+ // Live coding or syntax error, so no params to find.
+ return [];
+ }
+
+ $closer = $this->tokens[$opener]['parenthesis_closer'];
+
+ $vars = [];
+ $currVar = null;
+ $paramStart = ($opener + 1);
+ $defaultStart = null;
+ $equalToken = null;
+ $paramCount = 0;
+ $hasAttributes = false;
+ $passByReference = false;
+ $referenceToken = false;
+ $variableLength = false;
+ $variadicToken = false;
+ $typeHint = '';
+ $typeHintToken = false;
+ $typeHintEndToken = false;
+ $nullableType = false;
+ $visibilityToken = null;
+ $readonlyToken = null;
+
+ for ($i = $paramStart; $i <= $closer; $i++) {
+ // Check to see if this token has a parenthesis or bracket opener. If it does
+ // it's likely to be an array which might have arguments in it. This
+ // could cause problems in our parsing below, so lets just skip to the
+ // end of it.
+ if (isset($this->tokens[$i]['parenthesis_opener']) === true) {
+ // Don't do this if it's the close parenthesis for the method.
+ if ($i !== $this->tokens[$i]['parenthesis_closer']) {
+ $i = $this->tokens[$i]['parenthesis_closer'];
+ continue;
+ }
+ }
+
+ if (isset($this->tokens[$i]['bracket_opener']) === true) {
+ if ($i !== $this->tokens[$i]['bracket_closer']) {
+ $i = $this->tokens[$i]['bracket_closer'];
+ continue;
+ }
+ }
+
+ switch ($this->tokens[$i]['code']) {
+ case T_ATTRIBUTE:
+ $hasAttributes = true;
+
+ // Skip to the end of the attribute.
+ $i = $this->tokens[$i]['attribute_closer'];
+ break;
+ case T_BITWISE_AND:
+ if ($defaultStart === null) {
+ $passByReference = true;
+ $referenceToken = $i;
+ }
+ break;
+ case T_VARIABLE:
+ $currVar = $i;
+ break;
+ case T_ELLIPSIS:
+ $variableLength = true;
+ $variadicToken = $i;
+ break;
+ case T_CALLABLE:
+ if ($typeHintToken === false) {
+ $typeHintToken = $i;
+ }
+
+ $typeHint .= $this->tokens[$i]['content'];
+ $typeHintEndToken = $i;
+ break;
+ case T_SELF:
+ case T_PARENT:
+ case T_STATIC:
+ // Self and parent are valid, static invalid, but was probably intended as type hint.
+ if (isset($defaultStart) === false) {
+ if ($typeHintToken === false) {
+ $typeHintToken = $i;
+ }
+
+ $typeHint .= $this->tokens[$i]['content'];
+ $typeHintEndToken = $i;
+ }
+ break;
+ case T_STRING:
+ // This is a string, so it may be a type hint, but it could
+ // also be a constant used as a default value.
+ $prevComma = false;
+ for ($t = $i; $t >= $opener; $t--) {
+ if ($this->tokens[$t]['code'] === T_COMMA) {
+ $prevComma = $t;
+ break;
+ }
+ }
+
+ if ($prevComma !== false) {
+ $nextEquals = false;
+ for ($t = $prevComma; $t < $i; $t++) {
+ if ($this->tokens[$t]['code'] === T_EQUAL) {
+ $nextEquals = $t;
+ break;
+ }
+ }
+
+ if ($nextEquals !== false) {
+ break;
+ }
+ }
+
+ if ($defaultStart === null) {
+ if ($typeHintToken === false) {
+ $typeHintToken = $i;
+ }
+
+ $typeHint .= $this->tokens[$i]['content'];
+ $typeHintEndToken = $i;
+ }
+ break;
+ case T_NAMESPACE:
+ case T_NS_SEPARATOR:
+ case T_TYPE_UNION:
+ case T_TYPE_INTERSECTION:
+ case T_FALSE:
+ case T_NULL:
+ // Part of a type hint or default value.
+ if ($defaultStart === null) {
+ if ($typeHintToken === false) {
+ $typeHintToken = $i;
+ }
+
+ $typeHint .= $this->tokens[$i]['content'];
+ $typeHintEndToken = $i;
+ }
+ break;
+ case T_NULLABLE:
+ if ($defaultStart === null) {
+ $nullableType = true;
+ $typeHint .= $this->tokens[$i]['content'];
+ $typeHintEndToken = $i;
+ }
+ break;
+ case T_PUBLIC:
+ case T_PROTECTED:
+ case T_PRIVATE:
+ if ($defaultStart === null) {
+ $visibilityToken = $i;
+ }
+ break;
+ case T_READONLY:
+ if ($defaultStart === null) {
+ $readonlyToken = $i;
+ }
+ break;
+ case T_CLOSE_PARENTHESIS:
+ case T_COMMA:
+ // If it's null, then there must be no parameters for this
+ // method.
+ if ($currVar === null) {
+ continue 2;
+ }
+
+ $vars[$paramCount] = [];
+ $vars[$paramCount]['token'] = $currVar;
+ $vars[$paramCount]['name'] = $this->tokens[$currVar]['content'];
+ $vars[$paramCount]['content'] = trim($this->getTokensAsString($paramStart, ($i - $paramStart)));
+
+ if ($defaultStart !== null) {
+ $vars[$paramCount]['default'] = trim($this->getTokensAsString($defaultStart, ($i - $defaultStart)));
+ $vars[$paramCount]['default_token'] = $defaultStart;
+ $vars[$paramCount]['default_equal_token'] = $equalToken;
+ }
+
+ $vars[$paramCount]['has_attributes'] = $hasAttributes;
+ $vars[$paramCount]['pass_by_reference'] = $passByReference;
+ $vars[$paramCount]['reference_token'] = $referenceToken;
+ $vars[$paramCount]['variable_length'] = $variableLength;
+ $vars[$paramCount]['variadic_token'] = $variadicToken;
+ $vars[$paramCount]['type_hint'] = $typeHint;
+ $vars[$paramCount]['type_hint_token'] = $typeHintToken;
+ $vars[$paramCount]['type_hint_end_token'] = $typeHintEndToken;
+ $vars[$paramCount]['nullable_type'] = $nullableType;
+
+ if ($visibilityToken !== null) {
+ $vars[$paramCount]['property_visibility'] = $this->tokens[$visibilityToken]['content'];
+ $vars[$paramCount]['visibility_token'] = $visibilityToken;
+ $vars[$paramCount]['property_readonly'] = false;
+ }
+
+ if ($readonlyToken !== null) {
+ $vars[$paramCount]['property_readonly'] = true;
+ $vars[$paramCount]['readonly_token'] = $readonlyToken;
+ }
+
+ if ($this->tokens[$i]['code'] === T_COMMA) {
+ $vars[$paramCount]['comma_token'] = $i;
+ } else {
+ $vars[$paramCount]['comma_token'] = false;
+ }
+
+ // Reset the vars, as we are about to process the next parameter.
+ $currVar = null;
+ $paramStart = ($i + 1);
+ $defaultStart = null;
+ $equalToken = null;
+ $hasAttributes = false;
+ $passByReference = false;
+ $referenceToken = false;
+ $variableLength = false;
+ $variadicToken = false;
+ $typeHint = '';
+ $typeHintToken = false;
+ $typeHintEndToken = false;
+ $nullableType = false;
+ $visibilityToken = null;
+ $readonlyToken = null;
+
+ $paramCount++;
+ break;
+ case T_EQUAL:
+ $defaultStart = $this->findNext(Util\Tokens::$emptyTokens, ($i + 1), null, true);
+ $equalToken = $i;
+ break;
+ }//end switch
+ }//end for
+
+ return $vars;
+
+ }//end getMethodParameters()
+
+
+ /**
+ * Returns the visibility and implementation properties of a method.
+ *
+ * The format of the return value is:
+ *
+ * array(
+ * 'scope' => 'public', // Public, private, or protected
+ * 'scope_specified' => true, // TRUE if the scope keyword was found.
+ * 'return_type' => '', // The return type of the method.
+ * 'return_type_token' => integer, // The stack pointer to the start of the return type
+ * // or FALSE if there is no return type.
+ * 'return_type_end_token' => integer, // The stack pointer to the end of the return type
+ * // or FALSE if there is no return type.
+ * 'nullable_return_type' => false, // TRUE if the return type is preceded by the
+ * // nullability operator.
+ * 'is_abstract' => false, // TRUE if the abstract keyword was found.
+ * 'is_final' => false, // TRUE if the final keyword was found.
+ * 'is_static' => false, // TRUE if the static keyword was found.
+ * 'has_body' => false, // TRUE if the method has a body
+ * );
+ *
+ *
+ * @param int $stackPtr The position in the stack of the function token to
+ * acquire the properties for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
+ * T_FUNCTION, T_CLOSURE, or T_FN token.
+ */
+ public function getMethodProperties($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
+ && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
+ && $this->tokens[$stackPtr]['code'] !== T_FN
+ ) {
+ throw new RuntimeException('$stackPtr must be of type T_FUNCTION or T_CLOSURE or T_FN');
+ }
+
+ if ($this->tokens[$stackPtr]['code'] === T_FUNCTION) {
+ $valid = [
+ T_PUBLIC => T_PUBLIC,
+ T_PRIVATE => T_PRIVATE,
+ T_PROTECTED => T_PROTECTED,
+ T_STATIC => T_STATIC,
+ T_FINAL => T_FINAL,
+ T_ABSTRACT => T_ABSTRACT,
+ T_WHITESPACE => T_WHITESPACE,
+ T_COMMENT => T_COMMENT,
+ T_DOC_COMMENT => T_DOC_COMMENT,
+ ];
+ } else {
+ $valid = [
+ T_STATIC => T_STATIC,
+ T_WHITESPACE => T_WHITESPACE,
+ T_COMMENT => T_COMMENT,
+ T_DOC_COMMENT => T_DOC_COMMENT,
+ ];
+ }
+
+ $scope = 'public';
+ $scopeSpecified = false;
+ $isAbstract = false;
+ $isFinal = false;
+ $isStatic = false;
+
+ for ($i = ($stackPtr - 1); $i > 0; $i--) {
+ if (isset($valid[$this->tokens[$i]['code']]) === false) {
+ break;
+ }
+
+ switch ($this->tokens[$i]['code']) {
+ case T_PUBLIC:
+ $scope = 'public';
+ $scopeSpecified = true;
+ break;
+ case T_PRIVATE:
+ $scope = 'private';
+ $scopeSpecified = true;
+ break;
+ case T_PROTECTED:
+ $scope = 'protected';
+ $scopeSpecified = true;
+ break;
+ case T_ABSTRACT:
+ $isAbstract = true;
+ break;
+ case T_FINAL:
+ $isFinal = true;
+ break;
+ case T_STATIC:
+ $isStatic = true;
+ break;
+ }//end switch
+ }//end for
+
+ $returnType = '';
+ $returnTypeToken = false;
+ $returnTypeEndToken = false;
+ $nullableReturnType = false;
+ $hasBody = true;
+
+ if (isset($this->tokens[$stackPtr]['parenthesis_closer']) === true) {
+ $scopeOpener = null;
+ if (isset($this->tokens[$stackPtr]['scope_opener']) === true) {
+ $scopeOpener = $this->tokens[$stackPtr]['scope_opener'];
+ }
+
+ $valid = [
+ T_STRING => T_STRING,
+ T_CALLABLE => T_CALLABLE,
+ T_SELF => T_SELF,
+ T_PARENT => T_PARENT,
+ T_STATIC => T_STATIC,
+ T_FALSE => T_FALSE,
+ T_NULL => T_NULL,
+ T_NAMESPACE => T_NAMESPACE,
+ T_NS_SEPARATOR => T_NS_SEPARATOR,
+ T_TYPE_UNION => T_TYPE_UNION,
+ T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
+ ];
+
+ for ($i = $this->tokens[$stackPtr]['parenthesis_closer']; $i < $this->numTokens; $i++) {
+ if (($scopeOpener === null && $this->tokens[$i]['code'] === T_SEMICOLON)
+ || ($scopeOpener !== null && $i === $scopeOpener)
+ ) {
+ // End of function definition.
+ break;
+ }
+
+ if ($this->tokens[$i]['code'] === T_NULLABLE) {
+ $nullableReturnType = true;
+ }
+
+ if (isset($valid[$this->tokens[$i]['code']]) === true) {
+ if ($returnTypeToken === false) {
+ $returnTypeToken = $i;
+ }
+
+ $returnType .= $this->tokens[$i]['content'];
+ $returnTypeEndToken = $i;
+ }
+ }//end for
+
+ if ($this->tokens[$stackPtr]['code'] === T_FN) {
+ $bodyToken = T_FN_ARROW;
+ } else {
+ $bodyToken = T_OPEN_CURLY_BRACKET;
+ }
+
+ $end = $this->findNext([$bodyToken, T_SEMICOLON], $this->tokens[$stackPtr]['parenthesis_closer']);
+ $hasBody = $this->tokens[$end]['code'] === $bodyToken;
+ }//end if
+
+ if ($returnType !== '' && $nullableReturnType === true) {
+ $returnType = '?'.$returnType;
+ }
+
+ return [
+ 'scope' => $scope,
+ 'scope_specified' => $scopeSpecified,
+ 'return_type' => $returnType,
+ 'return_type_token' => $returnTypeToken,
+ 'return_type_end_token' => $returnTypeEndToken,
+ 'nullable_return_type' => $nullableReturnType,
+ 'is_abstract' => $isAbstract,
+ 'is_final' => $isFinal,
+ 'is_static' => $isStatic,
+ 'has_body' => $hasBody,
+ ];
+
+ }//end getMethodProperties()
+
+
+ /**
+ * Returns the visibility and implementation properties of a class member var.
+ *
+ * The format of the return value is:
+ *
+ *
+ * array(
+ * 'scope' => string, // Public, private, or protected.
+ * 'scope_specified' => boolean, // TRUE if the scope was explicitly specified.
+ * 'is_static' => boolean, // TRUE if the static keyword was found.
+ * 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
+ * 'type' => string, // The type of the var (empty if no type specified).
+ * 'type_token' => integer, // The stack pointer to the start of the type
+ * // or FALSE if there is no type.
+ * 'type_end_token' => integer, // The stack pointer to the end of the type
+ * // or FALSE if there is no type.
+ * 'nullable_type' => boolean, // TRUE if the type is preceded by the nullability
+ * // operator.
+ * );
+ *
+ *
+ * @param int $stackPtr The position in the stack of the T_VARIABLE token to
+ * acquire the properties for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
+ * T_VARIABLE token, or if the position is not
+ * a class member variable.
+ */
+ public function getMemberProperties($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_VARIABLE) {
+ throw new RuntimeException('$stackPtr must be of type T_VARIABLE');
+ }
+
+ $conditions = array_keys($this->tokens[$stackPtr]['conditions']);
+ $ptr = array_pop($conditions);
+ if (isset($this->tokens[$ptr]) === false
+ || ($this->tokens[$ptr]['code'] !== T_CLASS
+ && $this->tokens[$ptr]['code'] !== T_ANON_CLASS
+ && $this->tokens[$ptr]['code'] !== T_TRAIT)
+ ) {
+ if (isset($this->tokens[$ptr]) === true
+ && ($this->tokens[$ptr]['code'] === T_INTERFACE
+ || $this->tokens[$ptr]['code'] === T_ENUM)
+ ) {
+ // T_VARIABLEs in interfaces/enums can actually be method arguments
+ // but they wont be seen as being inside the method because there
+ // are no scope openers and closers for abstract methods. If it is in
+ // parentheses, we can be pretty sure it is a method argument.
+ if (isset($this->tokens[$stackPtr]['nested_parenthesis']) === false
+ || empty($this->tokens[$stackPtr]['nested_parenthesis']) === true
+ ) {
+ $error = 'Possible parse error: %ss may not include member vars';
+ $code = sprintf('Internal.ParseError.%sHasMemberVar', ucfirst($this->tokens[$ptr]['content']));
+ $data = [strtolower($this->tokens[$ptr]['content'])];
+ $this->addWarning($error, $stackPtr, $code, $data);
+ return [];
+ }
+ } else {
+ throw new RuntimeException('$stackPtr is not a class member var');
+ }
+ }//end if
+
+ // Make sure it's not a method parameter.
+ if (empty($this->tokens[$stackPtr]['nested_parenthesis']) === false) {
+ $parenthesis = array_keys($this->tokens[$stackPtr]['nested_parenthesis']);
+ $deepestOpen = array_pop($parenthesis);
+ if ($deepestOpen > $ptr
+ && isset($this->tokens[$deepestOpen]['parenthesis_owner']) === true
+ && $this->tokens[$this->tokens[$deepestOpen]['parenthesis_owner']]['code'] === T_FUNCTION
+ ) {
+ throw new RuntimeException('$stackPtr is not a class member var');
+ }
+ }
+
+ $valid = [
+ T_PUBLIC => T_PUBLIC,
+ T_PRIVATE => T_PRIVATE,
+ T_PROTECTED => T_PROTECTED,
+ T_STATIC => T_STATIC,
+ T_VAR => T_VAR,
+ T_READONLY => T_READONLY,
+ ];
+
+ $valid += Util\Tokens::$emptyTokens;
+
+ $scope = 'public';
+ $scopeSpecified = false;
+ $isStatic = false;
+ $isReadonly = false;
+
+ $startOfStatement = $this->findPrevious(
+ [
+ T_SEMICOLON,
+ T_OPEN_CURLY_BRACKET,
+ T_CLOSE_CURLY_BRACKET,
+ T_ATTRIBUTE_END,
+ ],
+ ($stackPtr - 1)
+ );
+
+ for ($i = ($startOfStatement + 1); $i < $stackPtr; $i++) {
+ if (isset($valid[$this->tokens[$i]['code']]) === false) {
+ break;
+ }
+
+ switch ($this->tokens[$i]['code']) {
+ case T_PUBLIC:
+ $scope = 'public';
+ $scopeSpecified = true;
+ break;
+ case T_PRIVATE:
+ $scope = 'private';
+ $scopeSpecified = true;
+ break;
+ case T_PROTECTED:
+ $scope = 'protected';
+ $scopeSpecified = true;
+ break;
+ case T_STATIC:
+ $isStatic = true;
+ break;
+ case T_READONLY:
+ $isReadonly = true;
+ break;
+ }
+ }//end for
+
+ $type = '';
+ $typeToken = false;
+ $typeEndToken = false;
+ $nullableType = false;
+
+ if ($i < $stackPtr) {
+ // We've found a type.
+ $valid = [
+ T_STRING => T_STRING,
+ T_CALLABLE => T_CALLABLE,
+ T_SELF => T_SELF,
+ T_PARENT => T_PARENT,
+ T_FALSE => T_FALSE,
+ T_NULL => T_NULL,
+ T_NAMESPACE => T_NAMESPACE,
+ T_NS_SEPARATOR => T_NS_SEPARATOR,
+ T_TYPE_UNION => T_TYPE_UNION,
+ T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
+ ];
+
+ for ($i; $i < $stackPtr; $i++) {
+ if ($this->tokens[$i]['code'] === T_VARIABLE) {
+ // Hit another variable in a group definition.
+ break;
+ }
+
+ if ($this->tokens[$i]['code'] === T_NULLABLE) {
+ $nullableType = true;
+ }
+
+ if (isset($valid[$this->tokens[$i]['code']]) === true) {
+ $typeEndToken = $i;
+ if ($typeToken === false) {
+ $typeToken = $i;
+ }
+
+ $type .= $this->tokens[$i]['content'];
+ }
+ }
+
+ if ($type !== '' && $nullableType === true) {
+ $type = '?'.$type;
+ }
+ }//end if
+
+ return [
+ 'scope' => $scope,
+ 'scope_specified' => $scopeSpecified,
+ 'is_static' => $isStatic,
+ 'is_readonly' => $isReadonly,
+ 'type' => $type,
+ 'type_token' => $typeToken,
+ 'type_end_token' => $typeEndToken,
+ 'nullable_type' => $nullableType,
+ ];
+
+ }//end getMemberProperties()
+
+
+ /**
+ * Returns the visibility and implementation properties of a class.
+ *
+ * The format of the return value is:
+ *
+ * array(
+ * 'is_abstract' => false, // true if the abstract keyword was found.
+ * 'is_final' => false, // true if the final keyword was found.
+ * );
+ *
+ *
+ * @param int $stackPtr The position in the stack of the T_CLASS token to
+ * acquire the properties for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position is not a
+ * T_CLASS token.
+ */
+ public function getClassProperties($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_CLASS) {
+ throw new RuntimeException('$stackPtr must be of type T_CLASS');
+ }
+
+ $valid = [
+ T_FINAL => T_FINAL,
+ T_ABSTRACT => T_ABSTRACT,
+ T_WHITESPACE => T_WHITESPACE,
+ T_COMMENT => T_COMMENT,
+ T_DOC_COMMENT => T_DOC_COMMENT,
+ ];
+
+ $isAbstract = false;
+ $isFinal = false;
+
+ for ($i = ($stackPtr - 1); $i > 0; $i--) {
+ if (isset($valid[$this->tokens[$i]['code']]) === false) {
+ break;
+ }
+
+ switch ($this->tokens[$i]['code']) {
+ case T_ABSTRACT:
+ $isAbstract = true;
+ break;
+
+ case T_FINAL:
+ $isFinal = true;
+ break;
+ }
+ }//end for
+
+ return [
+ 'is_abstract' => $isAbstract,
+ 'is_final' => $isFinal,
+ ];
+
+ }//end getClassProperties()
+
+
+ /**
+ * Determine if the passed token is a reference operator.
+ *
+ * Returns true if the specified token position represents a reference.
+ * Returns false if the token represents a bitwise operator.
+ *
+ * @param int $stackPtr The position of the T_BITWISE_AND token.
+ *
+ * @return boolean
+ */
+ public function isReference($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_BITWISE_AND) {
+ return false;
+ }
+
+ $tokenBefore = $this->findPrevious(
+ Util\Tokens::$emptyTokens,
+ ($stackPtr - 1),
+ null,
+ true
+ );
+
+ if ($this->tokens[$tokenBefore]['code'] === T_FUNCTION
+ || $this->tokens[$tokenBefore]['code'] === T_CLOSURE
+ || $this->tokens[$tokenBefore]['code'] === T_FN
+ ) {
+ // Function returns a reference.
+ return true;
+ }
+
+ if ($this->tokens[$tokenBefore]['code'] === T_DOUBLE_ARROW) {
+ // Inside a foreach loop or array assignment, this is a reference.
+ return true;
+ }
+
+ if ($this->tokens[$tokenBefore]['code'] === T_AS) {
+ // Inside a foreach loop, this is a reference.
+ return true;
+ }
+
+ if (isset(Util\Tokens::$assignmentTokens[$this->tokens[$tokenBefore]['code']]) === true) {
+ // This is directly after an assignment. It's a reference. Even if
+ // it is part of an operation, the other tests will handle it.
+ return true;
+ }
+
+ $tokenAfter = $this->findNext(
+ Util\Tokens::$emptyTokens,
+ ($stackPtr + 1),
+ null,
+ true
+ );
+
+ if ($this->tokens[$tokenAfter]['code'] === T_NEW) {
+ return true;
+ }
+
+ if (isset($this->tokens[$stackPtr]['nested_parenthesis']) === true) {
+ $brackets = $this->tokens[$stackPtr]['nested_parenthesis'];
+ $lastBracket = array_pop($brackets);
+ if (isset($this->tokens[$lastBracket]['parenthesis_owner']) === true) {
+ $owner = $this->tokens[$this->tokens[$lastBracket]['parenthesis_owner']];
+ if ($owner['code'] === T_FUNCTION
+ || $owner['code'] === T_CLOSURE
+ || $owner['code'] === T_FN
+ ) {
+ $params = $this->getMethodParameters($this->tokens[$lastBracket]['parenthesis_owner']);
+ foreach ($params as $param) {
+ if ($param['reference_token'] === $stackPtr) {
+ // Function parameter declared to be passed by reference.
+ return true;
+ }
+ }
+ }//end if
+ } else {
+ $prev = false;
+ for ($t = ($this->tokens[$lastBracket]['parenthesis_opener'] - 1); $t >= 0; $t--) {
+ if ($this->tokens[$t]['code'] !== T_WHITESPACE) {
+ $prev = $t;
+ break;
+ }
+ }
+
+ if ($prev !== false && $this->tokens[$prev]['code'] === T_USE) {
+ // Closure use by reference.
+ return true;
+ }
+ }//end if
+ }//end if
+
+ // Pass by reference in function calls and assign by reference in arrays.
+ if ($this->tokens[$tokenBefore]['code'] === T_OPEN_PARENTHESIS
+ || $this->tokens[$tokenBefore]['code'] === T_COMMA
+ || $this->tokens[$tokenBefore]['code'] === T_OPEN_SHORT_ARRAY
+ ) {
+ if ($this->tokens[$tokenAfter]['code'] === T_VARIABLE) {
+ return true;
+ } else {
+ $skip = Util\Tokens::$emptyTokens;
+ $skip[] = T_NS_SEPARATOR;
+ $skip[] = T_SELF;
+ $skip[] = T_PARENT;
+ $skip[] = T_STATIC;
+ $skip[] = T_STRING;
+ $skip[] = T_NAMESPACE;
+ $skip[] = T_DOUBLE_COLON;
+
+ $nextSignificantAfter = $this->findNext(
+ $skip,
+ ($stackPtr + 1),
+ null,
+ true
+ );
+ if ($this->tokens[$nextSignificantAfter]['code'] === T_VARIABLE) {
+ return true;
+ }
+ }//end if
+ }//end if
+
+ return false;
+
+ }//end isReference()
+
+
+ /**
+ * Returns the content of the tokens from the specified start position in
+ * the token stack for the specified length.
+ *
+ * @param int $start The position to start from in the token stack.
+ * @param int $length The length of tokens to traverse from the start pos.
+ * @param bool $origContent Whether the original content or the tab replaced
+ * content should be used.
+ *
+ * @return string The token contents.
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position does not exist.
+ */
+ public function getTokensAsString($start, $length, $origContent=false)
+ {
+ if (is_int($start) === false || isset($this->tokens[$start]) === false) {
+ throw new RuntimeException('The $start position for getTokensAsString() must exist in the token stack');
+ }
+
+ if (is_int($length) === false || $length <= 0) {
+ return '';
+ }
+
+ $str = '';
+ $end = ($start + $length);
+ if ($end > $this->numTokens) {
+ $end = $this->numTokens;
+ }
+
+ for ($i = $start; $i < $end; $i++) {
+ // If tabs are being converted to spaces by the tokeniser, the
+ // original content should be used instead of the converted content.
+ if ($origContent === true && isset($this->tokens[$i]['orig_content']) === true) {
+ $str .= $this->tokens[$i]['orig_content'];
+ } else {
+ $str .= $this->tokens[$i]['content'];
+ }
+ }
+
+ return $str;
+
+ }//end getTokensAsString()
+
+
+ /**
+ * Returns the position of the previous specified token(s).
+ *
+ * If a value is specified, the previous token of the specified type(s)
+ * containing the specified value will be returned.
+ *
+ * Returns false if no token can be found.
+ *
+ * @param int|string|array $types The type(s) of tokens to search for.
+ * @param int $start The position to start searching from in the
+ * token stack.
+ * @param int|null $end The end position to fail if no token is found.
+ * if not specified or null, end will default to
+ * the start of the token stack.
+ * @param bool $exclude If true, find the previous token that is NOT of
+ * the types specified in $types.
+ * @param string|null $value The value that the token(s) must be equal to.
+ * If value is omitted, tokens with any value will
+ * be returned.
+ * @param bool $local If true, tokens outside the current statement
+ * will not be checked. IE. checking will stop
+ * at the previous semi-colon found.
+ *
+ * @return int|false
+ * @see findNext()
+ */
+ public function findPrevious(
+ $types,
+ $start,
+ $end=null,
+ $exclude=false,
+ $value=null,
+ $local=false
+ ) {
+ $types = (array) $types;
+
+ if ($end === null) {
+ $end = 0;
+ }
+
+ for ($i = $start; $i >= $end; $i--) {
+ $found = (bool) $exclude;
+ foreach ($types as $type) {
+ if ($this->tokens[$i]['code'] === $type) {
+ $found = !$exclude;
+ break;
+ }
+ }
+
+ if ($found === true) {
+ if ($value === null) {
+ return $i;
+ } else if ($this->tokens[$i]['content'] === $value) {
+ return $i;
+ }
+ }
+
+ if ($local === true) {
+ if (isset($this->tokens[$i]['scope_opener']) === true
+ && $i === $this->tokens[$i]['scope_closer']
+ ) {
+ $i = $this->tokens[$i]['scope_opener'];
+ } else if (isset($this->tokens[$i]['bracket_opener']) === true
+ && $i === $this->tokens[$i]['bracket_closer']
+ ) {
+ $i = $this->tokens[$i]['bracket_opener'];
+ } else if (isset($this->tokens[$i]['parenthesis_opener']) === true
+ && $i === $this->tokens[$i]['parenthesis_closer']
+ ) {
+ $i = $this->tokens[$i]['parenthesis_opener'];
+ } else if ($this->tokens[$i]['code'] === T_SEMICOLON) {
+ break;
+ }
+ }
+ }//end for
+
+ return false;
+
+ }//end findPrevious()
+
+
+ /**
+ * Returns the position of the next specified token(s).
+ *
+ * If a value is specified, the next token of the specified type(s)
+ * containing the specified value will be returned.
+ *
+ * Returns false if no token can be found.
+ *
+ * @param int|string|array $types The type(s) of tokens to search for.
+ * @param int $start The position to start searching from in the
+ * token stack.
+ * @param int|null $end The end position to fail if no token is found.
+ * if not specified or null, end will default to
+ * the end of the token stack.
+ * @param bool $exclude If true, find the next token that is NOT of
+ * a type specified in $types.
+ * @param string|null $value The value that the token(s) must be equal to.
+ * If value is omitted, tokens with any value will
+ * be returned.
+ * @param bool $local If true, tokens outside the current statement
+ * will not be checked. i.e., checking will stop
+ * at the next semi-colon found.
+ *
+ * @return int|false
+ * @see findPrevious()
+ */
+ public function findNext(
+ $types,
+ $start,
+ $end=null,
+ $exclude=false,
+ $value=null,
+ $local=false
+ ) {
+ $types = (array) $types;
+
+ if ($end === null || $end > $this->numTokens) {
+ $end = $this->numTokens;
+ }
+
+ for ($i = $start; $i < $end; $i++) {
+ $found = (bool) $exclude;
+ foreach ($types as $type) {
+ if ($this->tokens[$i]['code'] === $type) {
+ $found = !$exclude;
+ break;
+ }
+ }
+
+ if ($found === true) {
+ if ($value === null) {
+ return $i;
+ } else if ($this->tokens[$i]['content'] === $value) {
+ return $i;
+ }
+ }
+
+ if ($local === true && $this->tokens[$i]['code'] === T_SEMICOLON) {
+ break;
+ }
+ }//end for
+
+ return false;
+
+ }//end findNext()
+
+
+ /**
+ * Returns the position of the first non-whitespace token in a statement.
+ *
+ * @param int $start The position to start searching from in the token stack.
+ * @param int|string|array $ignore Token types that should not be considered stop points.
+ *
+ * @return int
+ */
+ public function findStartOfStatement($start, $ignore=null)
+ {
+ $startTokens = Util\Tokens::$blockOpeners;
+ $startTokens[T_OPEN_SHORT_ARRAY] = true;
+ $startTokens[T_OPEN_TAG] = true;
+ $startTokens[T_OPEN_TAG_WITH_ECHO] = true;
+
+ $endTokens = [
+ T_CLOSE_TAG => true,
+ T_COLON => true,
+ T_COMMA => true,
+ T_DOUBLE_ARROW => true,
+ T_MATCH_ARROW => true,
+ T_SEMICOLON => true,
+ ];
+
+ if ($ignore !== null) {
+ $ignore = (array) $ignore;
+ foreach ($ignore as $code) {
+ if (isset($startTokens[$code]) === true) {
+ unset($startTokens[$code]);
+ }
+
+ if (isset($endTokens[$code]) === true) {
+ unset($endTokens[$code]);
+ }
+ }
+ }
+
+ // If the start token is inside the case part of a match expression,
+ // find the start of the condition. If it's in the statement part, find
+ // the token that comes after the match arrow.
+ $matchExpression = $this->getCondition($start, T_MATCH);
+ if ($matchExpression !== false) {
+ for ($prevMatch = $start; $prevMatch > $this->tokens[$matchExpression]['scope_opener']; $prevMatch--) {
+ if ($prevMatch !== $start
+ && ($this->tokens[$prevMatch]['code'] === T_MATCH_ARROW
+ || $this->tokens[$prevMatch]['code'] === T_COMMA)
+ ) {
+ break;
+ }
+
+ // Skip nested statements.
+ if (isset($this->tokens[$prevMatch]['bracket_opener']) === true
+ && $prevMatch === $this->tokens[$prevMatch]['bracket_closer']
+ ) {
+ $prevMatch = $this->tokens[$prevMatch]['bracket_opener'];
+ } else if (isset($this->tokens[$prevMatch]['parenthesis_opener']) === true
+ && $prevMatch === $this->tokens[$prevMatch]['parenthesis_closer']
+ ) {
+ $prevMatch = $this->tokens[$prevMatch]['parenthesis_opener'];
+ }
+ }
+
+ if ($prevMatch <= $this->tokens[$matchExpression]['scope_opener']) {
+ // We're before the arrow in the first case.
+ $next = $this->findNext(Util\Tokens::$emptyTokens, ($this->tokens[$matchExpression]['scope_opener'] + 1), null, true);
+ if ($next === false) {
+ return $start;
+ }
+
+ return $next;
+ }
+
+ if ($this->tokens[$prevMatch]['code'] === T_COMMA) {
+ // We're before the arrow, but not in the first case.
+ $prevMatchArrow = $this->findPrevious(T_MATCH_ARROW, ($prevMatch - 1), $this->tokens[$matchExpression]['scope_opener']);
+ if ($prevMatchArrow === false) {
+ // We're before the arrow in the first case.
+ $next = $this->findNext(Util\Tokens::$emptyTokens, ($this->tokens[$matchExpression]['scope_opener'] + 1), null, true);
+ return $next;
+ }
+
+ $end = $this->findEndOfStatement($prevMatchArrow);
+ $next = $this->findNext(Util\Tokens::$emptyTokens, ($end + 1), null, true);
+ return $next;
+ }
+ }//end if
+
+ $lastNotEmpty = $start;
+
+ // If we are starting at a token that ends a scope block, skip to
+ // the start and continue from there.
+ // If we are starting at a token that ends a statement, skip this
+ // token so we find the true start of the statement.
+ while (isset($endTokens[$this->tokens[$start]['code']]) === true
+ || (isset($this->tokens[$start]['scope_condition']) === true
+ && $start === $this->tokens[$start]['scope_closer'])
+ ) {
+ if (isset($this->tokens[$start]['scope_condition']) === true) {
+ $start = $this->tokens[$start]['scope_condition'];
+ } else {
+ $start--;
+ }
+ }
+
+ for ($i = $start; $i >= 0; $i--) {
+ if (isset($startTokens[$this->tokens[$i]['code']]) === true
+ || isset($endTokens[$this->tokens[$i]['code']]) === true
+ ) {
+ // Found the end of the previous statement.
+ return $lastNotEmpty;
+ }
+
+ if (isset($this->tokens[$i]['scope_opener']) === true
+ && $i === $this->tokens[$i]['scope_closer']
+ && $this->tokens[$i]['code'] !== T_CLOSE_PARENTHESIS
+ && $this->tokens[$i]['code'] !== T_END_NOWDOC
+ && $this->tokens[$i]['code'] !== T_END_HEREDOC
+ && $this->tokens[$i]['code'] !== T_BREAK
+ && $this->tokens[$i]['code'] !== T_RETURN
+ && $this->tokens[$i]['code'] !== T_CONTINUE
+ && $this->tokens[$i]['code'] !== T_THROW
+ && $this->tokens[$i]['code'] !== T_EXIT
+ ) {
+ // Found the end of the previous scope block.
+ return $lastNotEmpty;
+ }
+
+ // Skip nested statements.
+ if (isset($this->tokens[$i]['bracket_opener']) === true
+ && $i === $this->tokens[$i]['bracket_closer']
+ ) {
+ $i = $this->tokens[$i]['bracket_opener'];
+ } else if (isset($this->tokens[$i]['parenthesis_opener']) === true
+ && $i === $this->tokens[$i]['parenthesis_closer']
+ ) {
+ $i = $this->tokens[$i]['parenthesis_opener'];
+ } else if ($this->tokens[$i]['code'] === T_CLOSE_USE_GROUP) {
+ $start = $this->findPrevious(T_OPEN_USE_GROUP, ($i - 1));
+ if ($start !== false) {
+ $i = $start;
+ }
+ }//end if
+
+ if (isset(Util\Tokens::$emptyTokens[$this->tokens[$i]['code']]) === false) {
+ $lastNotEmpty = $i;
+ }
+ }//end for
+
+ return 0;
+
+ }//end findStartOfStatement()
+
+
+ /**
+ * Returns the position of the last non-whitespace token in a statement.
+ *
+ * @param int $start The position to start searching from in the token stack.
+ * @param int|string|array $ignore Token types that should not be considered stop points.
+ *
+ * @return int
+ */
+ public function findEndOfStatement($start, $ignore=null)
+ {
+ $endTokens = [
+ T_COLON => true,
+ T_COMMA => true,
+ T_DOUBLE_ARROW => true,
+ T_SEMICOLON => true,
+ T_CLOSE_PARENTHESIS => true,
+ T_CLOSE_SQUARE_BRACKET => true,
+ T_CLOSE_CURLY_BRACKET => true,
+ T_CLOSE_SHORT_ARRAY => true,
+ T_OPEN_TAG => true,
+ T_CLOSE_TAG => true,
+ ];
+
+ if ($ignore !== null) {
+ $ignore = (array) $ignore;
+ foreach ($ignore as $code) {
+ unset($endTokens[$code]);
+ }
+ }
+
+ // If the start token is inside the case part of a match expression,
+ // advance to the match arrow and continue looking for the
+ // end of the statement from there so that we skip over commas.
+ if ($this->tokens[$start]['code'] !== T_MATCH_ARROW) {
+ $matchExpression = $this->getCondition($start, T_MATCH);
+ if ($matchExpression !== false) {
+ $beforeArrow = true;
+ $prevMatchArrow = $this->findPrevious(T_MATCH_ARROW, ($start - 1), $this->tokens[$matchExpression]['scope_opener']);
+ if ($prevMatchArrow !== false) {
+ $prevComma = $this->findNext(T_COMMA, ($prevMatchArrow + 1), $start);
+ if ($prevComma === false) {
+ // No comma between this token and the last match arrow,
+ // so this token exists after the arrow and we can continue
+ // checking as normal.
+ $beforeArrow = false;
+ }
+ }
+
+ if ($beforeArrow === true) {
+ $nextMatchArrow = $this->findNext(T_MATCH_ARROW, ($start + 1), $this->tokens[$matchExpression]['scope_closer']);
+ if ($nextMatchArrow !== false) {
+ $start = $nextMatchArrow;
+ }
+ }
+ }//end if
+ }//end if
+
+ $lastNotEmpty = $start;
+ for ($i = $start; $i < $this->numTokens; $i++) {
+ if ($i !== $start && isset($endTokens[$this->tokens[$i]['code']]) === true) {
+ // Found the end of the statement.
+ if ($this->tokens[$i]['code'] === T_CLOSE_PARENTHESIS
+ || $this->tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET
+ || $this->tokens[$i]['code'] === T_CLOSE_CURLY_BRACKET
+ || $this->tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
+ || $this->tokens[$i]['code'] === T_OPEN_TAG
+ || $this->tokens[$i]['code'] === T_CLOSE_TAG
+ ) {
+ return $lastNotEmpty;
+ }
+
+ return $i;
+ }
+
+ // Skip nested statements.
+ if (isset($this->tokens[$i]['scope_closer']) === true
+ && ($i === $this->tokens[$i]['scope_opener']
+ || $i === $this->tokens[$i]['scope_condition'])
+ ) {
+ if ($this->tokens[$i]['code'] === T_FN) {
+ $lastNotEmpty = $this->tokens[$i]['scope_closer'];
+ $i = ($this->tokens[$i]['scope_closer'] - 1);
+ continue;
+ }
+
+ if ($i === $start && isset(Util\Tokens::$scopeOpeners[$this->tokens[$i]['code']]) === true) {
+ return $this->tokens[$i]['scope_closer'];
+ }
+
+ $i = $this->tokens[$i]['scope_closer'];
+ } else if (isset($this->tokens[$i]['bracket_closer']) === true
+ && $i === $this->tokens[$i]['bracket_opener']
+ ) {
+ $i = $this->tokens[$i]['bracket_closer'];
+ } else if (isset($this->tokens[$i]['parenthesis_closer']) === true
+ && $i === $this->tokens[$i]['parenthesis_opener']
+ ) {
+ $i = $this->tokens[$i]['parenthesis_closer'];
+ } else if ($this->tokens[$i]['code'] === T_OPEN_USE_GROUP) {
+ $end = $this->findNext(T_CLOSE_USE_GROUP, ($i + 1));
+ if ($end !== false) {
+ $i = $end;
+ }
+ }//end if
+
+ if (isset(Util\Tokens::$emptyTokens[$this->tokens[$i]['code']]) === false) {
+ $lastNotEmpty = $i;
+ }
+ }//end for
+
+ return ($this->numTokens - 1);
+
+ }//end findEndOfStatement()
+
+
+ /**
+ * Returns the position of the first token on a line, matching given type.
+ *
+ * Returns false if no token can be found.
+ *
+ * @param int|string|array $types The type(s) of tokens to search for.
+ * @param int $start The position to start searching from in the
+ * token stack. The first token matching on
+ * this line before this token will be returned.
+ * @param bool $exclude If true, find the token that is NOT of
+ * the types specified in $types.
+ * @param string $value The value that the token must be equal to.
+ * If value is omitted, tokens with any value will
+ * be returned.
+ *
+ * @return int|false
+ */
+ public function findFirstOnLine($types, $start, $exclude=false, $value=null)
+ {
+ if (is_array($types) === false) {
+ $types = [$types];
+ }
+
+ $foundToken = false;
+
+ for ($i = $start; $i >= 0; $i--) {
+ if ($this->tokens[$i]['line'] < $this->tokens[$start]['line']) {
+ break;
+ }
+
+ $found = $exclude;
+ foreach ($types as $type) {
+ if ($exclude === false) {
+ if ($this->tokens[$i]['code'] === $type) {
+ $found = true;
+ break;
+ }
+ } else {
+ if ($this->tokens[$i]['code'] === $type) {
+ $found = false;
+ break;
+ }
+ }
+ }
+
+ if ($found === true) {
+ if ($value === null) {
+ $foundToken = $i;
+ } else if ($this->tokens[$i]['content'] === $value) {
+ $foundToken = $i;
+ }
+ }
+ }//end for
+
+ return $foundToken;
+
+ }//end findFirstOnLine()
+
+
+ /**
+ * Determine if the passed token has a condition of one of the passed types.
+ *
+ * @param int $stackPtr The position of the token we are checking.
+ * @param int|string|array $types The type(s) of tokens to search for.
+ *
+ * @return boolean
+ */
+ public function hasCondition($stackPtr, $types)
+ {
+ // Check for the existence of the token.
+ if (isset($this->tokens[$stackPtr]) === false) {
+ return false;
+ }
+
+ // Make sure the token has conditions.
+ if (isset($this->tokens[$stackPtr]['conditions']) === false) {
+ return false;
+ }
+
+ $types = (array) $types;
+ $conditions = $this->tokens[$stackPtr]['conditions'];
+
+ foreach ($types as $type) {
+ if (in_array($type, $conditions, true) === true) {
+ // We found a token with the required type.
+ return true;
+ }
+ }
+
+ return false;
+
+ }//end hasCondition()
+
+
+ /**
+ * Return the position of the condition for the passed token.
+ *
+ * Returns FALSE if the token does not have the condition.
+ *
+ * @param int $stackPtr The position of the token we are checking.
+ * @param int|string $type The type of token to search for.
+ * @param bool $first If TRUE, will return the matched condition
+ * furthest away from the passed token.
+ * If FALSE, will return the matched condition
+ * closest to the passed token.
+ *
+ * @return int|false
+ */
+ public function getCondition($stackPtr, $type, $first=true)
+ {
+ // Check for the existence of the token.
+ if (isset($this->tokens[$stackPtr]) === false) {
+ return false;
+ }
+
+ // Make sure the token has conditions.
+ if (isset($this->tokens[$stackPtr]['conditions']) === false) {
+ return false;
+ }
+
+ $conditions = $this->tokens[$stackPtr]['conditions'];
+ if ($first === false) {
+ $conditions = array_reverse($conditions, true);
+ }
+
+ foreach ($conditions as $token => $condition) {
+ if ($condition === $type) {
+ return $token;
+ }
+ }
+
+ return false;
+
+ }//end getCondition()
+
+
+ /**
+ * Returns the name of the class that the specified class extends.
+ * (works for classes, anonymous classes and interfaces)
+ *
+ * Returns FALSE on error or if there is no extended class name.
+ *
+ * @param int $stackPtr The stack position of the class.
+ *
+ * @return string|false
+ */
+ public function findExtendedClassName($stackPtr)
+ {
+ // Check for the existence of the token.
+ if (isset($this->tokens[$stackPtr]) === false) {
+ return false;
+ }
+
+ if ($this->tokens[$stackPtr]['code'] !== T_CLASS
+ && $this->tokens[$stackPtr]['code'] !== T_ANON_CLASS
+ && $this->tokens[$stackPtr]['code'] !== T_INTERFACE
+ ) {
+ return false;
+ }
+
+ if (isset($this->tokens[$stackPtr]['scope_opener']) === false) {
+ return false;
+ }
+
+ $classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
+ $extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classOpenerIndex);
+ if ($extendsIndex === false) {
+ return false;
+ }
+
+ $find = [
+ T_NS_SEPARATOR,
+ T_STRING,
+ T_WHITESPACE,
+ ];
+
+ $end = $this->findNext($find, ($extendsIndex + 1), ($classOpenerIndex + 1), true);
+ $name = $this->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
+ $name = trim($name);
+
+ if ($name === '') {
+ return false;
+ }
+
+ return $name;
+
+ }//end findExtendedClassName()
+
+
+ /**
+ * Returns the names of the interfaces that the specified class or enum implements.
+ *
+ * Returns FALSE on error or if there are no implemented interface names.
+ *
+ * @param int $stackPtr The stack position of the class or enum token.
+ *
+ * @return array|false
+ */
+ public function findImplementedInterfaceNames($stackPtr)
+ {
+ // Check for the existence of the token.
+ if (isset($this->tokens[$stackPtr]) === false) {
+ return false;
+ }
+
+ if ($this->tokens[$stackPtr]['code'] !== T_CLASS
+ && $this->tokens[$stackPtr]['code'] !== T_ANON_CLASS
+ && $this->tokens[$stackPtr]['code'] !== T_ENUM
+ ) {
+ return false;
+ }
+
+ if (isset($this->tokens[$stackPtr]['scope_closer']) === false) {
+ return false;
+ }
+
+ $classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
+ $implementsIndex = $this->findNext(T_IMPLEMENTS, $stackPtr, $classOpenerIndex);
+ if ($implementsIndex === false) {
+ return false;
+ }
+
+ $find = [
+ T_NS_SEPARATOR,
+ T_STRING,
+ T_WHITESPACE,
+ T_COMMA,
+ ];
+
+ $end = $this->findNext($find, ($implementsIndex + 1), ($classOpenerIndex + 1), true);
+ $name = $this->getTokensAsString(($implementsIndex + 1), ($end - $implementsIndex - 1));
+ $name = trim($name);
+
+ if ($name === '') {
+ return false;
+ } else {
+ $names = explode(',', $name);
+ $names = array_map('trim', $names);
+ return $names;
+ }
+
+ }//end findImplementedInterfaceNames()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Files/FileList.php b/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
new file mode 100644
index 00000000..66833a3e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
@@ -0,0 +1,255 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Files;
+
+use PHP_CodeSniffer\Autoload;
+use PHP_CodeSniffer\Util;
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+use ReturnTypeWillChange;
+
+class FileList implements \Iterator, \Countable
+{
+
+ /**
+ * A list of file paths that are included in the list.
+ *
+ * @var array
+ */
+ private $files = [];
+
+ /**
+ * The number of files in the list.
+ *
+ * @var integer
+ */
+ private $numFiles = 0;
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ public $config = null;
+
+ /**
+ * The ruleset used for the run.
+ *
+ * @var \PHP_CodeSniffer\Ruleset
+ */
+ public $ruleset = null;
+
+ /**
+ * An array of patterns to use for skipping files.
+ *
+ * @var array
+ */
+ protected $ignorePatterns = [];
+
+
+ /**
+ * Constructs a file list and loads in an array of file paths to process.
+ *
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ *
+ * @return void
+ */
+ public function __construct(Config $config, Ruleset $ruleset)
+ {
+ $this->ruleset = $ruleset;
+ $this->config = $config;
+
+ $paths = $config->files;
+ foreach ($paths as $path) {
+ $isPharFile = Util\Common::isPharFile($path);
+ if (is_dir($path) === true || $isPharFile === true) {
+ if ($isPharFile === true) {
+ $path = 'phar://'.$path;
+ }
+
+ $filterClass = $this->getFilterClass();
+
+ $di = new \RecursiveDirectoryIterator($path, (\RecursiveDirectoryIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS));
+ $filter = new $filterClass($di, $path, $config, $ruleset);
+ $iterator = new \RecursiveIteratorIterator($filter);
+
+ foreach ($iterator as $file) {
+ $this->files[$file->getPathname()] = null;
+ $this->numFiles++;
+ }
+ } else {
+ $this->addFile($path);
+ }//end if
+ }//end foreach
+
+ reset($this->files);
+
+ }//end __construct()
+
+
+ /**
+ * Add a file to the list.
+ *
+ * If a file object has already been created, it can be passed here.
+ * If it is left NULL, it will be created when accessed.
+ *
+ * @param string $path The path to the file being added.
+ * @param \PHP_CodeSniffer\Files\File $file The file being added.
+ *
+ * @return void
+ */
+ public function addFile($path, $file=null)
+ {
+ // No filtering is done for STDIN when the filename
+ // has not been specified.
+ if ($path === 'STDIN') {
+ $this->files[$path] = $file;
+ $this->numFiles++;
+ return;
+ }
+
+ $filterClass = $this->getFilterClass();
+
+ $di = new \RecursiveArrayIterator([$path]);
+ $filter = new $filterClass($di, $path, $this->config, $this->ruleset);
+ $iterator = new \RecursiveIteratorIterator($filter);
+
+ foreach ($iterator as $path) {
+ $this->files[$path] = $file;
+ $this->numFiles++;
+ }
+
+ }//end addFile()
+
+
+ /**
+ * Get the class name of the filter being used for the run.
+ *
+ * @return string
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the specified filter could not be found.
+ */
+ private function getFilterClass()
+ {
+ $filterType = $this->config->filter;
+
+ if ($filterType === null) {
+ $filterClass = '\PHP_CodeSniffer\Filters\Filter';
+ } else {
+ if (strpos($filterType, '.') !== false) {
+ // This is a path to a custom filter class.
+ $filename = realpath($filterType);
+ if ($filename === false) {
+ $error = "ERROR: Custom filter \"$filterType\" not found".PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $filterClass = Autoload::loadFile($filename);
+ } else {
+ $filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType;
+ }
+ }
+
+ return $filterClass;
+
+ }//end getFilterClass()
+
+
+ /**
+ * Rewind the iterator to the first file.
+ *
+ * @return void
+ */
+ #[ReturnTypeWillChange]
+ public function rewind()
+ {
+ reset($this->files);
+
+ }//end rewind()
+
+
+ /**
+ * Get the file that is currently being processed.
+ *
+ * @return \PHP_CodeSniffer\Files\File
+ */
+ #[ReturnTypeWillChange]
+ public function current()
+ {
+ $path = key($this->files);
+ if (isset($this->files[$path]) === false) {
+ $this->files[$path] = new LocalFile($path, $this->ruleset, $this->config);
+ }
+
+ return $this->files[$path];
+
+ }//end current()
+
+
+ /**
+ * Return the file path of the current file being processed.
+ *
+ * @return void
+ */
+ #[ReturnTypeWillChange]
+ public function key()
+ {
+ return key($this->files);
+
+ }//end key()
+
+
+ /**
+ * Move forward to the next file.
+ *
+ * @return void
+ */
+ #[ReturnTypeWillChange]
+ public function next()
+ {
+ next($this->files);
+
+ }//end next()
+
+
+ /**
+ * Checks if current position is valid.
+ *
+ * @return boolean
+ */
+ #[ReturnTypeWillChange]
+ public function valid()
+ {
+ if (current($this->files) === false) {
+ return false;
+ }
+
+ return true;
+
+ }//end valid()
+
+
+ /**
+ * Return the number of files in the list.
+ *
+ * @return integer
+ */
+ #[ReturnTypeWillChange]
+ public function count()
+ {
+ return $this->numFiles;
+
+ }//end count()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php b/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
new file mode 100644
index 00000000..ca2e74ad
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
@@ -0,0 +1,219 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Files;
+
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Util\Cache;
+use PHP_CodeSniffer\Util\Common;
+
+class LocalFile extends File
+{
+
+
+ /**
+ * Creates a LocalFile object and sets the content.
+ *
+ * @param string $path The absolute path to the file.
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ *
+ * @return void
+ */
+ public function __construct($path, Ruleset $ruleset, Config $config)
+ {
+ $this->path = trim($path);
+ if (Common::isReadable($this->path) === false) {
+ parent::__construct($this->path, $ruleset, $config);
+ $error = 'Error opening file; file no longer exists or you do not have access to read the file';
+ $this->addMessage(true, $error, 1, 1, 'Internal.LocalFile', [], 5, false);
+ $this->ignored = true;
+ return;
+ }
+
+ // Before we go and spend time tokenizing this file, just check
+ // to see if there is a tag up top to indicate that the whole
+ // file should be ignored. It must be on one of the first two lines.
+ if ($config->annotations === true) {
+ $handle = fopen($this->path, 'r');
+ if ($handle !== false) {
+ $firstContent = fgets($handle);
+ $firstContent .= fgets($handle);
+ fclose($handle);
+
+ if (strpos($firstContent, '@codingStandardsIgnoreFile') !== false
+ || stripos($firstContent, 'phpcs:ignorefile') !== false
+ ) {
+ // We are ignoring the whole file.
+ $this->ignored = true;
+ return;
+ }
+ }
+ }
+
+ $this->reloadContent();
+
+ parent::__construct($this->path, $ruleset, $config);
+
+ }//end __construct()
+
+
+ /**
+ * Loads the latest version of the file's content from the file system.
+ *
+ * @return void
+ */
+ public function reloadContent()
+ {
+ $this->setContent(file_get_contents($this->path));
+
+ }//end reloadContent()
+
+
+ /**
+ * Processes the file.
+ *
+ * @return void
+ */
+ public function process()
+ {
+ if ($this->ignored === true) {
+ return;
+ }
+
+ if ($this->configCache['cache'] === false) {
+ parent::process();
+ return;
+ }
+
+ $hash = md5_file($this->path);
+ $hash .= fileperms($this->path);
+ $cache = Cache::get($this->path);
+ if ($cache !== false && $cache['hash'] === $hash) {
+ // We can't filter metrics, so just load all of them.
+ $this->metrics = $cache['metrics'];
+
+ if ($this->configCache['recordErrors'] === true) {
+ // Replay the cached errors and warnings to filter out the ones
+ // we don't need for this specific run.
+ $this->configCache['cache'] = false;
+ $this->replayErrors($cache['errors'], $cache['warnings']);
+ $this->configCache['cache'] = true;
+ } else {
+ $this->errorCount = $cache['errorCount'];
+ $this->warningCount = $cache['warningCount'];
+ $this->fixableCount = $cache['fixableCount'];
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0
+ || (PHP_CODESNIFFER_CBF === true && empty($this->config->files) === false)
+ ) {
+ echo "[loaded from cache]... ";
+ }
+
+ $this->numTokens = $cache['numTokens'];
+ $this->fromCache = true;
+ return;
+ }//end if
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+
+ parent::process();
+
+ $cache = [
+ 'hash' => $hash,
+ 'errors' => $this->errors,
+ 'warnings' => $this->warnings,
+ 'metrics' => $this->metrics,
+ 'errorCount' => $this->errorCount,
+ 'warningCount' => $this->warningCount,
+ 'fixableCount' => $this->fixableCount,
+ 'numTokens' => $this->numTokens,
+ ];
+
+ Cache::set($this->path, $cache);
+
+ // During caching, we don't filter out errors in any way, so
+ // we need to do that manually now by replaying them.
+ if ($this->configCache['recordErrors'] === true) {
+ $this->configCache['cache'] = false;
+ $this->replayErrors($this->errors, $this->warnings);
+ $this->configCache['cache'] = true;
+ }
+
+ }//end process()
+
+
+ /**
+ * Clears and replays error and warnings for the file.
+ *
+ * Replaying errors and warnings allows for filtering rules to be changed
+ * and then errors and warnings to be reapplied with the new rules. This is
+ * particularly useful while caching.
+ *
+ * @param array $errors The list of errors to replay.
+ * @param array $warnings The list of warnings to replay.
+ *
+ * @return void
+ */
+ private function replayErrors($errors, $warnings)
+ {
+ $this->errors = [];
+ $this->warnings = [];
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+
+ $this->replayingErrors = true;
+
+ foreach ($errors as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $this->activeListener = $error['listener'];
+ $this->addMessage(
+ true,
+ $error['message'],
+ $line,
+ $column,
+ $error['source'],
+ [],
+ $error['severity'],
+ $error['fixable']
+ );
+ }
+ }
+ }
+
+ foreach ($warnings as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $this->activeListener = $error['listener'];
+ $this->addMessage(
+ false,
+ $error['message'],
+ $line,
+ $column,
+ $error['source'],
+ [],
+ $error['severity'],
+ $error['fixable']
+ );
+ }
+ }
+ }
+
+ $this->replayingErrors = false;
+
+ }//end replayErrors()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Filters/ExactMatch.php b/vendor/squizlabs/php_codesniffer/src/Filters/ExactMatch.php
new file mode 100644
index 00000000..13af8ff2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/ExactMatch.php
@@ -0,0 +1,108 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Filters;
+
+use PHP_CodeSniffer\Util;
+
+abstract class ExactMatch extends Filter
+{
+
+ /**
+ * A list of files to exclude.
+ *
+ * @var array
+ */
+ private $blacklist = null;
+
+ /**
+ * A list of files to include.
+ *
+ * If the whitelist is empty, only files in the blacklist will be excluded.
+ *
+ * @var array
+ */
+ private $whitelist = null;
+
+
+ /**
+ * Check whether the current element of the iterator is acceptable.
+ *
+ * If a file is both blacklisted and whitelisted, it will be deemed unacceptable.
+ *
+ * @return bool
+ */
+ public function accept()
+ {
+ if (parent::accept() === false) {
+ return false;
+ }
+
+ if ($this->blacklist === null) {
+ $this->blacklist = $this->getblacklist();
+ }
+
+ if ($this->whitelist === null) {
+ $this->whitelist = $this->getwhitelist();
+ }
+
+ $filePath = Util\Common::realpath($this->current());
+
+ // If file is both blacklisted and whitelisted, the blacklist takes precedence.
+ if (isset($this->blacklist[$filePath]) === true) {
+ return false;
+ }
+
+ if (empty($this->whitelist) === true && empty($this->blacklist) === false) {
+ // We are only checking a blacklist, so everything else should be whitelisted.
+ return true;
+ }
+
+ return isset($this->whitelist[$filePath]);
+
+ }//end accept()
+
+
+ /**
+ * Returns an iterator for the current entry.
+ *
+ * Ensures that the blacklist and whitelist are preserved so they don't have
+ * to be generated each time.
+ *
+ * @return \RecursiveIterator
+ */
+ public function getChildren()
+ {
+ $children = parent::getChildren();
+ $children->blacklist = $this->blacklist;
+ $children->whitelist = $this->whitelist;
+ return $children;
+
+ }//end getChildren()
+
+
+ /**
+ * Get a list of blacklisted file paths.
+ *
+ * @return array
+ */
+ abstract protected function getBlacklist();
+
+
+ /**
+ * Get a list of whitelisted file paths.
+ *
+ * @return array
+ */
+ abstract protected function getWhitelist();
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php b/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
new file mode 100644
index 00000000..a1246a2c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
@@ -0,0 +1,285 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Filters;
+
+use PHP_CodeSniffer\Util;
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+use ReturnTypeWillChange;
+
+class Filter extends \RecursiveFilterIterator
+{
+
+ /**
+ * The top-level path we are filtering.
+ *
+ * @var string
+ */
+ protected $basedir = null;
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ protected $config = null;
+
+ /**
+ * The ruleset used for the run.
+ *
+ * @var \PHP_CodeSniffer\Ruleset
+ */
+ protected $ruleset = null;
+
+ /**
+ * A list of ignore patterns that apply to directories only.
+ *
+ * @var array
+ */
+ protected $ignoreDirPatterns = null;
+
+ /**
+ * A list of ignore patterns that apply to files only.
+ *
+ * @var array
+ */
+ protected $ignoreFilePatterns = null;
+
+ /**
+ * A list of file paths we've already accepted.
+ *
+ * Used to ensure we aren't following circular symlinks.
+ *
+ * @var array
+ */
+ protected $acceptedPaths = [];
+
+
+ /**
+ * Constructs a filter.
+ *
+ * @param \RecursiveIterator $iterator The iterator we are using to get file paths.
+ * @param string $basedir The top-level path we are filtering.
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ *
+ * @return void
+ */
+ public function __construct($iterator, $basedir, Config $config, Ruleset $ruleset)
+ {
+ parent::__construct($iterator);
+ $this->basedir = $basedir;
+ $this->config = $config;
+ $this->ruleset = $ruleset;
+
+ }//end __construct()
+
+
+ /**
+ * Check whether the current element of the iterator is acceptable.
+ *
+ * Files are checked for allowed extensions and ignore patterns.
+ * Directories are checked for ignore patterns only.
+ *
+ * @return bool
+ */
+ #[ReturnTypeWillChange]
+ public function accept()
+ {
+ $filePath = $this->current();
+ $realPath = Util\Common::realpath($filePath);
+
+ if ($realPath !== false) {
+ // It's a real path somewhere, so record it
+ // to check for circular symlinks.
+ if (isset($this->acceptedPaths[$realPath]) === true) {
+ // We've been here before.
+ return false;
+ }
+ }
+
+ $filePath = $this->current();
+ if (is_dir($filePath) === true) {
+ if ($this->config->local === true) {
+ return false;
+ }
+ } else if ($this->shouldProcessFile($filePath) === false) {
+ return false;
+ }
+
+ if ($this->shouldIgnorePath($filePath) === true) {
+ return false;
+ }
+
+ $this->acceptedPaths[$realPath] = true;
+ return true;
+
+ }//end accept()
+
+
+ /**
+ * Returns an iterator for the current entry.
+ *
+ * Ensures that the ignore patterns are preserved so they don't have
+ * to be generated each time.
+ *
+ * @return \RecursiveIterator
+ */
+ #[ReturnTypeWillChange]
+ public function getChildren()
+ {
+ $filterClass = get_called_class();
+ $children = new $filterClass(
+ new \RecursiveDirectoryIterator($this->current(), (\RecursiveDirectoryIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS)),
+ $this->basedir,
+ $this->config,
+ $this->ruleset
+ );
+
+ // Set the ignore patterns so we don't have to generate them again.
+ $children->ignoreDirPatterns = $this->ignoreDirPatterns;
+ $children->ignoreFilePatterns = $this->ignoreFilePatterns;
+ $children->acceptedPaths = $this->acceptedPaths;
+ return $children;
+
+ }//end getChildren()
+
+
+ /**
+ * Checks filtering rules to see if a file should be checked.
+ *
+ * Checks both file extension filters and path ignore filters.
+ *
+ * @param string $path The path to the file being checked.
+ *
+ * @return bool
+ */
+ protected function shouldProcessFile($path)
+ {
+ // Check that the file's extension is one we are checking.
+ // We are strict about checking the extension and we don't
+ // let files through with no extension or that start with a dot.
+ $fileName = basename($path);
+ $fileParts = explode('.', $fileName);
+ if ($fileParts[0] === $fileName || $fileParts[0] === '') {
+ return false;
+ }
+
+ // Checking multi-part file extensions, so need to create a
+ // complete extension list and make sure one is allowed.
+ $extensions = [];
+ array_shift($fileParts);
+ foreach ($fileParts as $part) {
+ $extensions[implode('.', $fileParts)] = 1;
+ array_shift($fileParts);
+ }
+
+ $matches = array_intersect_key($extensions, $this->config->extensions);
+ if (empty($matches) === true) {
+ return false;
+ }
+
+ return true;
+
+ }//end shouldProcessFile()
+
+
+ /**
+ * Checks filtering rules to see if a path should be ignored.
+ *
+ * @param string $path The path to the file or directory being checked.
+ *
+ * @return bool
+ */
+ protected function shouldIgnorePath($path)
+ {
+ if ($this->ignoreFilePatterns === null) {
+ $this->ignoreDirPatterns = [];
+ $this->ignoreFilePatterns = [];
+
+ $ignorePatterns = $this->config->ignored;
+ $rulesetIgnorePatterns = $this->ruleset->getIgnorePatterns();
+ foreach ($rulesetIgnorePatterns as $pattern => $type) {
+ // Ignore standard/sniff specific exclude rules.
+ if (is_array($type) === true) {
+ continue;
+ }
+
+ $ignorePatterns[$pattern] = $type;
+ }
+
+ foreach ($ignorePatterns as $pattern => $type) {
+ // If the ignore pattern ends with /* then it is ignoring an entire directory.
+ if (substr($pattern, -2) === '/*') {
+ // Need to check this pattern for dirs as well as individual file paths.
+ $this->ignoreFilePatterns[$pattern] = $type;
+
+ $pattern = substr($pattern, 0, -2).'(?=/|$)';
+ $this->ignoreDirPatterns[$pattern] = $type;
+ } else {
+ // This is a file-specific pattern, so only need to check this
+ // for individual file paths.
+ $this->ignoreFilePatterns[$pattern] = $type;
+ }
+ }
+ }//end if
+
+ $relativePath = $path;
+ if (strpos($path, $this->basedir) === 0) {
+ // The +1 cuts off the directory separator as well.
+ $relativePath = substr($path, (strlen($this->basedir) + 1));
+ }
+
+ if (is_dir($path) === true) {
+ $ignorePatterns = $this->ignoreDirPatterns;
+ } else {
+ $ignorePatterns = $this->ignoreFilePatterns;
+ }
+
+ foreach ($ignorePatterns as $pattern => $type) {
+ // Maintains backwards compatibility in case the ignore pattern does
+ // not have a relative/absolute value.
+ if (is_int($pattern) === true) {
+ $pattern = $type;
+ $type = 'absolute';
+ }
+
+ $replacements = [
+ '\\,' => ',',
+ '*' => '.*',
+ ];
+
+ // We assume a / directory separator, as do the exclude rules
+ // most developers write, so we need a special case for any system
+ // that is different.
+ if (DIRECTORY_SEPARATOR === '\\') {
+ $replacements['/'] = '\\\\';
+ }
+
+ $pattern = strtr($pattern, $replacements);
+
+ if ($type === 'relative') {
+ $testPath = $relativePath;
+ } else {
+ $testPath = $path;
+ }
+
+ $pattern = '`'.$pattern.'`i';
+ if (preg_match($pattern, $testPath) === 1) {
+ return true;
+ }
+ }//end foreach
+
+ return false;
+
+ }//end shouldIgnorePath()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Filters/GitModified.php b/vendor/squizlabs/php_codesniffer/src/Filters/GitModified.php
new file mode 100644
index 00000000..4b6ef3fc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/GitModified.php
@@ -0,0 +1,66 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Filters;
+
+use PHP_CodeSniffer\Util;
+
+class GitModified extends ExactMatch
+{
+
+
+ /**
+ * Get a list of blacklisted file paths.
+ *
+ * @return array
+ */
+ protected function getBlacklist()
+ {
+ return [];
+
+ }//end getBlacklist()
+
+
+ /**
+ * Get a list of whitelisted file paths.
+ *
+ * @return array
+ */
+ protected function getWhitelist()
+ {
+ $modified = [];
+
+ $cmd = 'git ls-files -o -m --exclude-standard -- '.escapeshellarg($this->basedir);
+ $output = [];
+ exec($cmd, $output);
+
+ $basedir = $this->basedir;
+ if (is_dir($basedir) === false) {
+ $basedir = dirname($basedir);
+ }
+
+ foreach ($output as $path) {
+ $path = Util\Common::realpath($path);
+
+ if ($path === false) {
+ continue;
+ }
+
+ do {
+ $modified[$path] = true;
+ $path = dirname($path);
+ } while ($path !== $basedir);
+ }
+
+ return $modified;
+
+ }//end getWhitelist()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Filters/GitStaged.php b/vendor/squizlabs/php_codesniffer/src/Filters/GitStaged.php
new file mode 100644
index 00000000..fcb92c3d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/GitStaged.php
@@ -0,0 +1,68 @@
+
+ * @copyright 2018 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Filters;
+
+use PHP_CodeSniffer\Util;
+
+class GitStaged extends ExactMatch
+{
+
+
+ /**
+ * Get a list of blacklisted file paths.
+ *
+ * @return array
+ */
+ protected function getBlacklist()
+ {
+ return [];
+
+ }//end getBlacklist()
+
+
+ /**
+ * Get a list of whitelisted file paths.
+ *
+ * @return array
+ */
+ protected function getWhitelist()
+ {
+ $modified = [];
+
+ $cmd = 'git diff --cached --name-only -- '.escapeshellarg($this->basedir);
+ $output = [];
+ exec($cmd, $output);
+
+ $basedir = $this->basedir;
+ if (is_dir($basedir) === false) {
+ $basedir = dirname($basedir);
+ }
+
+ foreach ($output as $path) {
+ $path = Util\Common::realpath($path);
+ if ($path === false) {
+ // Skip deleted files.
+ continue;
+ }
+
+ do {
+ $modified[$path] = true;
+ $path = dirname($path);
+ } while ($path !== $basedir);
+ }
+
+ return $modified;
+
+ }//end getWhitelist()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Fixer.php b/vendor/squizlabs/php_codesniffer/src/Fixer.php
new file mode 100644
index 00000000..b8dc05b1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Fixer.php
@@ -0,0 +1,806 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Common;
+
+class Fixer
+{
+
+ /**
+ * Is the fixer enabled and fixing a file?
+ *
+ * Sniffs should check this value to ensure they are not
+ * doing extra processing to prepare for a fix when fixing is
+ * not required.
+ *
+ * @var boolean
+ */
+ public $enabled = false;
+
+ /**
+ * The number of times we have looped over a file.
+ *
+ * @var integer
+ */
+ public $loops = 0;
+
+ /**
+ * The file being fixed.
+ *
+ * @var \PHP_CodeSniffer\Files\File
+ */
+ private $currentFile = null;
+
+ /**
+ * The list of tokens that make up the file contents.
+ *
+ * This is a simplified list which just contains the token content and nothing
+ * else. This is the array that is updated as fixes are made, not the file's
+ * token array. Imploding this array will give you the file content back.
+ *
+ * @var array
+ */
+ private $tokens = [];
+
+ /**
+ * A list of tokens that have already been fixed.
+ *
+ * We don't allow the same token to be fixed more than once each time
+ * through a file as this can easily cause conflicts between sniffs.
+ *
+ * @var int[]
+ */
+ private $fixedTokens = [];
+
+ /**
+ * The last value of each fixed token.
+ *
+ * If a token is being "fixed" back to its last value, the fix is
+ * probably conflicting with another.
+ *
+ * @var array
+ */
+ private $oldTokenValues = [];
+
+ /**
+ * A list of tokens that have been fixed during a changeset.
+ *
+ * All changes in changeset must be able to be applied, or else
+ * the entire changeset is rejected.
+ *
+ * @var array
+ */
+ private $changeset = [];
+
+ /**
+ * Is there an open changeset.
+ *
+ * @var boolean
+ */
+ private $inChangeset = false;
+
+ /**
+ * Is the current fixing loop in conflict?
+ *
+ * @var boolean
+ */
+ private $inConflict = false;
+
+ /**
+ * The number of fixes that have been performed.
+ *
+ * @var integer
+ */
+ private $numFixes = 0;
+
+
+ /**
+ * Starts fixing a new file.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being fixed.
+ *
+ * @return void
+ */
+ public function startFile(File $phpcsFile)
+ {
+ $this->currentFile = $phpcsFile;
+ $this->numFixes = 0;
+ $this->fixedTokens = [];
+
+ $tokens = $phpcsFile->getTokens();
+ $this->tokens = [];
+ foreach ($tokens as $index => $token) {
+ if (isset($token['orig_content']) === true) {
+ $this->tokens[$index] = $token['orig_content'];
+ } else {
+ $this->tokens[$index] = $token['content'];
+ }
+ }
+
+ }//end startFile()
+
+
+ /**
+ * Attempt to fix the file by processing it until no fixes are made.
+ *
+ * @return boolean
+ */
+ public function fixFile()
+ {
+ $fixable = $this->currentFile->getFixableCount();
+ if ($fixable === 0) {
+ // Nothing to fix.
+ return false;
+ }
+
+ $this->enabled = true;
+
+ $this->loops = 0;
+ while ($this->loops < 50) {
+ ob_start();
+
+ // Only needed once file content has changed.
+ $contents = $this->getContents();
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ @ob_end_clean();
+ echo '---START FILE CONTENT---'.PHP_EOL;
+ $lines = explode($this->currentFile->eolChar, $contents);
+ $max = strlen(count($lines));
+ foreach ($lines as $lineNum => $line) {
+ $lineNum++;
+ echo str_pad($lineNum, $max, ' ', STR_PAD_LEFT).'|'.$line.PHP_EOL;
+ }
+
+ echo '--- END FILE CONTENT ---'.PHP_EOL;
+ ob_start();
+ }
+
+ $this->inConflict = false;
+ $this->currentFile->ruleset->populateTokenListeners();
+ $this->currentFile->setContent($contents);
+ $this->currentFile->process();
+ ob_end_clean();
+
+ $this->loops++;
+
+ if (PHP_CODESNIFFER_CBF === true && PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo "\r".str_repeat(' ', 80)."\r";
+ echo "\t=> Fixing file: $this->numFixes/$fixable violations remaining [made $this->loops pass";
+ if ($this->loops > 1) {
+ echo 'es';
+ }
+
+ echo ']... ';
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+ }
+
+ if ($this->numFixes === 0 && $this->inConflict === false) {
+ // Nothing left to do.
+ break;
+ } else if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo "\t* fixed $this->numFixes violations, starting loop ".($this->loops + 1).' *'.PHP_EOL;
+ }
+ }//end while
+
+ $this->enabled = false;
+
+ if ($this->numFixes > 0) {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ echo "\t*** Reached maximum number of loops with $this->numFixes violations left unfixed ***".PHP_EOL;
+ ob_start();
+ }
+
+ return false;
+ }
+
+ return true;
+
+ }//end fixFile()
+
+
+ /**
+ * Generates a text diff of the original file and the new content.
+ *
+ * @param string $filePath Optional file path to diff the file against.
+ * If not specified, the original version of the
+ * file will be used.
+ * @param boolean $colors Print coloured output or not.
+ *
+ * @return string
+ */
+ public function generateDiff($filePath=null, $colors=true)
+ {
+ if ($filePath === null) {
+ $filePath = $this->currentFile->getFilename();
+ }
+
+ $cwd = getcwd().DIRECTORY_SEPARATOR;
+ if (strpos($filePath, $cwd) === 0) {
+ $filename = substr($filePath, strlen($cwd));
+ } else {
+ $filename = $filePath;
+ }
+
+ $contents = $this->getContents();
+
+ $tempName = tempnam(sys_get_temp_dir(), 'phpcs-fixer');
+ $fixedFile = fopen($tempName, 'w');
+ fwrite($fixedFile, $contents);
+
+ // We must use something like shell_exec() because whitespace at the end
+ // of lines is critical to diff files.
+ $filename = escapeshellarg($filename);
+ $cmd = "diff -u -L$filename -LPHP_CodeSniffer $filename \"$tempName\"";
+
+ $diff = shell_exec($cmd);
+
+ fclose($fixedFile);
+ if (is_file($tempName) === true) {
+ unlink($tempName);
+ }
+
+ if ($diff === null) {
+ return '';
+ }
+
+ if ($colors === false) {
+ return $diff;
+ }
+
+ $diffLines = explode(PHP_EOL, $diff);
+ if (count($diffLines) === 1) {
+ // Seems to be required for cygwin.
+ $diffLines = explode("\n", $diff);
+ }
+
+ $diff = [];
+ foreach ($diffLines as $line) {
+ if (isset($line[0]) === true) {
+ switch ($line[0]) {
+ case '-':
+ $diff[] = "\033[31m$line\033[0m";
+ break;
+ case '+':
+ $diff[] = "\033[32m$line\033[0m";
+ break;
+ default:
+ $diff[] = $line;
+ }
+ }
+ }
+
+ $diff = implode(PHP_EOL, $diff);
+
+ return $diff;
+
+ }//end generateDiff()
+
+
+ /**
+ * Get a count of fixes that have been performed on the file.
+ *
+ * This value is reset every time a new file is started, or an existing
+ * file is restarted.
+ *
+ * @return int
+ */
+ public function getFixCount()
+ {
+ return $this->numFixes;
+
+ }//end getFixCount()
+
+
+ /**
+ * Get the current content of the file, as a string.
+ *
+ * @return string
+ */
+ public function getContents()
+ {
+ $contents = implode($this->tokens);
+ return $contents;
+
+ }//end getContents()
+
+
+ /**
+ * Get the current fixed content of a token.
+ *
+ * This function takes changesets into account so should be used
+ * instead of directly accessing the token array.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ *
+ * @return string
+ */
+ public function getTokenContent($stackPtr)
+ {
+ if ($this->inChangeset === true
+ && isset($this->changeset[$stackPtr]) === true
+ ) {
+ return $this->changeset[$stackPtr];
+ } else {
+ return $this->tokens[$stackPtr];
+ }
+
+ }//end getTokenContent()
+
+
+ /**
+ * Start recording actions for a changeset.
+ *
+ * @return void
+ */
+ public function beginChangeset()
+ {
+ if ($this->inConflict === true) {
+ return false;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ if ($bt[1]['class'] === __CLASS__) {
+ $sniff = 'Fixer';
+ } else {
+ $sniff = Util\Common::getSniffCode($bt[1]['class']);
+ }
+
+ $line = $bt[0]['line'];
+
+ @ob_end_clean();
+ echo "\t=> Changeset started by $sniff:$line".PHP_EOL;
+ ob_start();
+ }
+
+ $this->changeset = [];
+ $this->inChangeset = true;
+
+ }//end beginChangeset()
+
+
+ /**
+ * Stop recording actions for a changeset, and apply logged changes.
+ *
+ * @return boolean
+ */
+ public function endChangeset()
+ {
+ if ($this->inConflict === true) {
+ return false;
+ }
+
+ $this->inChangeset = false;
+
+ $success = true;
+ $applied = [];
+ foreach ($this->changeset as $stackPtr => $content) {
+ $success = $this->replaceToken($stackPtr, $content);
+ if ($success === false) {
+ break;
+ } else {
+ $applied[] = $stackPtr;
+ }
+ }
+
+ if ($success === false) {
+ // Rolling back all changes.
+ foreach ($applied as $stackPtr) {
+ $this->revertToken($stackPtr);
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ @ob_end_clean();
+ echo "\t=> Changeset failed to apply".PHP_EOL;
+ ob_start();
+ }
+ } else if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $fixes = count($this->changeset);
+ @ob_end_clean();
+ echo "\t=> Changeset ended: $fixes changes applied".PHP_EOL;
+ ob_start();
+ }
+
+ $this->changeset = [];
+ return true;
+
+ }//end endChangeset()
+
+
+ /**
+ * Stop recording actions for a changeset, and discard logged changes.
+ *
+ * @return void
+ */
+ public function rollbackChangeset()
+ {
+ $this->inChangeset = false;
+ $this->inConflict = false;
+
+ if (empty($this->changeset) === false) {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $bt = debug_backtrace();
+ if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
+ $sniff = $bt[2]['class'];
+ $line = $bt[1]['line'];
+ } else {
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+ }
+
+ $sniff = Util\Common::getSniffCode($sniff);
+
+ $numChanges = count($this->changeset);
+
+ @ob_end_clean();
+ echo "\t\tR: $sniff:$line rolled back the changeset ($numChanges changes)".PHP_EOL;
+ echo "\t=> Changeset rolled back".PHP_EOL;
+ ob_start();
+ }
+
+ $this->changeset = [];
+ }//end if
+
+ }//end rollbackChangeset()
+
+
+ /**
+ * Replace the entire contents of a token.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ * @param string $content The new content of the token.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function replaceToken($stackPtr, $content)
+ {
+ if ($this->inConflict === true) {
+ return false;
+ }
+
+ if ($this->inChangeset === false
+ && isset($this->fixedTokens[$stackPtr]) === true
+ ) {
+ $indent = "\t";
+ if (empty($this->changeset) === false) {
+ $indent .= "\t";
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ @ob_end_clean();
+ echo "$indent* token $stackPtr has already been modified, skipping *".PHP_EOL;
+ ob_start();
+ }
+
+ return false;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
+ $sniff = $bt[2]['class'];
+ $line = $bt[1]['line'];
+ } else {
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+ }
+
+ $sniff = Util\Common::getSniffCode($sniff);
+
+ $tokens = $this->currentFile->getTokens();
+ $type = $tokens[$stackPtr]['type'];
+ $tokenLine = $tokens[$stackPtr]['line'];
+ $oldContent = Common::prepareForOutput($this->tokens[$stackPtr]);
+ $newContent = Common::prepareForOutput($content);
+ if (trim($this->tokens[$stackPtr]) === '' && isset($this->tokens[($stackPtr + 1)]) === true) {
+ // Add some context for whitespace only changes.
+ $append = Common::prepareForOutput($this->tokens[($stackPtr + 1)]);
+ $oldContent .= $append;
+ $newContent .= $append;
+ }
+ }//end if
+
+ if ($this->inChangeset === true) {
+ $this->changeset[$stackPtr] = $content;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ @ob_end_clean();
+ echo "\t\tQ: $sniff:$line replaced token $stackPtr ($type on line $tokenLine) \"$oldContent\" => \"$newContent\"".PHP_EOL;
+ ob_start();
+ }
+
+ return true;
+ }
+
+ if (isset($this->oldTokenValues[$stackPtr]) === false) {
+ $this->oldTokenValues[$stackPtr] = [
+ 'curr' => $content,
+ 'prev' => $this->tokens[$stackPtr],
+ 'loop' => $this->loops,
+ ];
+ } else {
+ if ($this->oldTokenValues[$stackPtr]['prev'] === $content
+ && $this->oldTokenValues[$stackPtr]['loop'] === ($this->loops - 1)
+ ) {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $indent = "\t";
+ if (empty($this->changeset) === false) {
+ $indent .= "\t";
+ }
+
+ $loop = $this->oldTokenValues[$stackPtr]['loop'];
+
+ @ob_end_clean();
+ echo "$indent**** $sniff:$line has possible conflict with another sniff on loop $loop; caused by the following change ****".PHP_EOL;
+ echo "$indent**** replaced token $stackPtr ($type on line $tokenLine) \"$oldContent\" => \"$newContent\" ****".PHP_EOL;
+ }
+
+ if ($this->oldTokenValues[$stackPtr]['loop'] >= ($this->loops - 1)) {
+ $this->inConflict = true;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo "$indent**** ignoring all changes until next loop ****".PHP_EOL;
+ }
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ ob_start();
+ }
+
+ return false;
+ }//end if
+
+ $this->oldTokenValues[$stackPtr]['prev'] = $this->oldTokenValues[$stackPtr]['curr'];
+ $this->oldTokenValues[$stackPtr]['curr'] = $content;
+ $this->oldTokenValues[$stackPtr]['loop'] = $this->loops;
+ }//end if
+
+ $this->fixedTokens[$stackPtr] = $this->tokens[$stackPtr];
+ $this->tokens[$stackPtr] = $content;
+ $this->numFixes++;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $indent = "\t";
+ if (empty($this->changeset) === false) {
+ $indent .= "\tA: ";
+ }
+
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ echo "$indent$sniff:$line replaced token $stackPtr ($type on line $tokenLine) \"$oldContent\" => \"$newContent\"".PHP_EOL;
+ ob_start();
+ }
+
+ return true;
+
+ }//end replaceToken()
+
+
+ /**
+ * Reverts the previous fix made to a token.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ *
+ * @return bool If a change was reverted.
+ */
+ public function revertToken($stackPtr)
+ {
+ if (isset($this->fixedTokens[$stackPtr]) === false) {
+ return false;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
+ $sniff = $bt[2]['class'];
+ $line = $bt[1]['line'];
+ } else {
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+ }
+
+ $sniff = Util\Common::getSniffCode($sniff);
+
+ $tokens = $this->currentFile->getTokens();
+ $type = $tokens[$stackPtr]['type'];
+ $tokenLine = $tokens[$stackPtr]['line'];
+ $oldContent = Common::prepareForOutput($this->tokens[$stackPtr]);
+ $newContent = Common::prepareForOutput($this->fixedTokens[$stackPtr]);
+ if (trim($this->tokens[$stackPtr]) === '' && isset($tokens[($stackPtr + 1)]) === true) {
+ // Add some context for whitespace only changes.
+ $append = Common::prepareForOutput($this->tokens[($stackPtr + 1)]);
+ $oldContent .= $append;
+ $newContent .= $append;
+ }
+ }//end if
+
+ $this->tokens[$stackPtr] = $this->fixedTokens[$stackPtr];
+ unset($this->fixedTokens[$stackPtr]);
+ $this->numFixes--;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $indent = "\t";
+ if (empty($this->changeset) === false) {
+ $indent .= "\tR: ";
+ }
+
+ @ob_end_clean();
+ echo "$indent$sniff:$line reverted token $stackPtr ($type on line $tokenLine) \"$oldContent\" => \"$newContent\"".PHP_EOL;
+ ob_start();
+ }
+
+ return true;
+
+ }//end revertToken()
+
+
+ /**
+ * Replace the content of a token with a part of its current content.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ * @param int $start The first character to keep.
+ * @param int $length The number of characters to keep. If NULL, the content of
+ * the token from $start to the end of the content is kept.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function substrToken($stackPtr, $start, $length=null)
+ {
+ $current = $this->getTokenContent($stackPtr);
+
+ if ($length === null) {
+ $newContent = substr($current, $start);
+ } else {
+ $newContent = substr($current, $start, $length);
+ }
+
+ return $this->replaceToken($stackPtr, $newContent);
+
+ }//end substrToken()
+
+
+ /**
+ * Adds a newline to end of a token's content.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function addNewline($stackPtr)
+ {
+ $current = $this->getTokenContent($stackPtr);
+ return $this->replaceToken($stackPtr, $current.$this->currentFile->eolChar);
+
+ }//end addNewline()
+
+
+ /**
+ * Adds a newline to the start of a token's content.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function addNewlineBefore($stackPtr)
+ {
+ $current = $this->getTokenContent($stackPtr);
+ return $this->replaceToken($stackPtr, $this->currentFile->eolChar.$current);
+
+ }//end addNewlineBefore()
+
+
+ /**
+ * Adds content to the end of a token's current content.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ * @param string $content The content to add.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function addContent($stackPtr, $content)
+ {
+ $current = $this->getTokenContent($stackPtr);
+ return $this->replaceToken($stackPtr, $current.$content);
+
+ }//end addContent()
+
+
+ /**
+ * Adds content to the start of a token's current content.
+ *
+ * @param int $stackPtr The position of the token in the token stack.
+ * @param string $content The content to add.
+ *
+ * @return bool If the change was accepted.
+ */
+ public function addContentBefore($stackPtr, $content)
+ {
+ $current = $this->getTokenContent($stackPtr);
+ return $this->replaceToken($stackPtr, $content.$current);
+
+ }//end addContentBefore()
+
+
+ /**
+ * Adjust the indent of a code block.
+ *
+ * @param int $start The position of the token in the token stack
+ * to start adjusting the indent from.
+ * @param int $end The position of the token in the token stack
+ * to end adjusting the indent.
+ * @param int $change The number of spaces to adjust the indent by
+ * (positive or negative).
+ *
+ * @return void
+ */
+ public function changeCodeBlockIndent($start, $end, $change)
+ {
+ $tokens = $this->currentFile->getTokens();
+
+ $baseIndent = '';
+ if ($change > 0) {
+ $baseIndent = str_repeat(' ', $change);
+ }
+
+ $useChangeset = false;
+ if ($this->inChangeset === false) {
+ $this->beginChangeset();
+ $useChangeset = true;
+ }
+
+ for ($i = $start; $i <= $end; $i++) {
+ if ($tokens[$i]['column'] !== 1
+ || $tokens[($i + 1)]['line'] !== $tokens[$i]['line']
+ ) {
+ continue;
+ }
+
+ $length = 0;
+ if ($tokens[$i]['code'] === T_WHITESPACE
+ || $tokens[$i]['code'] === T_DOC_COMMENT_WHITESPACE
+ ) {
+ $length = $tokens[$i]['length'];
+
+ $padding = ($length + $change);
+ if ($padding > 0) {
+ $padding = str_repeat(' ', $padding);
+ } else {
+ $padding = '';
+ }
+
+ $newContent = $padding.ltrim($tokens[$i]['content']);
+ } else {
+ $newContent = $baseIndent.$tokens[$i]['content'];
+ }
+
+ $this->replaceToken($i, $newContent);
+ }//end for
+
+ if ($useChangeset === true) {
+ $this->endChangeset();
+ }
+
+ }//end changeCodeBlockIndent()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php b/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
new file mode 100644
index 00000000..56049768
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
@@ -0,0 +1,117 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Generators;
+
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Autoload;
+
+abstract class Generator
+{
+
+ /**
+ * The ruleset used for the run.
+ *
+ * @var \PHP_CodeSniffer\Ruleset
+ */
+ public $ruleset = null;
+
+ /**
+ * XML documentation files used to produce the final output.
+ *
+ * @var string[]
+ */
+ public $docFiles = [];
+
+
+ /**
+ * Constructs a doc generator.
+ *
+ * @param \PHP_CodeSniffer\Ruleset $ruleset The ruleset used for the run.
+ *
+ * @see generate()
+ */
+ public function __construct(Ruleset $ruleset)
+ {
+ $this->ruleset = $ruleset;
+
+ foreach ($ruleset->sniffs as $className => $sniffClass) {
+ $file = Autoload::getLoadedFileName($className);
+ $docFile = str_replace(
+ DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR,
+ DIRECTORY_SEPARATOR.'Docs'.DIRECTORY_SEPARATOR,
+ $file
+ );
+ $docFile = str_replace('Sniff.php', 'Standard.xml', $docFile);
+
+ if (is_file($docFile) === true) {
+ $this->docFiles[] = $docFile;
+ }
+ }
+
+ }//end __construct()
+
+
+ /**
+ * Retrieves the title of the sniff from the DOMNode supplied.
+ *
+ * @param \DOMNode $doc The DOMNode object for the sniff.
+ * It represents the "documentation" tag in the XML
+ * standard file.
+ *
+ * @return string
+ */
+ protected function getTitle(\DOMNode $doc)
+ {
+ return $doc->getAttribute('title');
+
+ }//end getTitle()
+
+
+ /**
+ * Generates the documentation for a standard.
+ *
+ * It's probably wise for doc generators to override this method so they
+ * have control over how the docs are produced. Otherwise, the processSniff
+ * method should be overridden to output content for each sniff.
+ *
+ * @return void
+ * @see processSniff()
+ */
+ public function generate()
+ {
+ foreach ($this->docFiles as $file) {
+ $doc = new \DOMDocument();
+ $doc->load($file);
+ $documentation = $doc->getElementsByTagName('documentation')->item(0);
+ $this->processSniff($documentation);
+ }
+
+ }//end generate()
+
+
+ /**
+ * Process the documentation for a single sniff.
+ *
+ * Doc generators must implement this function to produce output.
+ *
+ * @param \DOMNode $doc The DOMNode object for the sniff.
+ * It represents the "documentation" tag in the XML
+ * standard file.
+ *
+ * @return void
+ * @see generate()
+ */
+ abstract protected function processSniff(\DOMNode $doc);
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Generators/HTML.php b/vendor/squizlabs/php_codesniffer/src/Generators/HTML.php
new file mode 100644
index 00000000..db264684
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/HTML.php
@@ -0,0 +1,270 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Generators;
+
+use PHP_CodeSniffer\Config;
+
+class HTML extends Generator
+{
+
+
+ /**
+ * Generates the documentation for a standard.
+ *
+ * @return void
+ * @see processSniff()
+ */
+ public function generate()
+ {
+ ob_start();
+ $this->printHeader();
+ $this->printToc();
+
+ foreach ($this->docFiles as $file) {
+ $doc = new \DOMDocument();
+ $doc->load($file);
+ $documentation = $doc->getElementsByTagName('documentation')->item(0);
+ $this->processSniff($documentation);
+ }
+
+ $this->printFooter();
+
+ $content = ob_get_contents();
+ ob_end_clean();
+
+ echo $content;
+
+ }//end generate()
+
+
+ /**
+ * Print the header of the HTML page.
+ *
+ * @return void
+ */
+ protected function printHeader()
+ {
+ $standard = $this->ruleset->name;
+ echo ''.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo " $standard Coding Standards".PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo "
$standard Coding Standards
".PHP_EOL;
+
+ }//end printHeader()
+
+
+ /**
+ * Print the table of contents for the standard.
+ *
+ * The TOC is just an unordered list of bookmarks to sniffs on the page.
+ *
+ * @return void
+ */
+ protected function printToc()
+ {
+ echo '
'.PHP_EOL;
+
+ }//end printToc()
+
+
+ /**
+ * Print the footer of the HTML page.
+ *
+ * @return void
+ */
+ protected function printFooter()
+ {
+ // Turn off errors so we don't get timezone warnings if people
+ // don't have their timezone set.
+ $errorLevel = error_reporting(0);
+ echo '
'.PHP_EOL;
+ error_reporting($errorLevel);
+
+ echo ' '.PHP_EOL;
+ echo ''.PHP_EOL;
+
+ }//end printFooter()
+
+
+ /**
+ * Process the documentation for a single sniff.
+ *
+ * @param \DOMNode $doc The DOMNode object for the sniff.
+ * It represents the "documentation" tag in the XML
+ * standard file.
+ *
+ * @return void
+ */
+ public function processSniff(\DOMNode $doc)
+ {
+ $title = $this->getTitle($doc);
+ echo ' '.PHP_EOL;
+ echo "
$title
".PHP_EOL;
+
+ foreach ($doc->childNodes as $node) {
+ if ($node->nodeName === 'standard') {
+ $this->printTextBlock($node);
+ } else if ($node->nodeName === 'code_comparison') {
+ $this->printCodeComparisonBlock($node);
+ }
+ }
+
+ }//end processSniff()
+
+
+ /**
+ * Print a text block found in a standard.
+ *
+ * @param \DOMNode $node The DOMNode object for the text block.
+ *
+ * @return void
+ */
+ protected function printTextBlock(\DOMNode $node)
+ {
+ $content = trim($node->nodeValue);
+ $content = htmlspecialchars($content);
+
+ // Allow em tags only.
+ $content = str_replace('<em>', '', $content);
+ $content = str_replace('</em>', '', $content);
+
+ echo "
'.PHP_EOL;
+
+ }//end printCodeComparisonBlock()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Generators/Text.php b/vendor/squizlabs/php_codesniffer/src/Generators/Text.php
new file mode 100644
index 00000000..ffff206a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/Text.php
@@ -0,0 +1,253 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Generators;
+
+class Text extends Generator
+{
+
+
+ /**
+ * Process the documentation for a single sniff.
+ *
+ * @param \DOMNode $doc The DOMNode object for the sniff.
+ * It represents the "documentation" tag in the XML
+ * standard file.
+ *
+ * @return void
+ */
+ public function processSniff(\DOMNode $doc)
+ {
+ $this->printTitle($doc);
+
+ foreach ($doc->childNodes as $node) {
+ if ($node->nodeName === 'standard') {
+ $this->printTextBlock($node);
+ } else if ($node->nodeName === 'code_comparison') {
+ $this->printCodeComparisonBlock($node);
+ }
+ }
+
+ }//end processSniff()
+
+
+ /**
+ * Prints the title area for a single sniff.
+ *
+ * @param \DOMNode $doc The DOMNode object for the sniff.
+ * It represents the "documentation" tag in the XML
+ * standard file.
+ *
+ * @return void
+ */
+ protected function printTitle(\DOMNode $doc)
+ {
+ $title = $this->getTitle($doc);
+ $standard = $this->ruleset->name;
+
+ echo PHP_EOL;
+ echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
+ echo strtoupper(PHP_EOL."| $standard CODING STANDARD: $title |".PHP_EOL);
+ echo str_repeat('-', (strlen("$standard CODING STANDARD: $title") + 4));
+ echo PHP_EOL.PHP_EOL;
+
+ }//end printTitle()
+
+
+ /**
+ * Print a text block found in a standard.
+ *
+ * @param \DOMNode $node The DOMNode object for the text block.
+ *
+ * @return void
+ */
+ protected function printTextBlock(\DOMNode $node)
+ {
+ $text = trim($node->nodeValue);
+ $text = str_replace('', '*', $text);
+ $text = str_replace('', '*', $text);
+
+ $nodeLines = explode("\n", $text);
+ $lines = [];
+
+ foreach ($nodeLines as $currentLine) {
+ $currentLine = trim($currentLine);
+ if ($currentLine === '') {
+ // The text contained a blank line. Respect this.
+ $lines[] = '';
+ continue;
+ }
+
+ $tempLine = '';
+ $words = explode(' ', $currentLine);
+
+ foreach ($words as $word) {
+ $currentLength = strlen($tempLine.$word);
+ if ($currentLength < 99) {
+ $tempLine .= $word.' ';
+ continue;
+ }
+
+ if ($currentLength === 99 || $currentLength === 100) {
+ // We are already at the edge, so we are done.
+ $lines[] = $tempLine.$word;
+ $tempLine = '';
+ } else {
+ $lines[] = rtrim($tempLine);
+ $tempLine = $word.' ';
+ }
+ }//end foreach
+
+ if ($tempLine !== '') {
+ $lines[] = rtrim($tempLine);
+ }
+ }//end foreach
+
+ echo implode(PHP_EOL, $lines).PHP_EOL.PHP_EOL;
+
+ }//end printTextBlock()
+
+
+ /**
+ * Print a code comparison block found in a standard.
+ *
+ * @param \DOMNode $node The DOMNode object for the code comparison block.
+ *
+ * @return void
+ */
+ protected function printCodeComparisonBlock(\DOMNode $node)
+ {
+ $codeBlocks = $node->getElementsByTagName('code');
+ $first = trim($codeBlocks->item(0)->nodeValue);
+ $firstTitle = $codeBlocks->item(0)->getAttribute('title');
+
+ $firstTitleLines = [];
+ $tempTitle = '';
+ $words = explode(' ', $firstTitle);
+
+ foreach ($words as $word) {
+ if (strlen($tempTitle.$word) >= 45) {
+ if (strlen($tempTitle.$word) === 45) {
+ // Adding the extra space will push us to the edge
+ // so we are done.
+ $firstTitleLines[] = $tempTitle.$word;
+ $tempTitle = '';
+ } else if (strlen($tempTitle.$word) === 46) {
+ // We are already at the edge, so we are done.
+ $firstTitleLines[] = $tempTitle.$word;
+ $tempTitle = '';
+ } else {
+ $firstTitleLines[] = $tempTitle;
+ $tempTitle = $word.' ';
+ }
+ } else {
+ $tempTitle .= $word.' ';
+ }
+ }//end foreach
+
+ if ($tempTitle !== '') {
+ $firstTitleLines[] = $tempTitle;
+ }
+
+ $first = str_replace('', '', $first);
+ $first = str_replace('', '', $first);
+ $firstLines = explode("\n", $first);
+
+ $second = trim($codeBlocks->item(1)->nodeValue);
+ $secondTitle = $codeBlocks->item(1)->getAttribute('title');
+
+ $secondTitleLines = [];
+ $tempTitle = '';
+ $words = explode(' ', $secondTitle);
+
+ foreach ($words as $word) {
+ if (strlen($tempTitle.$word) >= 45) {
+ if (strlen($tempTitle.$word) === 45) {
+ // Adding the extra space will push us to the edge
+ // so we are done.
+ $secondTitleLines[] = $tempTitle.$word;
+ $tempTitle = '';
+ } else if (strlen($tempTitle.$word) === 46) {
+ // We are already at the edge, so we are done.
+ $secondTitleLines[] = $tempTitle.$word;
+ $tempTitle = '';
+ } else {
+ $secondTitleLines[] = $tempTitle;
+ $tempTitle = $word.' ';
+ }
+ } else {
+ $tempTitle .= $word.' ';
+ }
+ }//end foreach
+
+ if ($tempTitle !== '') {
+ $secondTitleLines[] = $tempTitle;
+ }
+
+ $second = str_replace('', '', $second);
+ $second = str_replace('', '', $second);
+ $secondLines = explode("\n", $second);
+
+ $maxCodeLines = max(count($firstLines), count($secondLines));
+ $maxTitleLines = max(count($firstTitleLines), count($secondTitleLines));
+
+ echo str_repeat('-', 41);
+ echo ' CODE COMPARISON ';
+ echo str_repeat('-', 42).PHP_EOL;
+
+ for ($i = 0; $i < $maxTitleLines; $i++) {
+ if (isset($firstTitleLines[$i]) === true) {
+ $firstLineText = $firstTitleLines[$i];
+ } else {
+ $firstLineText = '';
+ }
+
+ if (isset($secondTitleLines[$i]) === true) {
+ $secondLineText = $secondTitleLines[$i];
+ } else {
+ $secondLineText = '';
+ }
+
+ echo '| ';
+ echo $firstLineText.str_repeat(' ', (46 - strlen($firstLineText)));
+ echo ' | ';
+ echo $secondLineText.str_repeat(' ', (47 - strlen($secondLineText)));
+ echo ' |'.PHP_EOL;
+ }//end for
+
+ echo str_repeat('-', 100).PHP_EOL;
+
+ for ($i = 0; $i < $maxCodeLines; $i++) {
+ if (isset($firstLines[$i]) === true) {
+ $firstLineText = $firstLines[$i];
+ } else {
+ $firstLineText = '';
+ }
+
+ if (isset($secondLines[$i]) === true) {
+ $secondLineText = $secondLines[$i];
+ } else {
+ $secondLineText = '';
+ }
+
+ echo '| ';
+ echo $firstLineText.str_repeat(' ', max(0, (47 - strlen($firstLineText))));
+ echo '| ';
+ echo $secondLineText.str_repeat(' ', max(0, (48 - strlen($secondLineText))));
+ echo '|'.PHP_EOL;
+ }//end for
+
+ echo str_repeat('-', 100).PHP_EOL.PHP_EOL;
+
+ }//end printCodeComparisonBlock()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reporter.php b/vendor/squizlabs/php_codesniffer/src/Reporter.php
new file mode 100644
index 00000000..e89a20ed
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reporter.php
@@ -0,0 +1,423 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Reports\Report;
+use PHP_CodeSniffer\Util\Common;
+
+class Reporter
+{
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ public $config = null;
+
+ /**
+ * Total number of files that contain errors or warnings.
+ *
+ * @var integer
+ */
+ public $totalFiles = 0;
+
+ /**
+ * Total number of errors found during the run.
+ *
+ * @var integer
+ */
+ public $totalErrors = 0;
+
+ /**
+ * Total number of warnings found during the run.
+ *
+ * @var integer
+ */
+ public $totalWarnings = 0;
+
+ /**
+ * Total number of errors/warnings that can be fixed.
+ *
+ * @var integer
+ */
+ public $totalFixable = 0;
+
+ /**
+ * Total number of errors/warnings that were fixed.
+ *
+ * @var integer
+ */
+ public $totalFixed = 0;
+
+ /**
+ * When the PHPCS run started.
+ *
+ * @var float
+ */
+ public static $startTime = 0;
+
+ /**
+ * A cache of report objects.
+ *
+ * @var array
+ */
+ private $reports = [];
+
+ /**
+ * A cache of opened temporary files.
+ *
+ * @var array
+ */
+ private $tmpFiles = [];
+
+
+ /**
+ * Initialise the reporter.
+ *
+ * All reports specified in the config will be created and their
+ * output file (or a temp file if none is specified) initialised by
+ * clearing the current contents.
+ *
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If a custom report class could not be found.
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If a report class is incorrectly set up.
+ */
+ public function __construct(Config $config)
+ {
+ $this->config = $config;
+
+ foreach ($config->reports as $type => $output) {
+ if ($output === null) {
+ $output = $config->reportFile;
+ }
+
+ $reportClassName = '';
+ if (strpos($type, '.') !== false) {
+ // This is a path to a custom report class.
+ $filename = realpath($type);
+ if ($filename === false) {
+ $error = "ERROR: Custom report \"$type\" not found".PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $reportClassName = Autoload::loadFile($filename);
+ } else if (class_exists('PHP_CodeSniffer\Reports\\'.ucfirst($type)) === true) {
+ // PHPCS native report.
+ $reportClassName = 'PHP_CodeSniffer\Reports\\'.ucfirst($type);
+ } else if (class_exists($type) === true) {
+ // FQN of a custom report.
+ $reportClassName = $type;
+ } else {
+ // OK, so not a FQN, try and find the report using the registered namespaces.
+ $registeredNamespaces = Autoload::getSearchPaths();
+ $trimmedType = ltrim($type, '\\');
+
+ foreach ($registeredNamespaces as $nsPrefix) {
+ if ($nsPrefix === '') {
+ continue;
+ }
+
+ if (class_exists($nsPrefix.'\\'.$trimmedType) === true) {
+ $reportClassName = $nsPrefix.'\\'.$trimmedType;
+ break;
+ }
+ }
+ }//end if
+
+ if ($reportClassName === '') {
+ $error = "ERROR: Class file for report \"$type\" not found".PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $reportClass = new $reportClassName();
+ if (($reportClass instanceof Report) === false) {
+ throw new RuntimeException('Class "'.$reportClassName.'" must implement the "PHP_CodeSniffer\Report" interface.');
+ }
+
+ $this->reports[$type] = [
+ 'output' => $output,
+ 'class' => $reportClass,
+ ];
+
+ if ($output === null) {
+ // Using a temp file.
+ // This needs to be set in the constructor so that all
+ // child procs use the same report file when running in parallel.
+ $this->tmpFiles[$type] = tempnam(sys_get_temp_dir(), 'phpcs');
+ file_put_contents($this->tmpFiles[$type], '');
+ } else {
+ file_put_contents($output, '');
+ }
+ }//end foreach
+
+ }//end __construct()
+
+
+ /**
+ * Generates and prints final versions of all reports.
+ *
+ * Returns TRUE if any of the reports output content to the screen
+ * or FALSE if all reports were silently printed to a file.
+ *
+ * @return bool
+ */
+ public function printReports()
+ {
+ $toScreen = false;
+ foreach ($this->reports as $type => $report) {
+ if ($report['output'] === null) {
+ $toScreen = true;
+ }
+
+ $this->printReport($type);
+ }
+
+ return $toScreen;
+
+ }//end printReports()
+
+
+ /**
+ * Generates and prints a single final report.
+ *
+ * @param string $report The report type to print.
+ *
+ * @return void
+ */
+ public function printReport($report)
+ {
+ $reportClass = $this->reports[$report]['class'];
+ $reportFile = $this->reports[$report]['output'];
+
+ if ($reportFile !== null) {
+ $filename = $reportFile;
+ $toScreen = false;
+ } else {
+ if (isset($this->tmpFiles[$report]) === true) {
+ $filename = $this->tmpFiles[$report];
+ } else {
+ $filename = null;
+ }
+
+ $toScreen = true;
+ }
+
+ $reportCache = '';
+ if ($filename !== null) {
+ $reportCache = file_get_contents($filename);
+ }
+
+ ob_start();
+ $reportClass->generate(
+ $reportCache,
+ $this->totalFiles,
+ $this->totalErrors,
+ $this->totalWarnings,
+ $this->totalFixable,
+ $this->config->showSources,
+ $this->config->reportWidth,
+ $this->config->interactive,
+ $toScreen
+ );
+ $generatedReport = ob_get_contents();
+ ob_end_clean();
+
+ if ($this->config->colors !== true || $reportFile !== null) {
+ $generatedReport = preg_replace('`\033\[[0-9;]+m`', '', $generatedReport);
+ }
+
+ if ($reportFile !== null) {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo $generatedReport;
+ }
+
+ file_put_contents($reportFile, $generatedReport.PHP_EOL);
+ } else {
+ echo $generatedReport;
+ if ($filename !== null && file_exists($filename) === true) {
+ unlink($filename);
+ unset($this->tmpFiles[$report]);
+ }
+ }
+
+ }//end printReport()
+
+
+ /**
+ * Caches the result of a single processed file for all reports.
+ *
+ * The report content that is generated is appended to the output file
+ * assigned to each report. This content may be an intermediate report format
+ * and not reflect the final report output.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file that has been processed.
+ *
+ * @return void
+ */
+ public function cacheFileReport(File $phpcsFile)
+ {
+ if (isset($this->config->reports) === false) {
+ // This happens during unit testing, or any time someone just wants
+ // the error data and not the printed report.
+ return;
+ }
+
+ $reportData = $this->prepareFileReport($phpcsFile);
+ $errorsShown = false;
+
+ foreach ($this->reports as $type => $report) {
+ $reportClass = $report['class'];
+
+ ob_start();
+ $result = $reportClass->generateFileReport($reportData, $phpcsFile, $this->config->showSources, $this->config->reportWidth);
+ if ($result === true) {
+ $errorsShown = true;
+ }
+
+ $generatedReport = ob_get_contents();
+ ob_end_clean();
+
+ if ($report['output'] === null) {
+ // Using a temp file.
+ if (isset($this->tmpFiles[$type]) === false) {
+ // When running in interactive mode, the reporter prints the full
+ // report many times, which will unlink the temp file. So we need
+ // to create a new one if it doesn't exist.
+ $this->tmpFiles[$type] = tempnam(sys_get_temp_dir(), 'phpcs');
+ file_put_contents($this->tmpFiles[$type], '');
+ }
+
+ file_put_contents($this->tmpFiles[$type], $generatedReport, (FILE_APPEND | LOCK_EX));
+ } else {
+ file_put_contents($report['output'], $generatedReport, (FILE_APPEND | LOCK_EX));
+ }//end if
+ }//end foreach
+
+ if ($errorsShown === true || PHP_CODESNIFFER_CBF === true) {
+ $this->totalFiles++;
+ $this->totalErrors += $reportData['errors'];
+ $this->totalWarnings += $reportData['warnings'];
+
+ // When PHPCBF is running, we need to use the fixable error values
+ // after the report has run and fixed what it can.
+ if (PHP_CODESNIFFER_CBF === true) {
+ $this->totalFixable += $phpcsFile->getFixableCount();
+ $this->totalFixed += $phpcsFile->getFixedCount();
+ } else {
+ $this->totalFixable += $reportData['fixable'];
+ }
+ }
+
+ }//end cacheFileReport()
+
+
+ /**
+ * Generate summary information to be used during report generation.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file that has been processed.
+ *
+ * @return array
+ */
+ public function prepareFileReport(File $phpcsFile)
+ {
+ $report = [
+ 'filename' => Common::stripBasepath($phpcsFile->getFilename(), $this->config->basepath),
+ 'errors' => $phpcsFile->getErrorCount(),
+ 'warnings' => $phpcsFile->getWarningCount(),
+ 'fixable' => $phpcsFile->getFixableCount(),
+ 'messages' => [],
+ ];
+
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Prefect score!
+ return $report;
+ }
+
+ if ($this->config->recordErrors === false) {
+ $message = 'Errors are not being recorded but this report requires error messages. ';
+ $message .= 'This report will not show the correct information.';
+ $report['messages'][1][1] = [
+ [
+ 'message' => $message,
+ 'source' => 'Internal.RecordErrors',
+ 'severity' => 5,
+ 'fixable' => false,
+ 'type' => 'ERROR',
+ ],
+ ];
+ return $report;
+ }
+
+ $errors = [];
+
+ // Merge errors and warnings.
+ foreach ($phpcsFile->getErrors() as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ $newErrors = [];
+ foreach ($colErrors as $data) {
+ $newErrors[] = [
+ 'message' => $data['message'],
+ 'source' => $data['source'],
+ 'severity' => $data['severity'],
+ 'fixable' => $data['fixable'],
+ 'type' => 'ERROR',
+ ];
+ }
+
+ $errors[$line][$column] = $newErrors;
+ }
+
+ ksort($errors[$line]);
+ }//end foreach
+
+ foreach ($phpcsFile->getWarnings() as $line => $lineWarnings) {
+ foreach ($lineWarnings as $column => $colWarnings) {
+ $newWarnings = [];
+ foreach ($colWarnings as $data) {
+ $newWarnings[] = [
+ 'message' => $data['message'],
+ 'source' => $data['source'],
+ 'severity' => $data['severity'],
+ 'fixable' => $data['fixable'],
+ 'type' => 'WARNING',
+ ];
+ }
+
+ if (isset($errors[$line]) === false) {
+ $errors[$line] = [];
+ }
+
+ if (isset($errors[$line][$column]) === true) {
+ $errors[$line][$column] = array_merge(
+ $newWarnings,
+ $errors[$line][$column]
+ );
+ } else {
+ $errors[$line][$column] = $newWarnings;
+ }
+ }//end foreach
+
+ ksort($errors[$line]);
+ }//end foreach
+
+ ksort($errors);
+ $report['messages'] = $errors;
+ return $report;
+
+ }//end prepareFileReport()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php b/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php
new file mode 100644
index 00000000..0ecde76e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php
@@ -0,0 +1,253 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util;
+
+class Cbf implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $errors = $phpcsFile->getFixableCount();
+ if ($errors !== 0) {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ ob_end_clean();
+ $startTime = microtime(true);
+ echo "\t=> Fixing file: $errors/$errors violations remaining";
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+ }
+
+ $fixed = $phpcsFile->fixer->fixFile();
+ }
+
+ if ($phpcsFile->config->stdin === true) {
+ // Replacing STDIN, so output current file to STDOUT
+ // even if nothing was fixed. Exit here because we
+ // can't process any more than 1 file in this setup.
+ $fixedContent = $phpcsFile->fixer->getContents();
+ throw new DeepExitException($fixedContent, 1);
+ }
+
+ if ($errors === 0) {
+ return false;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ if ($fixed === false) {
+ echo 'ERROR';
+ } else {
+ echo 'DONE';
+ }
+
+ $timeTaken = ((microtime(true) - $startTime) * 1000);
+ if ($timeTaken < 1000) {
+ $timeTaken = round($timeTaken);
+ echo " in {$timeTaken}ms".PHP_EOL;
+ } else {
+ $timeTaken = round(($timeTaken / 1000), 2);
+ echo " in $timeTaken secs".PHP_EOL;
+ }
+ }
+
+ if ($fixed === true) {
+ // The filename in the report may be truncated due to a basepath setting
+ // but we are using it for writing here and not display,
+ // so find the correct path if basepath is in use.
+ $newFilename = $report['filename'].$phpcsFile->config->suffix;
+ if ($phpcsFile->config->basepath !== null) {
+ $newFilename = $phpcsFile->config->basepath.DIRECTORY_SEPARATOR.$newFilename;
+ }
+
+ $newContent = $phpcsFile->fixer->getContents();
+ file_put_contents($newFilename, $newContent);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ if ($newFilename === $report['filename']) {
+ echo "\t=> File was overwritten".PHP_EOL;
+ } else {
+ echo "\t=> Fixed file written to ".basename($newFilename).PHP_EOL;
+ }
+ }
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ ob_start();
+ }
+
+ $errorCount = $phpcsFile->getErrorCount();
+ $warningCount = $phpcsFile->getWarningCount();
+ $fixableCount = $phpcsFile->getFixableCount();
+ $fixedCount = ($errors - $fixableCount);
+ echo $report['filename'].">>$errorCount>>$warningCount>>$fixableCount>>$fixedCount".PHP_EOL;
+
+ return $fixed;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints a summary of fixed files.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $lines = explode(PHP_EOL, $cachedData);
+ array_pop($lines);
+
+ if (empty($lines) === true) {
+ echo PHP_EOL.'No fixable errors were found'.PHP_EOL;
+ return;
+ }
+
+ $reportFiles = [];
+ $maxLength = 0;
+ $totalFixed = 0;
+ $failures = 0;
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $fileLen = strlen($parts[0]);
+ $reportFiles[$parts[0]] = [
+ 'errors' => $parts[1],
+ 'warnings' => $parts[2],
+ 'fixable' => $parts[3],
+ 'fixed' => $parts[4],
+ 'strlen' => $fileLen,
+ ];
+
+ $maxLength = max($maxLength, $fileLen);
+
+ $totalFixed += $parts[4];
+
+ if ($parts[3] > 0) {
+ $failures++;
+ }
+ }
+
+ $width = min($width, ($maxLength + 21));
+ $width = max($width, 70);
+
+ echo PHP_EOL."\033[1m".'PHPCBF RESULT SUMMARY'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1m".'FILE'.str_repeat(' ', ($width - 20)).'FIXED REMAINING'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+
+ foreach ($reportFiles as $file => $data) {
+ $padding = ($width - 18 - $data['strlen']);
+ if ($padding < 0) {
+ $file = '...'.substr($file, (($padding * -1) + 3));
+ $padding = 0;
+ }
+
+ echo $file.str_repeat(' ', $padding).' ';
+
+ if ($data['fixable'] > 0) {
+ echo "\033[31mFAILED TO FIX\033[0m".PHP_EOL;
+ continue;
+ }
+
+ $remaining = ($data['errors'] + $data['warnings']);
+
+ if ($data['fixed'] !== 0) {
+ echo $data['fixed'];
+ echo str_repeat(' ', (7 - strlen((string) $data['fixed'])));
+ } else {
+ echo '0 ';
+ }
+
+ if ($remaining !== 0) {
+ echo $remaining;
+ } else {
+ echo '0';
+ }
+
+ echo PHP_EOL;
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mA TOTAL OF $totalFixed ERROR";
+ if ($totalFixed !== 1) {
+ echo 'S';
+ }
+
+ $numFiles = count($reportFiles);
+ echo ' WERE FIXED IN '.$numFiles.' FILE';
+ if ($numFiles !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m";
+
+ if ($failures > 0) {
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mPHPCBF FAILED TO FIX $failures FILE";
+ if ($failures !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m";
+ }
+
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL.PHP_EOL;
+
+ if ($toScreen === true && $interactive === false) {
+ Util\Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Checkstyle.php b/vendor/squizlabs/php_codesniffer/src/Reports/Checkstyle.php
new file mode 100644
index 00000000..06a78e19
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Checkstyle.php
@@ -0,0 +1,109 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+
+class Checkstyle implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $out = new \XMLWriter;
+ $out->openMemory();
+ $out->setIndent(true);
+
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ $out->startElement('file');
+ $out->writeAttribute('name', $report['filename']);
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $error['type'] = strtolower($error['type']);
+ if ($phpcsFile->config->encoding !== 'utf-8') {
+ $error['message'] = iconv($phpcsFile->config->encoding, 'utf-8', $error['message']);
+ }
+
+ $out->startElement('error');
+ $out->writeAttribute('line', $line);
+ $out->writeAttribute('column', $column);
+ $out->writeAttribute('severity', $error['type']);
+ $out->writeAttribute('message', $error['message']);
+ $out->writeAttribute('source', $error['source']);
+ $out->endElement();
+ }
+ }
+ }//end foreach
+
+ $out->endElement();
+ echo $out->flush();
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all violations for processed files, in a Checkstyle format.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo ''.PHP_EOL;
+ echo ''.PHP_EOL;
+ echo $cachedData;
+ echo ''.PHP_EOL;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Code.php b/vendor/squizlabs/php_codesniffer/src/Reports/Code.php
new file mode 100644
index 00000000..47c5581e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Code.php
@@ -0,0 +1,362 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util;
+
+class Code implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ // How many lines to show about and below the error line.
+ $surroundingLines = 2;
+
+ $file = $report['filename'];
+ $tokens = $phpcsFile->getTokens();
+ if (empty($tokens) === true) {
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ $startTime = microtime(true);
+ echo 'CODE report is parsing '.basename($file).' ';
+ } else if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo "CODE report is forcing parse of $file".PHP_EOL;
+ }
+
+ try {
+ $phpcsFile->parse();
+ } catch (\Exception $e) {
+ // This is a second parse, so ignore exceptions.
+ // They would have been added to the file's error list already.
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ $timeTaken = ((microtime(true) - $startTime) * 1000);
+ if ($timeTaken < 1000) {
+ $timeTaken = round($timeTaken);
+ echo "DONE in {$timeTaken}ms";
+ } else {
+ $timeTaken = round(($timeTaken / 1000), 2);
+ echo "DONE in $timeTaken secs";
+ }
+
+ echo PHP_EOL;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+ }//end if
+
+ // Create an array that maps lines to the first token on the line.
+ $lineTokens = [];
+ $lastLine = 0;
+ $stackPtr = 0;
+ foreach ($tokens as $stackPtr => $token) {
+ if ($token['line'] !== $lastLine) {
+ if ($lastLine > 0) {
+ $lineTokens[$lastLine]['end'] = ($stackPtr - 1);
+ }
+
+ $lastLine++;
+ $lineTokens[$lastLine] = [
+ 'start' => $stackPtr,
+ 'end' => null,
+ ];
+ }
+ }
+
+ // Make sure the last token in the file sits on an imaginary
+ // last line so it is easier to generate code snippets at the
+ // end of the file.
+ $lineTokens[$lastLine]['end'] = $stackPtr;
+
+ // Determine the longest code line we will be showing.
+ $maxSnippetLength = 0;
+ $eolLen = strlen($phpcsFile->eolChar);
+ foreach ($report['messages'] as $line => $lineErrors) {
+ $startLine = max(($line - $surroundingLines), 1);
+ $endLine = min(($line + $surroundingLines), $lastLine);
+
+ $maxLineNumLength = strlen($endLine);
+
+ for ($i = $startLine; $i <= $endLine; $i++) {
+ if ($i === 1) {
+ continue;
+ }
+
+ $lineLength = ($tokens[($lineTokens[$i]['start'] - 1)]['column'] + $tokens[($lineTokens[$i]['start'] - 1)]['length'] - $eolLen);
+ $maxSnippetLength = max($lineLength, $maxSnippetLength);
+ }
+ }
+
+ $maxSnippetLength += ($maxLineNumLength + 8);
+
+ // Determine the longest error message we will be showing.
+ $maxErrorLength = 0;
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $length = strlen($error['message']);
+ if ($showSources === true) {
+ $length += (strlen($error['source']) + 3);
+ }
+
+ $maxErrorLength = max($maxErrorLength, ($length + 1));
+ }
+ }
+ }
+
+ // The padding that all lines will require that are printing an error message overflow.
+ if ($report['warnings'] > 0) {
+ $typeLength = 7;
+ } else {
+ $typeLength = 5;
+ }
+
+ $errorPadding = str_repeat(' ', ($maxLineNumLength + 7));
+ $errorPadding .= str_repeat(' ', $typeLength);
+ $errorPadding .= ' ';
+ if ($report['fixable'] > 0) {
+ $errorPadding .= ' ';
+ }
+
+ $errorPaddingLength = strlen($errorPadding);
+
+ // The maximum amount of space an error message can use.
+ $maxErrorSpace = ($width - $errorPaddingLength);
+ if ($showSources === true) {
+ // Account for the chars used to print colors.
+ $maxErrorSpace += 8;
+ }
+
+ // Figure out the max report width we need and can use.
+ $fileLength = strlen($file);
+ $maxWidth = max(($fileLength + 6), ($maxErrorLength + $errorPaddingLength));
+ $width = max(min($width, $maxWidth), $maxSnippetLength);
+ if ($width < 70) {
+ $width = 70;
+ }
+
+ // Print the file header.
+ echo PHP_EOL."\033[1mFILE: ";
+ if ($fileLength <= ($width - 6)) {
+ echo $file;
+ } else {
+ echo '...'.substr($file, ($fileLength - ($width - 6)));
+ }
+
+ echo "\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+
+ echo "\033[1m".'FOUND '.$report['errors'].' ERROR';
+ if ($report['errors'] !== 1) {
+ echo 'S';
+ }
+
+ if ($report['warnings'] > 0) {
+ echo ' AND '.$report['warnings'].' WARNING';
+ if ($report['warnings'] !== 1) {
+ echo 'S';
+ }
+ }
+
+ echo ' AFFECTING '.count($report['messages']).' LINE';
+ if (count($report['messages']) !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m".PHP_EOL;
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ $startLine = max(($line - $surroundingLines), 1);
+ $endLine = min(($line + $surroundingLines), $lastLine);
+
+ $snippet = '';
+ if (isset($lineTokens[$startLine]) === true) {
+ for ($i = $lineTokens[$startLine]['start']; $i <= $lineTokens[$endLine]['end']; $i++) {
+ $snippetLine = $tokens[$i]['line'];
+ if ($lineTokens[$snippetLine]['start'] === $i) {
+ // Starting a new line.
+ if ($snippetLine === $line) {
+ $snippet .= "\033[1m".'>> ';
+ } else {
+ $snippet .= ' ';
+ }
+
+ $snippet .= str_repeat(' ', ($maxLineNumLength - strlen($snippetLine)));
+ $snippet .= $snippetLine.': ';
+ if ($snippetLine === $line) {
+ $snippet .= "\033[0m";
+ }
+ }
+
+ if (isset($tokens[$i]['orig_content']) === true) {
+ $tokenContent = $tokens[$i]['orig_content'];
+ } else {
+ $tokenContent = $tokens[$i]['content'];
+ }
+
+ if (strpos($tokenContent, "\t") !== false) {
+ $token = $tokens[$i];
+ $token['content'] = $tokenContent;
+ if (stripos(PHP_OS, 'WIN') === 0) {
+ $tab = "\000";
+ } else {
+ $tab = "\033[30;1m»\033[0m";
+ }
+
+ $phpcsFile->tokenizer->replaceTabsInToken($token, $tab, "\000");
+ $tokenContent = $token['content'];
+ }
+
+ $tokenContent = Util\Common::prepareForOutput($tokenContent, ["\r", "\n", "\t"]);
+ $tokenContent = str_replace("\000", ' ', $tokenContent);
+
+ $underline = false;
+ if ($snippetLine === $line && isset($lineErrors[$tokens[$i]['column']]) === true) {
+ $underline = true;
+ }
+
+ // Underline invisible characters as well.
+ if ($underline === true && trim($tokenContent) === '') {
+ $snippet .= "\033[4m".' '."\033[0m".$tokenContent;
+ } else {
+ if ($underline === true) {
+ $snippet .= "\033[4m";
+ }
+
+ $snippet .= $tokenContent;
+
+ if ($underline === true) {
+ $snippet .= "\033[0m";
+ }
+ }
+ }//end for
+ }//end if
+
+ echo str_repeat('-', $width).PHP_EOL;
+
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $padding = ($maxLineNumLength - strlen($line));
+ echo 'LINE '.str_repeat(' ', $padding).$line.': ';
+
+ if ($error['type'] === 'ERROR') {
+ echo "\033[31mERROR\033[0m";
+ if ($report['warnings'] > 0) {
+ echo ' ';
+ }
+ } else {
+ echo "\033[33mWARNING\033[0m";
+ }
+
+ echo ' ';
+ if ($report['fixable'] > 0) {
+ echo '[';
+ if ($error['fixable'] === true) {
+ echo 'x';
+ } else {
+ echo ' ';
+ }
+
+ echo '] ';
+ }
+
+ $message = $error['message'];
+ $message = str_replace("\n", "\n".$errorPadding, $message);
+ if ($showSources === true) {
+ $message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
+ }
+
+ $errorMsg = wordwrap(
+ $message,
+ $maxErrorSpace,
+ PHP_EOL.$errorPadding
+ );
+
+ echo $errorMsg.PHP_EOL;
+ }//end foreach
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ echo rtrim($snippet).PHP_EOL;
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ if ($report['fixable'] > 0) {
+ echo "\033[1m".'PHPCBF CAN FIX THE '.$report['fixable'].' MARKED SNIFF VIOLATIONS AUTOMATICALLY'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all errors and warnings for each file processed.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ if ($cachedData === '') {
+ return;
+ }
+
+ echo $cachedData;
+
+ if ($toScreen === true && $interactive === false) {
+ Util\Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Csv.php b/vendor/squizlabs/php_codesniffer/src/Reports/Csv.php
new file mode 100644
index 00000000..6db7ecfc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Csv.php
@@ -0,0 +1,91 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+
+class Csv implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $filename = str_replace('"', '\"', $report['filename']);
+ $message = str_replace('"', '\"', $error['message']);
+ $type = strtolower($error['type']);
+ $source = $error['source'];
+ $severity = $error['severity'];
+ $fixable = (int) $error['fixable'];
+ echo "\"$filename\",$line,$column,$type,\"$message\",$source,$severity,$fixable".PHP_EOL;
+ }
+ }
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Generates a csv report.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo 'File,Line,Column,Type,Message,Source,Severity,Fixable'.PHP_EOL;
+ echo $cachedData;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php b/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
new file mode 100644
index 00000000..ce4b31fc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
@@ -0,0 +1,130 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+
+class Diff implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $errors = $phpcsFile->getFixableCount();
+ if ($errors === 0) {
+ return false;
+ }
+
+ $phpcsFile->disableCaching();
+ $tokens = $phpcsFile->getTokens();
+ if (empty($tokens) === true) {
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ $startTime = microtime(true);
+ echo 'DIFF report is parsing '.basename($report['filename']).' ';
+ } else if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo 'DIFF report is forcing parse of '.$report['filename'].PHP_EOL;
+ }
+
+ $phpcsFile->parse();
+
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ $timeTaken = ((microtime(true) - $startTime) * 1000);
+ if ($timeTaken < 1000) {
+ $timeTaken = round($timeTaken);
+ echo "DONE in {$timeTaken}ms";
+ } else {
+ $timeTaken = round(($timeTaken / 1000), 2);
+ echo "DONE in $timeTaken secs";
+ }
+
+ echo PHP_EOL;
+ }
+
+ $phpcsFile->fixer->startFile($phpcsFile);
+ }//end if
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ ob_end_clean();
+ echo "\t*** START FILE FIXING ***".PHP_EOL;
+ }
+
+ $fixed = $phpcsFile->fixer->fixFile();
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo "\t*** END FILE FIXING ***".PHP_EOL;
+ ob_start();
+ }
+
+ if ($fixed === false) {
+ return false;
+ }
+
+ $diff = $phpcsFile->fixer->generateDiff();
+ if ($diff === '') {
+ // Nothing to print.
+ return false;
+ }
+
+ echo $diff.PHP_EOL;
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all errors and warnings for each file processed.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo $cachedData;
+ if ($toScreen === true && $cachedData !== '') {
+ echo PHP_EOL;
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Emacs.php b/vendor/squizlabs/php_codesniffer/src/Reports/Emacs.php
new file mode 100644
index 00000000..3555f554
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Emacs.php
@@ -0,0 +1,90 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+
+class Emacs implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $message = $error['message'];
+ if ($showSources === true) {
+ $message .= ' ('.$error['source'].')';
+ }
+
+ $type = strtolower($error['type']);
+ echo $report['filename'].':'.$line.':'.$column.': '.$type.' - '.$message.PHP_EOL;
+ }
+ }
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Generates an emacs report.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo $cachedData;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Full.php b/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
new file mode 100644
index 00000000..084bc8aa
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
@@ -0,0 +1,231 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util;
+
+class Full implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ // The length of the word ERROR or WARNING; used for padding.
+ if ($report['warnings'] > 0) {
+ $typeLength = 7;
+ } else {
+ $typeLength = 5;
+ }
+
+ // Work out the max line number length for formatting.
+ $maxLineNumLength = max(array_map('strlen', array_keys($report['messages'])));
+
+ // The padding that all lines will require that are
+ // printing an error message overflow.
+ $paddingLine2 = str_repeat(' ', ($maxLineNumLength + 1));
+ $paddingLine2 .= ' | ';
+ $paddingLine2 .= str_repeat(' ', $typeLength);
+ $paddingLine2 .= ' | ';
+ if ($report['fixable'] > 0) {
+ $paddingLine2 .= ' ';
+ }
+
+ $paddingLength = strlen($paddingLine2);
+
+ // Make sure the report width isn't too big.
+ $maxErrorLength = 0;
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $length = strlen($error['message']);
+ if ($showSources === true) {
+ $length += (strlen($error['source']) + 3);
+ }
+
+ $maxErrorLength = max($maxErrorLength, ($length + 1));
+ }
+ }
+ }
+
+ $file = $report['filename'];
+ $fileLength = strlen($file);
+ $maxWidth = max(($fileLength + 6), ($maxErrorLength + $paddingLength));
+ $width = min($width, $maxWidth);
+ if ($width < 70) {
+ $width = 70;
+ }
+
+ echo PHP_EOL."\033[1mFILE: ";
+ if ($fileLength <= ($width - 6)) {
+ echo $file;
+ } else {
+ echo '...'.substr($file, ($fileLength - ($width - 6)));
+ }
+
+ echo "\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+
+ echo "\033[1m".'FOUND '.$report['errors'].' ERROR';
+ if ($report['errors'] !== 1) {
+ echo 'S';
+ }
+
+ if ($report['warnings'] > 0) {
+ echo ' AND '.$report['warnings'].' WARNING';
+ if ($report['warnings'] !== 1) {
+ echo 'S';
+ }
+ }
+
+ echo ' AFFECTING '.count($report['messages']).' LINE';
+ if (count($report['messages']) !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+
+ // The maximum amount of space an error message can use.
+ $maxErrorSpace = ($width - $paddingLength - 1);
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $message = $error['message'];
+ $msgLines = [$message];
+ if (strpos($message, "\n") !== false) {
+ $msgLines = explode("\n", $message);
+ }
+
+ $errorMsg = '';
+ $lastLine = (count($msgLines) - 1);
+ foreach ($msgLines as $k => $msgLine) {
+ if ($k === 0) {
+ if ($showSources === true) {
+ $errorMsg .= "\033[1m";
+ }
+ } else {
+ $errorMsg .= PHP_EOL.$paddingLine2;
+ }
+
+ if ($k === $lastLine && $showSources === true) {
+ $msgLine .= "\033[0m".' ('.$error['source'].')';
+ }
+
+ $errorMsg .= wordwrap(
+ $msgLine,
+ $maxErrorSpace,
+ PHP_EOL.$paddingLine2
+ );
+ }
+
+ // The padding that goes on the front of the line.
+ $padding = ($maxLineNumLength - strlen($line));
+
+ echo ' '.str_repeat(' ', $padding).$line.' | ';
+ if ($error['type'] === 'ERROR') {
+ echo "\033[31mERROR\033[0m";
+ if ($report['warnings'] > 0) {
+ echo ' ';
+ }
+ } else {
+ echo "\033[33mWARNING\033[0m";
+ }
+
+ echo ' | ';
+ if ($report['fixable'] > 0) {
+ echo '[';
+ if ($error['fixable'] === true) {
+ echo 'x';
+ } else {
+ echo ' ';
+ }
+
+ echo '] ';
+ }
+
+ echo $errorMsg.PHP_EOL;
+ }//end foreach
+ }//end foreach
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ if ($report['fixable'] > 0) {
+ echo "\033[1m".'PHPCBF CAN FIX THE '.$report['fixable'].' MARKED SNIFF VIOLATIONS AUTOMATICALLY'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ }
+
+ echo PHP_EOL;
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all errors and warnings for each file processed.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ if ($cachedData === '') {
+ return;
+ }
+
+ echo $cachedData;
+
+ if ($toScreen === true && $interactive === false) {
+ Util\Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Gitblame.php b/vendor/squizlabs/php_codesniffer/src/Reports/Gitblame.php
new file mode 100644
index 00000000..6427567f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Gitblame.php
@@ -0,0 +1,91 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+
+class Gitblame extends VersionControl
+{
+
+ /**
+ * The name of the report we want in the output
+ *
+ * @var string
+ */
+ protected $reportName = 'GIT';
+
+
+ /**
+ * Extract the author from a blame line.
+ *
+ * @param string $line Line to parse.
+ *
+ * @return mixed string or false if impossible to recover.
+ */
+ protected function getAuthor($line)
+ {
+ $blameParts = [];
+ $line = preg_replace('|\s+|', ' ', $line);
+ preg_match(
+ '|\(.+[0-9]{4}-[0-9]{2}-[0-9]{2}\s+[0-9]+\)|',
+ $line,
+ $blameParts
+ );
+
+ if (isset($blameParts[0]) === false) {
+ return false;
+ }
+
+ $parts = explode(' ', $blameParts[0]);
+
+ if (count($parts) < 2) {
+ return false;
+ }
+
+ $parts = array_slice($parts, 0, (count($parts) - 2));
+ $author = preg_replace('|\(|', '', implode(' ', $parts));
+ return $author;
+
+ }//end getAuthor()
+
+
+ /**
+ * Gets the blame output.
+ *
+ * @param string $filename File to blame.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ protected function getBlameContent($filename)
+ {
+ $cwd = getcwd();
+
+ chdir(dirname($filename));
+ $command = 'git blame --date=short "'.$filename.'" 2>&1';
+ $handle = popen($command, 'r');
+ if ($handle === false) {
+ $error = 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $rawContent = stream_get_contents($handle);
+ pclose($handle);
+
+ $blames = explode("\n", $rawContent);
+ chdir($cwd);
+
+ return $blames;
+
+ }//end getBlameContent()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Hgblame.php b/vendor/squizlabs/php_codesniffer/src/Reports/Hgblame.php
new file mode 100644
index 00000000..f88a0683
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Hgblame.php
@@ -0,0 +1,110 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+
+class Hgblame extends VersionControl
+{
+
+ /**
+ * The name of the report we want in the output
+ *
+ * @var string
+ */
+ protected $reportName = 'MERCURIAL';
+
+
+ /**
+ * Extract the author from a blame line.
+ *
+ * @param string $line Line to parse.
+ *
+ * @return mixed string or false if impossible to recover.
+ */
+ protected function getAuthor($line)
+ {
+ $blameParts = [];
+ $line = preg_replace('|\s+|', ' ', $line);
+
+ preg_match(
+ '|(.+[0-9]{2}:[0-9]{2}:[0-9]{2}\s[0-9]{4}\s.[0-9]{4}:)|',
+ $line,
+ $blameParts
+ );
+
+ if (isset($blameParts[0]) === false) {
+ return false;
+ }
+
+ $parts = explode(' ', $blameParts[0]);
+
+ if (count($parts) < 6) {
+ return false;
+ }
+
+ $parts = array_slice($parts, 0, (count($parts) - 6));
+
+ return trim(preg_replace('|<.+>|', '', implode(' ', $parts)));
+
+ }//end getAuthor()
+
+
+ /**
+ * Gets the blame output.
+ *
+ * @param string $filename File to blame.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ protected function getBlameContent($filename)
+ {
+ $cwd = getcwd();
+
+ $fileParts = explode(DIRECTORY_SEPARATOR, $filename);
+ $found = false;
+ $location = '';
+ while (empty($fileParts) === false) {
+ array_pop($fileParts);
+ $location = implode(DIRECTORY_SEPARATOR, $fileParts);
+ if (is_dir($location.DIRECTORY_SEPARATOR.'.hg') === true) {
+ $found = true;
+ break;
+ }
+ }
+
+ if ($found === true) {
+ chdir($location);
+ } else {
+ $error = 'ERROR: Could not locate .hg directory '.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $command = 'hg blame -u -d -v "'.$filename.'" 2>&1';
+ $handle = popen($command, 'r');
+ if ($handle === false) {
+ $error = 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $rawContent = stream_get_contents($handle);
+ pclose($handle);
+
+ $blames = explode("\n", $rawContent);
+ chdir($cwd);
+
+ return $blames;
+
+ }//end getBlameContent()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Info.php b/vendor/squizlabs/php_codesniffer/src/Reports/Info.php
new file mode 100644
index 00000000..3181bcc5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Info.php
@@ -0,0 +1,172 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Timing;
+
+class Info implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $metrics = $phpcsFile->getMetrics();
+ foreach ($metrics as $metric => $data) {
+ foreach ($data['values'] as $value => $count) {
+ echo "$metric>>$value>>$count".PHP_EOL;
+ }
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints the source of all errors and warnings.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $lines = explode(PHP_EOL, $cachedData);
+ array_pop($lines);
+
+ if (empty($lines) === true) {
+ return;
+ }
+
+ $metrics = [];
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $metric = $parts[0];
+ $value = $parts[1];
+ $count = $parts[2];
+ if (isset($metrics[$metric]) === false) {
+ $metrics[$metric] = [];
+ }
+
+ if (isset($metrics[$metric][$value]) === false) {
+ $metrics[$metric][$value] = $count;
+ } else {
+ $metrics[$metric][$value] += $count;
+ }
+ }
+
+ ksort($metrics);
+
+ echo PHP_EOL."\033[1m".'PHP CODE SNIFFER INFORMATION REPORT'."\033[0m".PHP_EOL;
+ echo str_repeat('-', 70).PHP_EOL;
+
+ foreach ($metrics as $metric => $values) {
+ if (count($values) === 1) {
+ $count = reset($values);
+ $value = key($values);
+
+ echo "$metric: \033[4m$value\033[0m [$count/$count, 100%]".PHP_EOL;
+ } else {
+ $totalCount = 0;
+ $valueWidth = 0;
+ foreach ($values as $value => $count) {
+ $totalCount += $count;
+ $valueWidth = max($valueWidth, strlen($value));
+ }
+
+ // Length of the total string, plus however many
+ // thousands separators there are.
+ $countWidth = strlen($totalCount);
+ $thousandSeparatorCount = floor($countWidth / 3);
+ $countWidth += $thousandSeparatorCount;
+
+ // Account for 'total' line.
+ $valueWidth = max(5, $valueWidth);
+
+ echo "$metric:".PHP_EOL;
+
+ ksort($values, SORT_NATURAL);
+ arsort($values);
+
+ $percentPrefixWidth = 0;
+ $percentWidth = 6;
+ foreach ($values as $value => $count) {
+ $percent = round(($count / $totalCount * 100), 2);
+ $percentPrefix = '';
+ if ($percent === 0.00) {
+ $percent = 0.01;
+ $percentPrefix = '<';
+ $percentPrefixWidth = 2;
+ $percentWidth = 4;
+ }
+
+ printf(
+ "\t%-{$valueWidth}s => %{$countWidth}s (%{$percentPrefixWidth}s%{$percentWidth}.2f%%)".PHP_EOL,
+ $value,
+ number_format($count),
+ $percentPrefix,
+ $percent
+ );
+ }
+
+ echo "\t".str_repeat('-', ($valueWidth + $countWidth + 15)).PHP_EOL;
+ printf(
+ "\t%-{$valueWidth}s => %{$countWidth}s (100.00%%)".PHP_EOL,
+ 'total',
+ number_format($totalCount)
+ );
+ }//end if
+
+ echo PHP_EOL;
+ }//end foreach
+
+ echo str_repeat('-', 70).PHP_EOL;
+
+ if ($toScreen === true && $interactive === false) {
+ Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Json.php b/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
new file mode 100644
index 00000000..59d8f305
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
@@ -0,0 +1,106 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+
+class Json implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $filename = str_replace('\\', '\\\\', $report['filename']);
+ $filename = str_replace('"', '\"', $filename);
+ $filename = str_replace('/', '\/', $filename);
+ echo '"'.$filename.'":{';
+ echo '"errors":'.$report['errors'].',"warnings":'.$report['warnings'].',"messages":[';
+
+ $messages = '';
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $error['message'] = str_replace("\n", '\n', $error['message']);
+ $error['message'] = str_replace("\r", '\r', $error['message']);
+ $error['message'] = str_replace("\t", '\t', $error['message']);
+
+ $fixable = false;
+ if ($error['fixable'] === true) {
+ $fixable = true;
+ }
+
+ $messagesObject = (object) $error;
+ $messagesObject->line = $line;
+ $messagesObject->column = $column;
+ $messagesObject->fixable = $fixable;
+
+ $messages .= json_encode($messagesObject).",";
+ }
+ }
+ }//end foreach
+
+ echo rtrim($messages, ',');
+ echo ']},';
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Generates a JSON report.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo '{"totals":{"errors":'.$totalErrors.',"warnings":'.$totalWarnings.',"fixable":'.$totalFixable.'},"files":{';
+ echo rtrim($cachedData, ',');
+ echo "}}".PHP_EOL;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php b/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
new file mode 100644
index 00000000..d3ede61d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
@@ -0,0 +1,131 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+
+class Junit implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $out = new \XMLWriter;
+ $out->openMemory();
+ $out->setIndent(true);
+
+ $out->startElement('testsuite');
+ $out->writeAttribute('name', $report['filename']);
+ $out->writeAttribute('errors', 0);
+
+ if (count($report['messages']) === 0) {
+ $out->writeAttribute('tests', 1);
+ $out->writeAttribute('failures', 0);
+
+ $out->startElement('testcase');
+ $out->writeAttribute('name', $report['filename']);
+ $out->endElement();
+ } else {
+ $failures = ($report['errors'] + $report['warnings']);
+ $out->writeAttribute('tests', $failures);
+ $out->writeAttribute('failures', $failures);
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $out->startElement('testcase');
+ $out->writeAttribute('name', $error['source'].' at '.$report['filename']." ($line:$column)");
+
+ $error['type'] = strtolower($error['type']);
+ if ($phpcsFile->config->encoding !== 'utf-8') {
+ $error['message'] = iconv($phpcsFile->config->encoding, 'utf-8', $error['message']);
+ }
+
+ $out->startElement('failure');
+ $out->writeAttribute('type', $error['type']);
+ $out->writeAttribute('message', $error['message']);
+ $out->endElement();
+
+ $out->endElement();
+ }
+ }
+ }
+ }//end if
+
+ $out->endElement();
+ echo $out->flush();
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all violations for processed files, in a proprietary XML format.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ // Figure out the total number of tests.
+ $tests = 0;
+ $matches = [];
+ preg_match_all('/tests="([0-9]+)"/', $cachedData, $matches);
+ if (isset($matches[1]) === true) {
+ foreach ($matches[1] as $match) {
+ $tests += $match;
+ }
+ }
+
+ $failures = ($totalErrors + $totalWarnings);
+ echo ''.PHP_EOL;
+ echo ''.PHP_EOL;
+ echo $cachedData;
+ echo ''.PHP_EOL;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Notifysend.php b/vendor/squizlabs/php_codesniffer/src/Reports/Notifysend.php
new file mode 100644
index 00000000..08416622
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Notifysend.php
@@ -0,0 +1,242 @@
+
+ * @author Greg Sherwood
+ * @copyright 2012-2014 Christian Weiske
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Common;
+
+class Notifysend implements Report
+{
+
+ /**
+ * Notification timeout in milliseconds.
+ *
+ * @var integer
+ */
+ protected $timeout = 3000;
+
+ /**
+ * Path to notify-send command.
+ *
+ * @var string
+ */
+ protected $path = 'notify-send';
+
+ /**
+ * Show "ok, all fine" messages.
+ *
+ * @var boolean
+ */
+ protected $showOk = true;
+
+ /**
+ * Version of installed notify-send executable.
+ *
+ * @var string
+ */
+ protected $version = null;
+
+
+ /**
+ * Load configuration data.
+ */
+ public function __construct()
+ {
+ $path = Config::getExecutablePath('notifysend');
+ if ($path !== null) {
+ $this->path = Common::escapeshellcmd($path);
+ }
+
+ $timeout = Config::getConfigData('notifysend_timeout');
+ if ($timeout !== null) {
+ $this->timeout = (int) $timeout;
+ }
+
+ $showOk = Config::getConfigData('notifysend_showok');
+ if ($showOk !== null) {
+ $this->showOk = (bool) $showOk;
+ }
+
+ $this->version = str_replace(
+ 'notify-send ',
+ '',
+ exec($this->path.' --version')
+ );
+
+ }//end __construct()
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ echo $report['filename'].PHP_EOL;
+
+ // We want this file counted in the total number
+ // of checked files even if it has no errors.
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Generates a summary of errors and warnings for each file processed.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $checkedFiles = explode(PHP_EOL, trim($cachedData));
+
+ $msg = $this->generateMessage($checkedFiles, $totalErrors, $totalWarnings);
+ if ($msg === null) {
+ if ($this->showOk === true) {
+ $this->notifyAllFine();
+ }
+ } else {
+ $this->notifyErrors($msg);
+ }
+
+ }//end generate()
+
+
+ /**
+ * Generate the error message to show to the user.
+ *
+ * @param string[] $checkedFiles The files checked during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ *
+ * @return string Error message or NULL if no error/warning found.
+ */
+ protected function generateMessage($checkedFiles, $totalErrors, $totalWarnings)
+ {
+ if ($totalErrors === 0 && $totalWarnings === 0) {
+ // Nothing to print.
+ return null;
+ }
+
+ $totalFiles = count($checkedFiles);
+
+ $msg = '';
+ if ($totalFiles > 1) {
+ $msg .= 'Checked '.$totalFiles.' files'.PHP_EOL;
+ } else {
+ $msg .= $checkedFiles[0].PHP_EOL;
+ }
+
+ if ($totalWarnings > 0) {
+ $msg .= $totalWarnings.' warnings'.PHP_EOL;
+ }
+
+ if ($totalErrors > 0) {
+ $msg .= $totalErrors.' errors'.PHP_EOL;
+ }
+
+ return $msg;
+
+ }//end generateMessage()
+
+
+ /**
+ * Tell the user that all is fine and no error/warning has been found.
+ *
+ * @return void
+ */
+ protected function notifyAllFine()
+ {
+ $cmd = $this->getBasicCommand();
+ $cmd .= ' -i info';
+ $cmd .= ' "PHP CodeSniffer: Ok"';
+ $cmd .= ' "All fine"';
+ exec($cmd);
+
+ }//end notifyAllFine()
+
+
+ /**
+ * Tell the user that errors/warnings have been found.
+ *
+ * @param string $msg Message to display.
+ *
+ * @return void
+ */
+ protected function notifyErrors($msg)
+ {
+ $cmd = $this->getBasicCommand();
+ $cmd .= ' -i error';
+ $cmd .= ' "PHP CodeSniffer: Error"';
+ $cmd .= ' '.escapeshellarg(trim($msg));
+ exec($cmd);
+
+ }//end notifyErrors()
+
+
+ /**
+ * Generate and return the basic notify-send command string to execute.
+ *
+ * @return string Shell command with common parameters.
+ */
+ protected function getBasicCommand()
+ {
+ $cmd = $this->path;
+ $cmd .= ' --category dev.validate';
+ $cmd .= ' -h int:transient:1';
+ $cmd .= ' -t '.(int) $this->timeout;
+ if (version_compare($this->version, '0.7.3', '>=') === true) {
+ $cmd .= ' -a phpcs';
+ }
+
+ return $cmd;
+
+ }//end getBasicCommand()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Report.php b/vendor/squizlabs/php_codesniffer/src/Reports/Report.php
new file mode 100644
index 00000000..38f8a629
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Report.php
@@ -0,0 +1,64 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+
+interface Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80);
+
+
+ /**
+ * Generate the actual report.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ );
+
+
+}//end interface
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Source.php b/vendor/squizlabs/php_codesniffer/src/Reports/Source.php
new file mode 100644
index 00000000..ce8c3cfe
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Source.php
@@ -0,0 +1,336 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Timing;
+
+class Source implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ $sources = [];
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $src = $error['source'];
+ if (isset($sources[$src]) === false) {
+ $sources[$src] = [
+ 'fixable' => (int) $error['fixable'],
+ 'count' => 1,
+ ];
+ } else {
+ $sources[$src]['count']++;
+ }
+ }
+ }
+ }
+
+ foreach ($sources as $source => $data) {
+ echo $source.'>>'.$data['fixable'].'>>'.$data['count'].PHP_EOL;
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints the source of all errors and warnings.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $lines = explode(PHP_EOL, $cachedData);
+ array_pop($lines);
+
+ if (empty($lines) === true) {
+ return;
+ }
+
+ $sources = [];
+ $maxLength = 0;
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $source = $parts[0];
+ $fixable = (bool) $parts[1];
+ $count = $parts[2];
+
+ if (isset($sources[$source]) === false) {
+ if ($showSources === true) {
+ $parts = null;
+ $sniff = $source;
+ } else {
+ $parts = explode('.', $source);
+ if ($parts[0] === 'Internal') {
+ $parts[2] = $parts[1];
+ $parts[1] = '';
+ }
+
+ $parts[1] = $this->makeFriendlyName($parts[1]);
+
+ $sniff = $this->makeFriendlyName($parts[2]);
+ if (isset($parts[3]) === true) {
+ $name = $this->makeFriendlyName($parts[3]);
+ $name[0] = strtolower($name[0]);
+ $sniff .= ' '.$name;
+ unset($parts[3]);
+ }
+
+ $parts[2] = $sniff;
+ }//end if
+
+ $maxLength = max($maxLength, strlen($sniff));
+
+ $sources[$source] = [
+ 'count' => $count,
+ 'fixable' => $fixable,
+ 'parts' => $parts,
+ ];
+ } else {
+ $sources[$source]['count'] += $count;
+ }//end if
+ }//end foreach
+
+ if ($showSources === true) {
+ $width = min($width, ($maxLength + 11));
+ } else {
+ $width = min($width, ($maxLength + 41));
+ }
+
+ $width = max($width, 70);
+
+ // Sort the data based on counts and source code.
+ $sourceCodes = array_keys($sources);
+ $counts = [];
+ foreach ($sources as $source => $data) {
+ $counts[$source] = $data['count'];
+ }
+
+ array_multisort($counts, SORT_DESC, $sourceCodes, SORT_ASC, SORT_NATURAL, $sources);
+
+ echo PHP_EOL."\033[1mPHP CODE SNIFFER VIOLATION SOURCE SUMMARY\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL."\033[1m";
+ if ($showSources === true) {
+ if ($totalFixable > 0) {
+ echo ' SOURCE'.str_repeat(' ', ($width - 15)).'COUNT'.PHP_EOL;
+ } else {
+ echo 'SOURCE'.str_repeat(' ', ($width - 11)).'COUNT'.PHP_EOL;
+ }
+ } else {
+ if ($totalFixable > 0) {
+ echo ' STANDARD CATEGORY SNIFF'.str_repeat(' ', ($width - 44)).'COUNT'.PHP_EOL;
+ } else {
+ echo 'STANDARD CATEGORY SNIFF'.str_repeat(' ', ($width - 40)).'COUNT'.PHP_EOL;
+ }
+ }
+
+ echo "\033[0m".str_repeat('-', $width).PHP_EOL;
+
+ $fixableSources = 0;
+
+ if ($showSources === true) {
+ $maxSniffWidth = ($width - 7);
+ } else {
+ $maxSniffWidth = ($width - 37);
+ }
+
+ if ($totalFixable > 0) {
+ $maxSniffWidth -= 4;
+ }
+
+ foreach ($sources as $source => $sourceData) {
+ if ($totalFixable > 0) {
+ echo '[';
+ if ($sourceData['fixable'] === true) {
+ echo 'x';
+ $fixableSources++;
+ } else {
+ echo ' ';
+ }
+
+ echo '] ';
+ }
+
+ if ($showSources === true) {
+ if (strlen($source) > $maxSniffWidth) {
+ $source = substr($source, 0, $maxSniffWidth);
+ }
+
+ echo $source;
+ if ($totalFixable > 0) {
+ echo str_repeat(' ', ($width - 9 - strlen($source)));
+ } else {
+ echo str_repeat(' ', ($width - 5 - strlen($source)));
+ }
+ } else {
+ $parts = $sourceData['parts'];
+
+ if (strlen($parts[0]) > 8) {
+ $parts[0] = substr($parts[0], 0, ((strlen($parts[0]) - 8) * -1));
+ }
+
+ echo $parts[0].str_repeat(' ', (10 - strlen($parts[0])));
+
+ $category = $parts[1];
+ if (strlen($category) > 18) {
+ $category = substr($category, 0, ((strlen($category) - 18) * -1));
+ }
+
+ echo $category.str_repeat(' ', (20 - strlen($category)));
+
+ $sniff = $parts[2];
+ if (strlen($sniff) > $maxSniffWidth) {
+ $sniff = substr($sniff, 0, $maxSniffWidth);
+ }
+
+ if ($totalFixable > 0) {
+ echo $sniff.str_repeat(' ', ($width - 39 - strlen($sniff)));
+ } else {
+ echo $sniff.str_repeat(' ', ($width - 35 - strlen($sniff)));
+ }
+ }//end if
+
+ echo $sourceData['count'].PHP_EOL;
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1m".'A TOTAL OF '.($totalErrors + $totalWarnings).' SNIFF VIOLATION';
+ if (($totalErrors + $totalWarnings) > 1) {
+ echo 'S';
+ }
+
+ echo ' WERE FOUND IN '.count($sources).' SOURCE';
+ if (count($sources) !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m";
+
+ if ($totalFixable > 0) {
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mPHPCBF CAN FIX THE $fixableSources MARKED SOURCES AUTOMATICALLY ($totalFixable VIOLATIONS IN TOTAL)\033[0m";
+ }
+
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL.PHP_EOL;
+
+ if ($toScreen === true && $interactive === false) {
+ Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+ /**
+ * Converts a camel caps name into a readable string.
+ *
+ * @param string $name The camel caps name to convert.
+ *
+ * @return string
+ */
+ public function makeFriendlyName($name)
+ {
+ if (trim($name) === '') {
+ return '';
+ }
+
+ $friendlyName = '';
+ $length = strlen($name);
+
+ $lastWasUpper = false;
+ $lastWasNumeric = false;
+ for ($i = 0; $i < $length; $i++) {
+ if (is_numeric($name[$i]) === true) {
+ if ($lastWasNumeric === false) {
+ $friendlyName .= ' ';
+ }
+
+ $lastWasUpper = false;
+ $lastWasNumeric = true;
+ } else {
+ $lastWasNumeric = false;
+
+ $char = strtolower($name[$i]);
+ if ($char === $name[$i]) {
+ // Lowercase.
+ $lastWasUpper = false;
+ } else {
+ // Uppercase.
+ if ($lastWasUpper === false) {
+ $friendlyName .= ' ';
+ if ($i < ($length - 1)) {
+ $next = $name[($i + 1)];
+ if (strtolower($next) === $next) {
+ // Next char is lowercase so it is a word boundary.
+ $name[$i] = strtolower($name[$i]);
+ }
+ }
+ }
+
+ $lastWasUpper = true;
+ }
+ }//end if
+
+ $friendlyName .= $name[$i];
+ }//end for
+
+ $friendlyName = trim($friendlyName);
+ $friendlyName[0] = strtoupper($friendlyName[0]);
+
+ return $friendlyName;
+
+ }//end makeFriendlyName()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Summary.php b/vendor/squizlabs/php_codesniffer/src/Reports/Summary.php
new file mode 100644
index 00000000..8fe18e76
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Summary.php
@@ -0,0 +1,183 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util;
+
+class Summary implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ if (PHP_CODESNIFFER_VERBOSITY === 0
+ && $report['errors'] === 0
+ && $report['warnings'] === 0
+ ) {
+ // Nothing to print.
+ return false;
+ }
+
+ echo $report['filename'].'>>'.$report['errors'].'>>'.$report['warnings'].PHP_EOL;
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Generates a summary of errors and warnings for each file processed.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $lines = explode(PHP_EOL, $cachedData);
+ array_pop($lines);
+
+ if (empty($lines) === true) {
+ return;
+ }
+
+ $reportFiles = [];
+ $maxLength = 0;
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $fileLen = strlen($parts[0]);
+ $reportFiles[$parts[0]] = [
+ 'errors' => $parts[1],
+ 'warnings' => $parts[2],
+ 'strlen' => $fileLen,
+ ];
+
+ $maxLength = max($maxLength, $fileLen);
+ }
+
+ uksort(
+ $reportFiles,
+ function ($keyA, $keyB) {
+ $pathPartsA = explode(DIRECTORY_SEPARATOR, $keyA);
+ $pathPartsB = explode(DIRECTORY_SEPARATOR, $keyB);
+
+ do {
+ $partA = array_shift($pathPartsA);
+ $partB = array_shift($pathPartsB);
+ } while ($partA === $partB && empty($pathPartsA) === false && empty($pathPartsB) === false);
+
+ if (empty($pathPartsA) === false && empty($pathPartsB) === true) {
+ return 1;
+ } else if (empty($pathPartsA) === true && empty($pathPartsB) === false) {
+ return -1;
+ } else {
+ return strcasecmp($partA, $partB);
+ }
+ }
+ );
+
+ $width = min($width, ($maxLength + 21));
+ $width = max($width, 70);
+
+ echo PHP_EOL."\033[1m".'PHP CODE SNIFFER REPORT SUMMARY'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1m".'FILE'.str_repeat(' ', ($width - 20)).'ERRORS WARNINGS'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+
+ foreach ($reportFiles as $file => $data) {
+ $padding = ($width - 18 - $data['strlen']);
+ if ($padding < 0) {
+ $file = '...'.substr($file, (($padding * -1) + 3));
+ $padding = 0;
+ }
+
+ echo $file.str_repeat(' ', $padding).' ';
+ if ($data['errors'] !== 0) {
+ echo "\033[31m".$data['errors']."\033[0m";
+ echo str_repeat(' ', (8 - strlen((string) $data['errors'])));
+ } else {
+ echo '0 ';
+ }
+
+ if ($data['warnings'] !== 0) {
+ echo "\033[33m".$data['warnings']."\033[0m";
+ } else {
+ echo '0';
+ }
+
+ echo PHP_EOL;
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mA TOTAL OF $totalErrors ERROR";
+ if ($totalErrors !== 1) {
+ echo 'S';
+ }
+
+ echo ' AND '.$totalWarnings.' WARNING';
+ if ($totalWarnings !== 1) {
+ echo 'S';
+ }
+
+ echo ' WERE FOUND IN '.$totalFiles.' FILE';
+ if ($totalFiles !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m";
+
+ if ($totalFixable > 0) {
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mPHPCBF CAN FIX $totalFixable OF THESE SNIFF VIOLATIONS AUTOMATICALLY\033[0m";
+ }
+
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL.PHP_EOL;
+
+ if ($toScreen === true && $interactive === false) {
+ Util\Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Svnblame.php b/vendor/squizlabs/php_codesniffer/src/Reports/Svnblame.php
new file mode 100644
index 00000000..a7f65e15
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Svnblame.php
@@ -0,0 +1,73 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+
+class Svnblame extends VersionControl
+{
+
+ /**
+ * The name of the report we want in the output
+ *
+ * @var string
+ */
+ protected $reportName = 'SVN';
+
+
+ /**
+ * Extract the author from a blame line.
+ *
+ * @param string $line Line to parse.
+ *
+ * @return mixed string or false if impossible to recover.
+ */
+ protected function getAuthor($line)
+ {
+ $blameParts = [];
+ preg_match('|\s*([^\s]+)\s+([^\s]+)|', $line, $blameParts);
+
+ if (isset($blameParts[2]) === false) {
+ return false;
+ }
+
+ return $blameParts[2];
+
+ }//end getAuthor()
+
+
+ /**
+ * Gets the blame output.
+ *
+ * @param string $filename File to blame.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ protected function getBlameContent($filename)
+ {
+ $command = 'svn blame "'.$filename.'" 2>&1';
+ $handle = popen($command, 'r');
+ if ($handle === false) {
+ $error = 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $rawContent = stream_get_contents($handle);
+ pclose($handle);
+
+ $blames = explode("\n", $rawContent);
+
+ return $blames;
+
+ }//end getBlameContent()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/VersionControl.php b/vendor/squizlabs/php_codesniffer/src/Reports/VersionControl.php
new file mode 100644
index 00000000..0f414567
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/VersionControl.php
@@ -0,0 +1,376 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Timing;
+
+abstract class VersionControl implements Report
+{
+
+ /**
+ * The name of the report we want in the output.
+ *
+ * @var string
+ */
+ protected $reportName = 'VERSION CONTROL';
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $blames = $this->getBlameContent($report['filename']);
+
+ $authorCache = [];
+ $praiseCache = [];
+ $sourceCache = [];
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ $author = 'Unknown';
+ if (isset($blames[($line - 1)]) === true) {
+ $blameAuthor = $this->getAuthor($blames[($line - 1)]);
+ if ($blameAuthor !== false) {
+ $author = $blameAuthor;
+ }
+ }
+
+ if (isset($authorCache[$author]) === false) {
+ $authorCache[$author] = 0;
+ $praiseCache[$author] = [
+ 'good' => 0,
+ 'bad' => 0,
+ ];
+ }
+
+ $praiseCache[$author]['bad']++;
+
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $authorCache[$author]++;
+
+ if ($showSources === true) {
+ $source = $error['source'];
+ if (isset($sourceCache[$author][$source]) === false) {
+ $sourceCache[$author][$source] = [
+ 'count' => 1,
+ 'fixable' => $error['fixable'],
+ ];
+ } else {
+ $sourceCache[$author][$source]['count']++;
+ }
+ }
+ }
+ }
+
+ unset($blames[($line - 1)]);
+ }//end foreach
+
+ // Now go through and give the authors some credit for
+ // all the lines that do not have errors.
+ foreach ($blames as $line) {
+ $author = $this->getAuthor($line);
+ if ($author === false) {
+ $author = 'Unknown';
+ }
+
+ if (isset($authorCache[$author]) === false) {
+ // This author doesn't have any errors.
+ if (PHP_CODESNIFFER_VERBOSITY === 0) {
+ continue;
+ }
+
+ $authorCache[$author] = 0;
+ $praiseCache[$author] = [
+ 'good' => 0,
+ 'bad' => 0,
+ ];
+ }
+
+ $praiseCache[$author]['good']++;
+ }//end foreach
+
+ foreach ($authorCache as $author => $errors) {
+ echo "AUTHOR>>$author>>$errors".PHP_EOL;
+ }
+
+ foreach ($praiseCache as $author => $praise) {
+ echo "PRAISE>>$author>>".$praise['good'].'>>'.$praise['bad'].PHP_EOL;
+ }
+
+ foreach ($sourceCache as $author => $sources) {
+ foreach ($sources as $source => $sourceData) {
+ $count = $sourceData['count'];
+ $fixable = (int) $sourceData['fixable'];
+ echo "SOURCE>>$author>>$source>>$count>>$fixable".PHP_EOL;
+ }
+ }
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints the author of all errors and warnings, as given by "version control blame".
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ $errorsShown = ($totalErrors + $totalWarnings);
+ if ($errorsShown === 0) {
+ // Nothing to show.
+ return;
+ }
+
+ $lines = explode(PHP_EOL, $cachedData);
+ array_pop($lines);
+
+ if (empty($lines) === true) {
+ return;
+ }
+
+ $authorCache = [];
+ $praiseCache = [];
+ $sourceCache = [];
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ switch ($parts[0]) {
+ case 'AUTHOR':
+ if (isset($authorCache[$parts[1]]) === false) {
+ $authorCache[$parts[1]] = $parts[2];
+ } else {
+ $authorCache[$parts[1]] += $parts[2];
+ }
+ break;
+ case 'PRAISE':
+ if (isset($praiseCache[$parts[1]]) === false) {
+ $praiseCache[$parts[1]] = [
+ 'good' => $parts[2],
+ 'bad' => $parts[3],
+ ];
+ } else {
+ $praiseCache[$parts[1]]['good'] += $parts[2];
+ $praiseCache[$parts[1]]['bad'] += $parts[3];
+ }
+ break;
+ case 'SOURCE':
+ if (isset($praiseCache[$parts[1]]) === false) {
+ $praiseCache[$parts[1]] = [];
+ }
+
+ if (isset($sourceCache[$parts[1]][$parts[2]]) === false) {
+ $sourceCache[$parts[1]][$parts[2]] = [
+ 'count' => $parts[3],
+ 'fixable' => (bool) $parts[4],
+ ];
+ } else {
+ $sourceCache[$parts[1]][$parts[2]]['count'] += $parts[3];
+ }
+ break;
+ default:
+ break;
+ }//end switch
+ }//end foreach
+
+ // Make sure the report width isn't too big.
+ $maxLength = 0;
+ foreach ($authorCache as $author => $count) {
+ $maxLength = max($maxLength, strlen($author));
+ if ($showSources === true && isset($sourceCache[$author]) === true) {
+ foreach ($sourceCache[$author] as $source => $sourceData) {
+ if ($source === 'count') {
+ continue;
+ }
+
+ $maxLength = max($maxLength, (strlen($source) + 9));
+ }
+ }
+ }
+
+ $width = min($width, ($maxLength + 30));
+ $width = max($width, 70);
+ arsort($authorCache);
+
+ echo PHP_EOL."\033[1m".'PHP CODE SNIFFER '.$this->reportName.' BLAME SUMMARY'."\033[0m".PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL."\033[1m";
+ if ($showSources === true) {
+ echo 'AUTHOR SOURCE'.str_repeat(' ', ($width - 43)).'(Author %) (Overall %) COUNT'.PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ } else {
+ echo 'AUTHOR'.str_repeat(' ', ($width - 34)).'(Author %) (Overall %) COUNT'.PHP_EOL;
+ echo str_repeat('-', $width).PHP_EOL;
+ }
+
+ echo "\033[0m";
+
+ if ($showSources === true) {
+ $maxSniffWidth = ($width - 15);
+
+ if ($totalFixable > 0) {
+ $maxSniffWidth -= 4;
+ }
+ }
+
+ $fixableSources = 0;
+
+ foreach ($authorCache as $author => $count) {
+ if ($praiseCache[$author]['good'] === 0) {
+ $percent = 0;
+ } else {
+ $total = ($praiseCache[$author]['bad'] + $praiseCache[$author]['good']);
+ $percent = round(($praiseCache[$author]['bad'] / $total * 100), 2);
+ }
+
+ $overallPercent = '('.round((($count / $errorsShown) * 100), 2).')';
+ $authorPercent = '('.$percent.')';
+ $line = str_repeat(' ', (6 - strlen($count))).$count;
+ $line = str_repeat(' ', (12 - strlen($overallPercent))).$overallPercent.$line;
+ $line = str_repeat(' ', (11 - strlen($authorPercent))).$authorPercent.$line;
+ $line = $author.str_repeat(' ', ($width - strlen($author) - strlen($line))).$line;
+
+ if ($showSources === true) {
+ $line = "\033[1m$line\033[0m";
+ }
+
+ echo $line.PHP_EOL;
+
+ if ($showSources === true && isset($sourceCache[$author]) === true) {
+ $errors = $sourceCache[$author];
+ asort($errors);
+ $errors = array_reverse($errors);
+
+ foreach ($errors as $source => $sourceData) {
+ if ($source === 'count') {
+ continue;
+ }
+
+ $count = $sourceData['count'];
+
+ $srcLength = strlen($source);
+ if ($srcLength > $maxSniffWidth) {
+ $source = substr($source, 0, $maxSniffWidth);
+ }
+
+ $line = str_repeat(' ', (5 - strlen($count))).$count;
+
+ echo ' ';
+ if ($totalFixable > 0) {
+ echo '[';
+ if ($sourceData['fixable'] === true) {
+ echo 'x';
+ $fixableSources++;
+ } else {
+ echo ' ';
+ }
+
+ echo '] ';
+ }
+
+ echo $source;
+ if ($totalFixable > 0) {
+ echo str_repeat(' ', ($width - 18 - strlen($source)));
+ } else {
+ echo str_repeat(' ', ($width - 14 - strlen($source)));
+ }
+
+ echo $line.PHP_EOL;
+ }//end foreach
+ }//end if
+ }//end foreach
+
+ echo str_repeat('-', $width).PHP_EOL;
+ echo "\033[1m".'A TOTAL OF '.$errorsShown.' SNIFF VIOLATION';
+ if ($errorsShown !== 1) {
+ echo 'S';
+ }
+
+ echo ' WERE COMMITTED BY '.count($authorCache).' AUTHOR';
+ if (count($authorCache) !== 1) {
+ echo 'S';
+ }
+
+ echo "\033[0m";
+
+ if ($totalFixable > 0) {
+ if ($showSources === true) {
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mPHPCBF CAN FIX THE $fixableSources MARKED SOURCES AUTOMATICALLY ($totalFixable VIOLATIONS IN TOTAL)\033[0m";
+ } else {
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL;
+ echo "\033[1mPHPCBF CAN FIX $totalFixable OF THESE SNIFF VIOLATIONS AUTOMATICALLY\033[0m";
+ }
+ }
+
+ echo PHP_EOL.str_repeat('-', $width).PHP_EOL.PHP_EOL;
+
+ if ($toScreen === true && $interactive === false) {
+ Timing::printRunTime();
+ }
+
+ }//end generate()
+
+
+ /**
+ * Extract the author from a blame line.
+ *
+ * @param string $line Line to parse.
+ *
+ * @return mixed string or false if impossible to recover.
+ */
+ abstract protected function getAuthor($line);
+
+
+ /**
+ * Gets the blame output.
+ *
+ * @param string $filename File to blame.
+ *
+ * @return array
+ */
+ abstract protected function getBlameContent($filename);
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Reports/Xml.php b/vendor/squizlabs/php_codesniffer/src/Reports/Xml.php
new file mode 100644
index 00000000..066383de
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Xml.php
@@ -0,0 +1,126 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Reports;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+
+class Xml implements Report
+{
+
+
+ /**
+ * Generate a partial report for a single processed file.
+ *
+ * Function should return TRUE if it printed or stored data about the file
+ * and FALSE if it ignored the file. Returning TRUE indicates that the file and
+ * its data should be counted in the grand totals.
+ *
+ * @param array $report Prepared report data.
+ * @param \PHP_CodeSniffer\File $phpcsFile The file being reported on.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ *
+ * @return bool
+ */
+ public function generateFileReport($report, File $phpcsFile, $showSources=false, $width=80)
+ {
+ $out = new \XMLWriter;
+ $out->openMemory();
+ $out->setIndent(true);
+ $out->setIndentString(' ');
+ $out->startDocument('1.0', 'UTF-8');
+
+ if ($report['errors'] === 0 && $report['warnings'] === 0) {
+ // Nothing to print.
+ return false;
+ }
+
+ $out->startElement('file');
+ $out->writeAttribute('name', $report['filename']);
+ $out->writeAttribute('errors', $report['errors']);
+ $out->writeAttribute('warnings', $report['warnings']);
+ $out->writeAttribute('fixable', $report['fixable']);
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $error['type'] = strtolower($error['type']);
+ if ($phpcsFile->config->encoding !== 'utf-8') {
+ $error['message'] = iconv($phpcsFile->config->encoding, 'utf-8', $error['message']);
+ }
+
+ $out->startElement($error['type']);
+ $out->writeAttribute('line', $line);
+ $out->writeAttribute('column', $column);
+ $out->writeAttribute('source', $error['source']);
+ $out->writeAttribute('severity', $error['severity']);
+ $out->writeAttribute('fixable', (int) $error['fixable']);
+ $out->text($error['message']);
+ $out->endElement();
+ }
+ }
+ }//end foreach
+
+ $out->endElement();
+
+ // Remove the start of the document because we will
+ // add that manually later. We only have it in here to
+ // properly set the encoding.
+ $content = $out->flush();
+ if (strpos($content, PHP_EOL) !== false) {
+ $content = substr($content, (strpos($content, PHP_EOL) + strlen(PHP_EOL)));
+ } else if (strpos($content, "\n") !== false) {
+ $content = substr($content, (strpos($content, "\n") + 1));
+ }
+
+ echo $content;
+
+ return true;
+
+ }//end generateFileReport()
+
+
+ /**
+ * Prints all violations for processed files, in a proprietary XML format.
+ *
+ * @param string $cachedData Any partial report data that was returned from
+ * generateFileReport during the run.
+ * @param int $totalFiles Total number of files processed during the run.
+ * @param int $totalErrors Total number of errors found during the run.
+ * @param int $totalWarnings Total number of warnings found during the run.
+ * @param int $totalFixable Total number of problems that can be fixed.
+ * @param bool $showSources Show sources?
+ * @param int $width Maximum allowed line width.
+ * @param bool $interactive Are we running in interactive mode?
+ * @param bool $toScreen Is the report being printed to screen?
+ *
+ * @return void
+ */
+ public function generate(
+ $cachedData,
+ $totalFiles,
+ $totalErrors,
+ $totalWarnings,
+ $totalFixable,
+ $showSources=false,
+ $width=80,
+ $interactive=false,
+ $toScreen=true
+ ) {
+ echo ''.PHP_EOL;
+ echo ''.PHP_EOL;
+ echo $cachedData;
+ echo ''.PHP_EOL;
+
+ }//end generate()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Ruleset.php b/vendor/squizlabs/php_codesniffer/src/Ruleset.php
new file mode 100644
index 00000000..7e659706
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Ruleset.php
@@ -0,0 +1,1383 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Util;
+
+class Ruleset
+{
+
+ /**
+ * The name of the coding standard being used.
+ *
+ * If a top-level standard includes other standards, or sniffs
+ * from other standards, only the name of the top-level standard
+ * will be stored in here.
+ *
+ * If multiple top-level standards are being loaded into
+ * a single ruleset object, this will store a comma separated list
+ * of the top-level standard names.
+ *
+ * @var string
+ */
+ public $name = '';
+
+ /**
+ * A list of file paths for the ruleset files being used.
+ *
+ * @var string[]
+ */
+ public $paths = [];
+
+ /**
+ * A list of regular expressions used to ignore specific sniffs for files and folders.
+ *
+ * Is also used to set global exclude patterns.
+ * The key is the regular expression and the value is the type
+ * of ignore pattern (absolute or relative).
+ *
+ * @var array
+ */
+ public $ignorePatterns = [];
+
+ /**
+ * A list of regular expressions used to include specific sniffs for files and folders.
+ *
+ * The key is the sniff code and the value is an array with
+ * the key being a regular expression and the value is the type
+ * of ignore pattern (absolute or relative).
+ *
+ * @var array>
+ */
+ public $includePatterns = [];
+
+ /**
+ * An array of sniff objects that are being used to check files.
+ *
+ * The key is the fully qualified name of the sniff class
+ * and the value is the sniff object.
+ *
+ * @var array
+ */
+ public $sniffs = [];
+
+ /**
+ * A mapping of sniff codes to fully qualified class names.
+ *
+ * The key is the sniff code and the value
+ * is the fully qualified name of the sniff class.
+ *
+ * @var array
+ */
+ public $sniffCodes = [];
+
+ /**
+ * An array of token types and the sniffs that are listening for them.
+ *
+ * The key is the token name being listened for and the value
+ * is the sniff object.
+ *
+ * @var array
+ */
+ public $tokenListeners = [];
+
+ /**
+ * An array of rules from the ruleset.xml file.
+ *
+ * It may be empty, indicating that the ruleset does not override
+ * any of the default sniff settings.
+ *
+ * @var array
+ */
+ public $ruleset = [];
+
+ /**
+ * The directories that the processed rulesets are in.
+ *
+ * @var string[]
+ */
+ protected $rulesetDirs = [];
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ private $config = null;
+
+
+ /**
+ * Initialise the ruleset that the run will use.
+ *
+ * @param \PHP_CodeSniffer\Config $config The config data for the run.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If no sniffs were registered.
+ */
+ public function __construct(Config $config)
+ {
+ $this->config = $config;
+ $restrictions = $config->sniffs;
+ $exclusions = $config->exclude;
+ $sniffs = [];
+
+ $standardPaths = [];
+ foreach ($config->standards as $standard) {
+ $installed = Util\Standards::getInstalledStandardPath($standard);
+ if ($installed === null) {
+ $standard = Util\Common::realpath($standard);
+ if (is_dir($standard) === true
+ && is_file(Util\Common::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml')) === true
+ ) {
+ $standard = Util\Common::realpath($standard.DIRECTORY_SEPARATOR.'ruleset.xml');
+ }
+ } else {
+ $standard = $installed;
+ }
+
+ $standardPaths[] = $standard;
+ }
+
+ foreach ($standardPaths as $standard) {
+ $ruleset = @simplexml_load_string(file_get_contents($standard));
+ if ($ruleset !== false) {
+ $standardName = (string) $ruleset['name'];
+ if ($this->name !== '') {
+ $this->name .= ', ';
+ }
+
+ $this->name .= $standardName;
+
+ // Allow autoloading of custom files inside this standard.
+ if (isset($ruleset['namespace']) === true) {
+ $namespace = (string) $ruleset['namespace'];
+ } else {
+ $namespace = basename(dirname($standard));
+ }
+
+ Autoload::addSearchPath(dirname($standard), $namespace);
+ }
+
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === true && empty($restrictions) === false) {
+ // In unit tests, only register the sniffs that the test wants and not the entire standard.
+ try {
+ foreach ($restrictions as $restriction) {
+ $sniffs = array_merge($sniffs, $this->expandRulesetReference($restriction, dirname($standard)));
+ }
+ } catch (RuntimeException $e) {
+ // Sniff reference could not be expanded, which probably means this
+ // is an installed standard. Let the unit test system take care of
+ // setting the correct sniff for testing.
+ return;
+ }
+
+ break;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ echo "Registering sniffs in the $standardName standard... ";
+ if (count($config->standards) > 1 || PHP_CODESNIFFER_VERBOSITY > 2) {
+ echo PHP_EOL;
+ }
+ }
+
+ $sniffs = array_merge($sniffs, $this->processRuleset($standard));
+ }//end foreach
+
+ // Ignore sniff restrictions if caching is on.
+ if ($config->cache === true) {
+ $restrictions = [];
+ $exclusions = [];
+ }
+
+ $sniffRestrictions = [];
+ foreach ($restrictions as $sniffCode) {
+ $parts = explode('.', strtolower($sniffCode));
+ $sniffName = $parts[0].'\sniffs\\'.$parts[1].'\\'.$parts[2].'sniff';
+ $sniffRestrictions[$sniffName] = true;
+ }
+
+ $sniffExclusions = [];
+ foreach ($exclusions as $sniffCode) {
+ $parts = explode('.', strtolower($sniffCode));
+ $sniffName = $parts[0].'\sniffs\\'.$parts[1].'\\'.$parts[2].'sniff';
+ $sniffExclusions[$sniffName] = true;
+ }
+
+ $this->registerSniffs($sniffs, $sniffRestrictions, $sniffExclusions);
+ $this->populateTokenListeners();
+
+ $numSniffs = count($this->sniffs);
+ if (PHP_CODESNIFFER_VERBOSITY === 1) {
+ echo "DONE ($numSniffs sniffs registered)".PHP_EOL;
+ }
+
+ if ($numSniffs === 0) {
+ throw new RuntimeException('No sniffs were registered');
+ }
+
+ }//end __construct()
+
+
+ /**
+ * Prints a report showing the sniffs contained in a standard.
+ *
+ * @return void
+ */
+ public function explain()
+ {
+ $sniffs = array_keys($this->sniffCodes);
+ sort($sniffs);
+
+ ob_start();
+
+ $lastStandard = null;
+ $lastCount = '';
+ $sniffCount = count($sniffs);
+
+ // Add a dummy entry to the end so we loop
+ // one last time and clear the output buffer.
+ $sniffs[] = '';
+
+ echo PHP_EOL."The $this->name standard contains $sniffCount sniffs".PHP_EOL;
+
+ ob_start();
+
+ foreach ($sniffs as $i => $sniff) {
+ if ($i === $sniffCount) {
+ $currentStandard = null;
+ } else {
+ $currentStandard = substr($sniff, 0, strpos($sniff, '.'));
+ if ($lastStandard === null) {
+ $lastStandard = $currentStandard;
+ }
+ }
+
+ if ($currentStandard !== $lastStandard) {
+ $sniffList = ob_get_contents();
+ ob_end_clean();
+
+ echo PHP_EOL.$lastStandard.' ('.$lastCount.' sniff';
+ if ($lastCount > 1) {
+ echo 's';
+ }
+
+ echo ')'.PHP_EOL;
+ echo str_repeat('-', (strlen($lastStandard.$lastCount) + 10));
+ echo PHP_EOL;
+ echo $sniffList;
+
+ $lastStandard = $currentStandard;
+ $lastCount = 0;
+
+ if ($currentStandard === null) {
+ break;
+ }
+
+ ob_start();
+ }//end if
+
+ echo ' '.$sniff.PHP_EOL;
+ $lastCount++;
+ }//end foreach
+
+ }//end explain()
+
+
+ /**
+ * Processes a single ruleset and returns a list of the sniffs it represents.
+ *
+ * Rules founds within the ruleset are processed immediately, but sniff classes
+ * are not registered by this method.
+ *
+ * @param string $rulesetPath The path to a ruleset XML file.
+ * @param int $depth How many nested processing steps we are in. This
+ * is only used for debug output.
+ *
+ * @return string[]
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException - If the ruleset path is invalid.
+ * - If a specified autoload file could not be found.
+ */
+ public function processRuleset($rulesetPath, $depth=0)
+ {
+ $rulesetPath = Util\Common::realpath($rulesetPath);
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo 'Processing ruleset '.Util\Common::stripBasepath($rulesetPath, $this->config->basepath).PHP_EOL;
+ }
+
+ libxml_use_internal_errors(true);
+ $ruleset = simplexml_load_string(file_get_contents($rulesetPath));
+ if ($ruleset === false) {
+ $errorMsg = "Ruleset $rulesetPath is not valid".PHP_EOL;
+ $errors = libxml_get_errors();
+ foreach ($errors as $error) {
+ $errorMsg .= '- On line '.$error->line.', column '.$error->column.': '.$error->message;
+ }
+
+ libxml_clear_errors();
+ throw new RuntimeException($errorMsg);
+ }
+
+ libxml_use_internal_errors(false);
+
+ $ownSniffs = [];
+ $includedSniffs = [];
+ $excludedSniffs = [];
+
+ $this->paths[] = $rulesetPath;
+ $rulesetDir = dirname($rulesetPath);
+ $this->rulesetDirs[] = $rulesetDir;
+
+ $sniffDir = $rulesetDir.DIRECTORY_SEPARATOR.'Sniffs';
+ if (is_dir($sniffDir) === true) {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\tAdding sniff files from ".Util\Common::stripBasepath($sniffDir, $this->config->basepath).' directory'.PHP_EOL;
+ }
+
+ $ownSniffs = $this->expandSniffDirectory($sniffDir, $depth);
+ }
+
+ // Include custom autoloaders.
+ foreach ($ruleset->{'autoload'} as $autoload) {
+ if ($this->shouldProcessElement($autoload) === false) {
+ continue;
+ }
+
+ $autoloadPath = (string) $autoload;
+
+ // Try relative autoload paths first.
+ $relativePath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
+
+ if ($relativePath !== false && is_file($relativePath) === true) {
+ $autoloadPath = $relativePath;
+ } else if (is_file($autoloadPath) === false) {
+ throw new RuntimeException('The specified autoload file "'.$autoload.'" does not exist');
+ }
+
+ include_once $autoloadPath;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> included autoloader $autoloadPath".PHP_EOL;
+ }
+ }//end foreach
+
+ // Process custom sniff config settings.
+ foreach ($ruleset->{'config'} as $config) {
+ if ($this->shouldProcessElement($config) === false) {
+ continue;
+ }
+
+ Config::setConfigData((string) $config['name'], (string) $config['value'], true);
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> set config value ".(string) $config['name'].': '.(string) $config['value'].PHP_EOL;
+ }
+ }
+
+ foreach ($ruleset->rule as $rule) {
+ if (isset($rule['ref']) === false
+ || $this->shouldProcessElement($rule) === false
+ ) {
+ continue;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\tProcessing rule \"".$rule['ref'].'"'.PHP_EOL;
+ }
+
+ $expandedSniffs = $this->expandRulesetReference((string) $rule['ref'], $rulesetDir, $depth);
+ $newSniffs = array_diff($expandedSniffs, $includedSniffs);
+ $includedSniffs = array_merge($includedSniffs, $expandedSniffs);
+
+ $parts = explode('.', $rule['ref']);
+ if (count($parts) === 4
+ && $parts[0] !== ''
+ && $parts[1] !== ''
+ && $parts[2] !== ''
+ ) {
+ $sniffCode = $parts[0].'.'.$parts[1].'.'.$parts[2];
+ if (isset($this->ruleset[$sniffCode]['severity']) === true
+ && $this->ruleset[$sniffCode]['severity'] === 0
+ ) {
+ // This sniff code has already been turned off, but now
+ // it is being explicitly included again, so turn it back on.
+ $this->ruleset[(string) $rule['ref']]['severity'] = 5;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* disabling sniff exclusion for specific message code *".PHP_EOL;
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> severity set to 5".PHP_EOL;
+ }
+ } else if (empty($newSniffs) === false) {
+ $newSniff = $newSniffs[0];
+ if (in_array($newSniff, $ownSniffs, true) === false) {
+ // Including a sniff that hasn't been included higher up, but
+ // only including a single message from it. So turn off all messages in
+ // the sniff, except this one.
+ $this->ruleset[$sniffCode]['severity'] = 0;
+ $this->ruleset[(string) $rule['ref']]['severity'] = 5;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\tExcluding sniff \"".$sniffCode.'" except for "'.$parts[3].'"'.PHP_EOL;
+ }
+ }
+ }//end if
+ }//end if
+
+ if (isset($rule->exclude) === true) {
+ foreach ($rule->exclude as $exclude) {
+ if (isset($exclude['name']) === false) {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* ignoring empty exclude rule *".PHP_EOL;
+ echo "\t\t\t=> ".$exclude->asXML().PHP_EOL;
+ }
+
+ continue;
+ }
+
+ if ($this->shouldProcessElement($exclude) === false) {
+ continue;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\tExcluding rule \"".$exclude['name'].'"'.PHP_EOL;
+ }
+
+ // Check if a single code is being excluded, which is a shortcut
+ // for setting the severity of the message to 0.
+ $parts = explode('.', $exclude['name']);
+ if (count($parts) === 4) {
+ $this->ruleset[(string) $exclude['name']]['severity'] = 0;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> severity set to 0".PHP_EOL;
+ }
+ } else {
+ $excludedSniffs = array_merge(
+ $excludedSniffs,
+ $this->expandRulesetReference((string) $exclude['name'], $rulesetDir, ($depth + 1))
+ );
+ }
+ }//end foreach
+ }//end if
+
+ $this->processRule($rule, $newSniffs, $depth);
+ }//end foreach
+
+ // Process custom command line arguments.
+ $cliArgs = [];
+ foreach ($ruleset->{'arg'} as $arg) {
+ if ($this->shouldProcessElement($arg) === false) {
+ continue;
+ }
+
+ if (isset($arg['name']) === true) {
+ $argString = '--'.(string) $arg['name'];
+ if (isset($arg['value']) === true) {
+ $argString .= '='.(string) $arg['value'];
+ }
+ } else {
+ $argString = '-'.(string) $arg['value'];
+ }
+
+ $cliArgs[] = $argString;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> set command line value $argString".PHP_EOL;
+ }
+ }//end foreach
+
+ // Set custom php ini values as CLI args.
+ foreach ($ruleset->{'ini'} as $arg) {
+ if ($this->shouldProcessElement($arg) === false) {
+ continue;
+ }
+
+ if (isset($arg['name']) === false) {
+ continue;
+ }
+
+ $name = (string) $arg['name'];
+ $argString = $name;
+ if (isset($arg['value']) === true) {
+ $value = (string) $arg['value'];
+ $argString .= "=$value";
+ } else {
+ $value = 'true';
+ }
+
+ $cliArgs[] = '-d';
+ $cliArgs[] = $argString;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> set PHP ini value $name to $value".PHP_EOL;
+ }
+ }//end foreach
+
+ if (empty($this->config->files) === true) {
+ // Process hard-coded file paths.
+ foreach ($ruleset->{'file'} as $file) {
+ $file = (string) $file;
+ $cliArgs[] = $file;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> added \"$file\" to the file list".PHP_EOL;
+ }
+ }
+ }
+
+ if (empty($cliArgs) === false) {
+ // Change the directory so all relative paths are worked
+ // out based on the location of the ruleset instead of
+ // the location of the user.
+ $inPhar = Util\Common::isPharFile($rulesetDir);
+ if ($inPhar === false) {
+ $currentDir = getcwd();
+ chdir($rulesetDir);
+ }
+
+ $this->config->setCommandLineValues($cliArgs);
+
+ if ($inPhar === false) {
+ chdir($currentDir);
+ }
+ }
+
+ // Process custom ignore pattern rules.
+ foreach ($ruleset->{'exclude-pattern'} as $pattern) {
+ if ($this->shouldProcessElement($pattern) === false) {
+ continue;
+ }
+
+ if (isset($pattern['type']) === false) {
+ $pattern['type'] = 'absolute';
+ }
+
+ $this->ignorePatterns[(string) $pattern] = (string) $pattern['type'];
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t=> added global ".(string) $pattern['type'].' ignore pattern: '.(string) $pattern.PHP_EOL;
+ }
+ }
+
+ $includedSniffs = array_unique(array_merge($ownSniffs, $includedSniffs));
+ $excludedSniffs = array_unique($excludedSniffs);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $included = count($includedSniffs);
+ $excluded = count($excludedSniffs);
+ echo str_repeat("\t", $depth);
+ echo "=> Ruleset processing complete; included $included sniffs and excluded $excluded".PHP_EOL;
+ }
+
+ // Merge our own sniff list with our externally included
+ // sniff list, but filter out any excluded sniffs.
+ $files = [];
+ foreach ($includedSniffs as $sniff) {
+ if (in_array($sniff, $excludedSniffs, true) === true) {
+ continue;
+ } else {
+ $files[] = Util\Common::realpath($sniff);
+ }
+ }
+
+ return $files;
+
+ }//end processRuleset()
+
+
+ /**
+ * Expands a directory into a list of sniff files within.
+ *
+ * @param string $directory The path to a directory.
+ * @param int $depth How many nested processing steps we are in. This
+ * is only used for debug output.
+ *
+ * @return array
+ */
+ private function expandSniffDirectory($directory, $depth=0)
+ {
+ $sniffs = [];
+
+ $rdi = new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
+ $di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+ $dirLen = strlen($directory);
+
+ foreach ($di as $file) {
+ $filename = $file->getFilename();
+
+ // Skip hidden files.
+ if (substr($filename, 0, 1) === '.') {
+ continue;
+ }
+
+ // We are only interested in PHP and sniff files.
+ $fileParts = explode('.', $filename);
+ if (array_pop($fileParts) !== 'php') {
+ continue;
+ }
+
+ $basename = basename($filename, '.php');
+ if (substr($basename, -5) !== 'Sniff') {
+ continue;
+ }
+
+ $path = $file->getPathname();
+
+ // Skip files in hidden directories within the Sniffs directory of this
+ // standard. We use the offset with strpos() to allow hidden directories
+ // before, valid example:
+ // /home/foo/.composer/vendor/squiz/custom_tool/MyStandard/Sniffs/...
+ if (strpos($path, DIRECTORY_SEPARATOR.'.', $dirLen) !== false) {
+ continue;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> ".Util\Common::stripBasepath($path, $this->config->basepath).PHP_EOL;
+ }
+
+ $sniffs[] = $path;
+ }//end foreach
+
+ return $sniffs;
+
+ }//end expandSniffDirectory()
+
+
+ /**
+ * Expands a ruleset reference into a list of sniff files.
+ *
+ * @param string $ref The reference from the ruleset XML file.
+ * @param string $rulesetDir The directory of the ruleset XML file, used to
+ * evaluate relative paths.
+ * @param int $depth How many nested processing steps we are in. This
+ * is only used for debug output.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the reference is invalid.
+ */
+ private function expandRulesetReference($ref, $rulesetDir, $depth=0)
+ {
+ // Ignore internal sniffs codes as they are used to only
+ // hide and change internal messages.
+ if (substr($ref, 0, 9) === 'Internal.') {
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* ignoring internal sniff code *".PHP_EOL;
+ }
+
+ return [];
+ }
+
+ // As sniffs can't begin with a full stop, assume references in
+ // this format are relative paths and attempt to convert them
+ // to absolute paths. If this fails, let the reference run through
+ // the normal checks and have it fail as normal.
+ if (substr($ref, 0, 1) === '.') {
+ $realpath = Util\Common::realpath($rulesetDir.'/'.$ref);
+ if ($realpath !== false) {
+ $ref = $realpath;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
+ }
+ }
+ }
+
+ // As sniffs can't begin with a tilde, assume references in
+ // this format are relative to the user's home directory.
+ if (substr($ref, 0, 2) === '~/') {
+ $realpath = Util\Common::realpath($ref);
+ if ($realpath !== false) {
+ $ref = $realpath;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
+ }
+ }
+ }
+
+ if (is_file($ref) === true) {
+ if (substr($ref, -9) === 'Sniff.php') {
+ // A single external sniff.
+ $this->rulesetDirs[] = dirname(dirname(dirname($ref)));
+ return [$ref];
+ }
+ } else {
+ // See if this is a whole standard being referenced.
+ $path = Util\Standards::getInstalledStandardPath($ref);
+ if ($path !== null && Util\Common::isPharFile($path) === true && strpos($path, 'ruleset.xml') === false) {
+ // If the ruleset exists inside the phar file, use it.
+ if (file_exists($path.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
+ $path .= DIRECTORY_SEPARATOR.'ruleset.xml';
+ } else {
+ $path = null;
+ }
+ }
+
+ if ($path !== null) {
+ $ref = $path;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
+ }
+ } else if (is_dir($ref) === false) {
+ // Work out the sniff path.
+ $sepPos = strpos($ref, DIRECTORY_SEPARATOR);
+ if ($sepPos !== false) {
+ $stdName = substr($ref, 0, $sepPos);
+ $path = substr($ref, $sepPos);
+ } else {
+ $parts = explode('.', $ref);
+ $stdName = $parts[0];
+ if (count($parts) === 1) {
+ // A whole standard?
+ $path = '';
+ } else if (count($parts) === 2) {
+ // A directory of sniffs?
+ $path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1];
+ } else {
+ // A single sniff?
+ $path = DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR.$parts[1].DIRECTORY_SEPARATOR.$parts[2].'Sniff.php';
+ }
+ }
+
+ $newRef = false;
+ $stdPath = Util\Standards::getInstalledStandardPath($stdName);
+ if ($stdPath !== null && $path !== '') {
+ if (Util\Common::isPharFile($stdPath) === true
+ && strpos($stdPath, 'ruleset.xml') === false
+ ) {
+ // Phar files can only return the directory,
+ // since ruleset can be omitted if building one standard.
+ $newRef = Util\Common::realpath($stdPath.$path);
+ } else {
+ $newRef = Util\Common::realpath(dirname($stdPath).$path);
+ }
+ }
+
+ if ($newRef === false) {
+ // The sniff is not locally installed, so check if it is being
+ // referenced as a remote sniff outside the install. We do this
+ // by looking through all directories where we have found ruleset
+ // files before, looking for ones for this particular standard,
+ // and seeing if it is in there.
+ foreach ($this->rulesetDirs as $dir) {
+ if (strtolower(basename($dir)) !== strtolower($stdName)) {
+ continue;
+ }
+
+ $newRef = Util\Common::realpath($dir.$path);
+
+ if ($newRef !== false) {
+ $ref = $newRef;
+ }
+ }
+ } else {
+ $ref = $newRef;
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> ".Util\Common::stripBasepath($ref, $this->config->basepath).PHP_EOL;
+ }
+ }//end if
+ }//end if
+
+ if (is_dir($ref) === true) {
+ if (is_file($ref.DIRECTORY_SEPARATOR.'ruleset.xml') === true) {
+ // We are referencing an external coding standard.
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* rule is referencing a standard using directory name; processing *".PHP_EOL;
+ }
+
+ return $this->processRuleset($ref.DIRECTORY_SEPARATOR.'ruleset.xml', ($depth + 2));
+ } else {
+ // We are referencing a whole directory of sniffs.
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* rule is referencing a directory of sniffs *".PHP_EOL;
+ echo str_repeat("\t", $depth);
+ echo "\t\tAdding sniff files from directory".PHP_EOL;
+ }
+
+ return $this->expandSniffDirectory($ref, ($depth + 1));
+ }
+ } else {
+ if (is_file($ref) === false) {
+ $error = "Referenced sniff \"$ref\" does not exist";
+ throw new RuntimeException($error);
+ }
+
+ if (substr($ref, -9) === 'Sniff.php') {
+ // A single sniff.
+ return [$ref];
+ } else {
+ // Assume an external ruleset.xml file.
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t* rule is referencing a standard using ruleset path; processing *".PHP_EOL;
+ }
+
+ return $this->processRuleset($ref, ($depth + 2));
+ }
+ }//end if
+
+ }//end expandRulesetReference()
+
+
+ /**
+ * Processes a rule from a ruleset XML file, overriding built-in defaults.
+ *
+ * @param \SimpleXMLElement $rule The rule object from a ruleset XML file.
+ * @param string[] $newSniffs An array of sniffs that got included by this rule.
+ * @param int $depth How many nested processing steps we are in.
+ * This is only used for debug output.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If rule settings are invalid.
+ */
+ private function processRule($rule, $newSniffs, $depth=0)
+ {
+ $ref = (string) $rule['ref'];
+ $todo = [$ref];
+
+ $parts = explode('.', $ref);
+ $partsCount = count($parts);
+ if ($partsCount <= 2
+ || $partsCount > count(array_filter($parts))
+ || in_array($ref, $newSniffs) === true
+ ) {
+ // We are processing a standard, a category of sniffs or a relative path inclusion.
+ foreach ($newSniffs as $sniffFile) {
+ $parts = explode(DIRECTORY_SEPARATOR, $sniffFile);
+ if (count($parts) === 1 && DIRECTORY_SEPARATOR === '\\') {
+ // Path using forward slashes while running on Windows.
+ $parts = explode('/', $sniffFile);
+ }
+
+ $sniffName = array_pop($parts);
+ $sniffCategory = array_pop($parts);
+ array_pop($parts);
+ $sniffStandard = array_pop($parts);
+ $todo[] = $sniffStandard.'.'.$sniffCategory.'.'.substr($sniffName, 0, -9);
+ }
+ }
+
+ foreach ($todo as $code) {
+ // Custom severity.
+ if (isset($rule->severity) === true
+ && $this->shouldProcessElement($rule->severity) === true
+ ) {
+ if (isset($this->ruleset[$code]) === false) {
+ $this->ruleset[$code] = [];
+ }
+
+ $this->ruleset[$code]['severity'] = (int) $rule->severity;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> severity set to ".(int) $rule->severity;
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo PHP_EOL;
+ }
+ }
+
+ // Custom message type.
+ if (isset($rule->type) === true
+ && $this->shouldProcessElement($rule->type) === true
+ ) {
+ if (isset($this->ruleset[$code]) === false) {
+ $this->ruleset[$code] = [];
+ }
+
+ $type = strtolower((string) $rule->type);
+ if ($type !== 'error' && $type !== 'warning') {
+ throw new RuntimeException("Message type \"$type\" is invalid; must be \"error\" or \"warning\"");
+ }
+
+ $this->ruleset[$code]['type'] = $type;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> message type set to ".(string) $rule->type;
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo PHP_EOL;
+ }
+ }//end if
+
+ // Custom message.
+ if (isset($rule->message) === true
+ && $this->shouldProcessElement($rule->message) === true
+ ) {
+ if (isset($this->ruleset[$code]) === false) {
+ $this->ruleset[$code] = [];
+ }
+
+ $this->ruleset[$code]['message'] = (string) $rule->message;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> message set to ".(string) $rule->message;
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo PHP_EOL;
+ }
+ }
+
+ // Custom properties.
+ if (isset($rule->properties) === true
+ && $this->shouldProcessElement($rule->properties) === true
+ ) {
+ foreach ($rule->properties->property as $prop) {
+ if ($this->shouldProcessElement($prop) === false) {
+ continue;
+ }
+
+ if (isset($this->ruleset[$code]) === false) {
+ $this->ruleset[$code] = [
+ 'properties' => [],
+ ];
+ } else if (isset($this->ruleset[$code]['properties']) === false) {
+ $this->ruleset[$code]['properties'] = [];
+ }
+
+ $name = (string) $prop['name'];
+ if (isset($prop['type']) === true
+ && (string) $prop['type'] === 'array'
+ ) {
+ $values = [];
+ if (isset($prop['extend']) === true
+ && (string) $prop['extend'] === 'true'
+ && isset($this->ruleset[$code]['properties'][$name]) === true
+ ) {
+ $values = $this->ruleset[$code]['properties'][$name];
+ }
+
+ if (isset($prop->element) === true) {
+ $printValue = '';
+ foreach ($prop->element as $element) {
+ if ($this->shouldProcessElement($element) === false) {
+ continue;
+ }
+
+ $value = (string) $element['value'];
+ if (isset($element['key']) === true) {
+ $key = (string) $element['key'];
+ $values[$key] = $value;
+ $printValue .= $key.'=>'.$value.',';
+ } else {
+ $values[] = $value;
+ $printValue .= $value.',';
+ }
+ }
+
+ $printValue = rtrim($printValue, ',');
+ } else {
+ $value = (string) $prop['value'];
+ $printValue = $value;
+ foreach (explode(',', $value) as $val) {
+ list($k, $v) = explode('=>', $val.'=>');
+ if ($v !== '') {
+ $values[trim($k)] = trim($v);
+ } else {
+ $values[] = trim($k);
+ }
+ }
+ }//end if
+
+ $this->ruleset[$code]['properties'][$name] = $values;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> array property \"$name\" set to \"$printValue\"";
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo PHP_EOL;
+ }
+ } else {
+ $this->ruleset[$code]['properties'][$name] = (string) $prop['value'];
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> property \"$name\" set to \"".(string) $prop['value'].'"';
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo PHP_EOL;
+ }
+ }//end if
+ }//end foreach
+ }//end if
+
+ // Ignore patterns.
+ foreach ($rule->{'exclude-pattern'} as $pattern) {
+ if ($this->shouldProcessElement($pattern) === false) {
+ continue;
+ }
+
+ if (isset($this->ignorePatterns[$code]) === false) {
+ $this->ignorePatterns[$code] = [];
+ }
+
+ if (isset($pattern['type']) === false) {
+ $pattern['type'] = 'absolute';
+ }
+
+ $this->ignorePatterns[$code][(string) $pattern] = (string) $pattern['type'];
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> added rule-specific ".(string) $pattern['type'].' ignore pattern';
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo ': '.(string) $pattern.PHP_EOL;
+ }
+ }//end foreach
+
+ // Include patterns.
+ foreach ($rule->{'include-pattern'} as $pattern) {
+ if ($this->shouldProcessElement($pattern) === false) {
+ continue;
+ }
+
+ if (isset($this->includePatterns[$code]) === false) {
+ $this->includePatterns[$code] = [];
+ }
+
+ if (isset($pattern['type']) === false) {
+ $pattern['type'] = 'absolute';
+ }
+
+ $this->includePatterns[$code][(string) $pattern] = (string) $pattern['type'];
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> added rule-specific ".(string) $pattern['type'].' include pattern';
+ if ($code !== $ref) {
+ echo " for $code";
+ }
+
+ echo ': '.(string) $pattern.PHP_EOL;
+ }
+ }//end foreach
+ }//end foreach
+
+ }//end processRule()
+
+
+ /**
+ * Determine if an element should be processed or ignored.
+ *
+ * @param \SimpleXMLElement $element An object from a ruleset XML file.
+ *
+ * @return bool
+ */
+ private function shouldProcessElement($element)
+ {
+ if (isset($element['phpcbf-only']) === false
+ && isset($element['phpcs-only']) === false
+ ) {
+ // No exceptions are being made.
+ return true;
+ }
+
+ if (PHP_CODESNIFFER_CBF === true
+ && isset($element['phpcbf-only']) === true
+ && (string) $element['phpcbf-only'] === 'true'
+ ) {
+ return true;
+ }
+
+ if (PHP_CODESNIFFER_CBF === false
+ && isset($element['phpcs-only']) === true
+ && (string) $element['phpcs-only'] === 'true'
+ ) {
+ return true;
+ }
+
+ return false;
+
+ }//end shouldProcessElement()
+
+
+ /**
+ * Loads and stores sniffs objects used for sniffing files.
+ *
+ * @param array $files Paths to the sniff files to register.
+ * @param array $restrictions The sniff class names to restrict the allowed
+ * listeners to.
+ * @param array $exclusions The sniff class names to exclude from the
+ * listeners list.
+ *
+ * @return void
+ */
+ public function registerSniffs($files, $restrictions, $exclusions)
+ {
+ $listeners = [];
+
+ foreach ($files as $file) {
+ // Work out where the position of /StandardName/Sniffs/... is
+ // so we can determine what the class will be called.
+ $sniffPos = strrpos($file, DIRECTORY_SEPARATOR.'Sniffs'.DIRECTORY_SEPARATOR);
+ if ($sniffPos === false) {
+ continue;
+ }
+
+ $slashPos = strrpos(substr($file, 0, $sniffPos), DIRECTORY_SEPARATOR);
+ if ($slashPos === false) {
+ continue;
+ }
+
+ $className = Autoload::loadFile($file);
+ $compareName = Util\Common::cleanSniffClass($className);
+
+ // If they have specified a list of sniffs to restrict to, check
+ // to see if this sniff is allowed.
+ if (empty($restrictions) === false
+ && isset($restrictions[$compareName]) === false
+ ) {
+ continue;
+ }
+
+ // If they have specified a list of sniffs to exclude, check
+ // to see if this sniff is allowed.
+ if (empty($exclusions) === false
+ && isset($exclusions[$compareName]) === true
+ ) {
+ continue;
+ }
+
+ // Skip abstract classes.
+ $reflection = new \ReflectionClass($className);
+ if ($reflection->isAbstract() === true) {
+ continue;
+ }
+
+ $listeners[$className] = $className;
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ echo "Registered $className".PHP_EOL;
+ }
+ }//end foreach
+
+ $this->sniffs = $listeners;
+
+ }//end registerSniffs()
+
+
+ /**
+ * Populates the array of PHP_CodeSniffer_Sniff objects for this file.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If sniff registration fails.
+ */
+ public function populateTokenListeners()
+ {
+ // Construct a list of listeners indexed by token being listened for.
+ $this->tokenListeners = [];
+
+ foreach ($this->sniffs as $sniffClass => $sniffObject) {
+ $this->sniffs[$sniffClass] = null;
+ $this->sniffs[$sniffClass] = new $sniffClass();
+
+ $sniffCode = Util\Common::getSniffCode($sniffClass);
+ $this->sniffCodes[$sniffCode] = $sniffClass;
+
+ // Set custom properties.
+ if (isset($this->ruleset[$sniffCode]['properties']) === true) {
+ foreach ($this->ruleset[$sniffCode]['properties'] as $name => $value) {
+ $this->setSniffProperty($sniffClass, $name, $value);
+ }
+ }
+
+ $tokenizers = [];
+ $vars = get_class_vars($sniffClass);
+ if (isset($vars['supportedTokenizers']) === true) {
+ foreach ($vars['supportedTokenizers'] as $tokenizer) {
+ $tokenizers[$tokenizer] = $tokenizer;
+ }
+ } else {
+ $tokenizers = ['PHP' => 'PHP'];
+ }
+
+ $tokens = $this->sniffs[$sniffClass]->register();
+ if (is_array($tokens) === false) {
+ $msg = "Sniff $sniffClass register() method must return an array";
+ throw new RuntimeException($msg);
+ }
+
+ $ignorePatterns = [];
+ $patterns = $this->getIgnorePatterns($sniffCode);
+ foreach ($patterns as $pattern => $type) {
+ $replacements = [
+ '\\,' => ',',
+ '*' => '.*',
+ ];
+
+ $ignorePatterns[] = strtr($pattern, $replacements);
+ }
+
+ $includePatterns = [];
+ $patterns = $this->getIncludePatterns($sniffCode);
+ foreach ($patterns as $pattern => $type) {
+ $replacements = [
+ '\\,' => ',',
+ '*' => '.*',
+ ];
+
+ $includePatterns[] = strtr($pattern, $replacements);
+ }
+
+ foreach ($tokens as $token) {
+ if (isset($this->tokenListeners[$token]) === false) {
+ $this->tokenListeners[$token] = [];
+ }
+
+ if (isset($this->tokenListeners[$token][$sniffClass]) === false) {
+ $this->tokenListeners[$token][$sniffClass] = [
+ 'class' => $sniffClass,
+ 'source' => $sniffCode,
+ 'tokenizers' => $tokenizers,
+ 'ignore' => $ignorePatterns,
+ 'include' => $includePatterns,
+ ];
+ }
+ }
+ }//end foreach
+
+ }//end populateTokenListeners()
+
+
+ /**
+ * Set a single property for a sniff.
+ *
+ * @param string $sniffClass The class name of the sniff.
+ * @param string $name The name of the property to change.
+ * @param string $value The new value of the property.
+ *
+ * @return void
+ */
+ public function setSniffProperty($sniffClass, $name, $value)
+ {
+ // Setting a property for a sniff we are not using.
+ if (isset($this->sniffs[$sniffClass]) === false) {
+ return;
+ }
+
+ $name = trim($name);
+ if (is_string($value) === true) {
+ $value = trim($value);
+ }
+
+ if ($value === '') {
+ $value = null;
+ }
+
+ // Special case for booleans.
+ if ($value === 'true') {
+ $value = true;
+ } else if ($value === 'false') {
+ $value = false;
+ } else if (substr($name, -2) === '[]') {
+ $name = substr($name, 0, -2);
+ $values = [];
+ if ($value !== null) {
+ foreach (explode(',', $value) as $val) {
+ list($k, $v) = explode('=>', $val.'=>');
+ if ($v !== '') {
+ $values[trim($k)] = trim($v);
+ } else {
+ $values[] = trim($k);
+ }
+ }
+ }
+
+ $value = $values;
+ }
+
+ $this->sniffs[$sniffClass]->$name = $value;
+
+ }//end setSniffProperty()
+
+
+ /**
+ * Gets the array of ignore patterns.
+ *
+ * Optionally takes a listener to get ignore patterns specified
+ * for that sniff only.
+ *
+ * @param string $listener The listener to get patterns for. If NULL, all
+ * patterns are returned.
+ *
+ * @return array
+ */
+ public function getIgnorePatterns($listener=null)
+ {
+ if ($listener === null) {
+ return $this->ignorePatterns;
+ }
+
+ if (isset($this->ignorePatterns[$listener]) === true) {
+ return $this->ignorePatterns[$listener];
+ }
+
+ return [];
+
+ }//end getIgnorePatterns()
+
+
+ /**
+ * Gets the array of include patterns.
+ *
+ * Optionally takes a listener to get include patterns specified
+ * for that sniff only.
+ *
+ * @param string $listener The listener to get patterns for. If NULL, all
+ * patterns are returned.
+ *
+ * @return array
+ */
+ public function getIncludePatterns($listener=null)
+ {
+ if ($listener === null) {
+ return $this->includePatterns;
+ }
+
+ if (isset($this->includePatterns[$listener]) === true) {
+ return $this->includePatterns[$listener];
+ }
+
+ return [];
+
+ }//end getIncludePatterns()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Runner.php b/vendor/squizlabs/php_codesniffer/src/Runner.php
new file mode 100644
index 00000000..fa68ff51
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Runner.php
@@ -0,0 +1,889 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer;
+
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Files\DummyFile;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Files\FileList;
+use PHP_CodeSniffer\Util\Cache;
+use PHP_CodeSniffer\Util\Common;
+use PHP_CodeSniffer\Util\Standards;
+
+class Runner
+{
+
+ /**
+ * The config data for the run.
+ *
+ * @var \PHP_CodeSniffer\Config
+ */
+ public $config = null;
+
+ /**
+ * The ruleset used for the run.
+ *
+ * @var \PHP_CodeSniffer\Ruleset
+ */
+ public $ruleset = null;
+
+ /**
+ * The reporter used for generating reports after the run.
+ *
+ * @var \PHP_CodeSniffer\Reporter
+ */
+ public $reporter = null;
+
+
+ /**
+ * Run the PHPCS script.
+ *
+ * @return array
+ */
+ public function runPHPCS()
+ {
+ try {
+ Util\Timing::startTiming();
+ Runner::checkRequirements();
+
+ if (defined('PHP_CODESNIFFER_CBF') === false) {
+ define('PHP_CODESNIFFER_CBF', false);
+ }
+
+ // Creating the Config object populates it with all required settings
+ // based on the CLI arguments provided to the script and any config
+ // values the user has set.
+ $this->config = new Config();
+
+ // Init the run and load the rulesets to set additional config vars.
+ $this->init();
+
+ // Print a list of sniffs in each of the supplied standards.
+ // We fudge the config here so that each standard is explained in isolation.
+ if ($this->config->explain === true) {
+ $standards = $this->config->standards;
+ foreach ($standards as $standard) {
+ $this->config->standards = [$standard];
+ $ruleset = new Ruleset($this->config);
+ $ruleset->explain();
+ }
+
+ return 0;
+ }
+
+ // Generate documentation for each of the supplied standards.
+ if ($this->config->generator !== null) {
+ $standards = $this->config->standards;
+ foreach ($standards as $standard) {
+ $this->config->standards = [$standard];
+ $ruleset = new Ruleset($this->config);
+ $class = 'PHP_CodeSniffer\Generators\\'.$this->config->generator;
+ $generator = new $class($ruleset);
+ $generator->generate();
+ }
+
+ return 0;
+ }
+
+ // Other report formats don't really make sense in interactive mode
+ // so we hard-code the full report here and when outputting.
+ // We also ensure parallel processing is off because we need to do one file at a time.
+ if ($this->config->interactive === true) {
+ $this->config->reports = ['full' => null];
+ $this->config->parallel = 1;
+ $this->config->showProgress = false;
+ }
+
+ // Disable caching if we are processing STDIN as we can't be 100%
+ // sure where the file came from or if it will change in the future.
+ if ($this->config->stdin === true) {
+ $this->config->cache = false;
+ }
+
+ $numErrors = $this->run();
+
+ // Print all the reports for this run.
+ $toScreen = $this->reporter->printReports();
+
+ // Only print timer output if no reports were
+ // printed to the screen so we don't put additional output
+ // in something like an XML report. If we are printing to screen,
+ // the report types would have already worked out who should
+ // print the timer info.
+ if ($this->config->interactive === false
+ && ($toScreen === false
+ || (($this->reporter->totalErrors + $this->reporter->totalWarnings) === 0 && $this->config->showProgress === true))
+ ) {
+ Util\Timing::printRunTime();
+ }
+ } catch (DeepExitException $e) {
+ echo $e->getMessage();
+ return $e->getCode();
+ }//end try
+
+ if ($numErrors === 0) {
+ // No errors found.
+ return 0;
+ } else if ($this->reporter->totalFixable === 0) {
+ // Errors found, but none of them can be fixed by PHPCBF.
+ return 1;
+ } else {
+ // Errors found, and some can be fixed by PHPCBF.
+ return 2;
+ }
+
+ }//end runPHPCS()
+
+
+ /**
+ * Run the PHPCBF script.
+ *
+ * @return array
+ */
+ public function runPHPCBF()
+ {
+ if (defined('PHP_CODESNIFFER_CBF') === false) {
+ define('PHP_CODESNIFFER_CBF', true);
+ }
+
+ try {
+ Util\Timing::startTiming();
+ Runner::checkRequirements();
+
+ // Creating the Config object populates it with all required settings
+ // based on the CLI arguments provided to the script and any config
+ // values the user has set.
+ $this->config = new Config();
+
+ // When processing STDIN, we can't output anything to the screen
+ // or it will end up mixed in with the file output.
+ if ($this->config->stdin === true) {
+ $this->config->verbosity = 0;
+ }
+
+ // Init the run and load the rulesets to set additional config vars.
+ $this->init();
+
+ // When processing STDIN, we only process one file at a time and
+ // we don't process all the way through, so we can't use the parallel
+ // running system.
+ if ($this->config->stdin === true) {
+ $this->config->parallel = 1;
+ }
+
+ // Override some of the command line settings that might break the fixes.
+ $this->config->generator = null;
+ $this->config->explain = false;
+ $this->config->interactive = false;
+ $this->config->cache = false;
+ $this->config->showSources = false;
+ $this->config->recordErrors = false;
+ $this->config->reportFile = null;
+ $this->config->reports = ['cbf' => null];
+
+ // If a standard tries to set command line arguments itself, some
+ // may be blocked because PHPCBF is running, so stop the script
+ // dying if any are found.
+ $this->config->dieOnUnknownArg = false;
+
+ $this->run();
+ $this->reporter->printReports();
+
+ echo PHP_EOL;
+ Util\Timing::printRunTime();
+ } catch (DeepExitException $e) {
+ echo $e->getMessage();
+ return $e->getCode();
+ }//end try
+
+ if ($this->reporter->totalFixed === 0) {
+ // Nothing was fixed by PHPCBF.
+ if ($this->reporter->totalFixable === 0) {
+ // Nothing found that could be fixed.
+ return 0;
+ } else {
+ // Something failed to fix.
+ return 2;
+ }
+ }
+
+ if ($this->reporter->totalFixable === 0) {
+ // PHPCBF fixed all fixable errors.
+ return 1;
+ }
+
+ // PHPCBF fixed some fixable errors, but others failed to fix.
+ return 2;
+
+ }//end runPHPCBF()
+
+
+ /**
+ * Exits if the minimum requirements of PHP_CodeSniffer are not met.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the requirements are not met.
+ */
+ public function checkRequirements()
+ {
+ // Check the PHP version.
+ if (PHP_VERSION_ID < 50400) {
+ $error = 'ERROR: PHP_CodeSniffer requires PHP version 5.4.0 or greater.'.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ $requiredExtensions = [
+ 'tokenizer',
+ 'xmlwriter',
+ 'SimpleXML',
+ ];
+ $missingExtensions = [];
+
+ foreach ($requiredExtensions as $extension) {
+ if (extension_loaded($extension) === false) {
+ $missingExtensions[] = $extension;
+ }
+ }
+
+ if (empty($missingExtensions) === false) {
+ $last = array_pop($requiredExtensions);
+ $required = implode(', ', $requiredExtensions);
+ $required .= ' and '.$last;
+
+ if (count($missingExtensions) === 1) {
+ $missing = $missingExtensions[0];
+ } else {
+ $last = array_pop($missingExtensions);
+ $missing = implode(', ', $missingExtensions);
+ $missing .= ' and '.$last;
+ }
+
+ $error = 'ERROR: PHP_CodeSniffer requires the %s extensions to be enabled. Please enable %s.'.PHP_EOL;
+ $error = sprintf($error, $required, $missing);
+ throw new DeepExitException($error, 3);
+ }
+
+ }//end checkRequirements()
+
+
+ /**
+ * Init the rulesets and other high-level settings.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException If a referenced standard is not installed.
+ */
+ public function init()
+ {
+ if (defined('PHP_CODESNIFFER_CBF') === false) {
+ define('PHP_CODESNIFFER_CBF', false);
+ }
+
+ // Ensure this option is enabled or else line endings will not always
+ // be detected properly for files created on a Mac with the /r line ending.
+ @ini_set('auto_detect_line_endings', true);
+
+ // Disable the PCRE JIT as this caused issues with parallel running.
+ ini_set('pcre.jit', false);
+
+ // Check that the standards are valid.
+ foreach ($this->config->standards as $standard) {
+ if (Util\Standards::isInstalledStandard($standard) === false) {
+ // They didn't select a valid coding standard, so help them
+ // out by letting them know which standards are installed.
+ $error = 'ERROR: the "'.$standard.'" coding standard is not installed. ';
+ ob_start();
+ Util\Standards::printInstalledStandards();
+ $error .= ob_get_contents();
+ ob_end_clean();
+ throw new DeepExitException($error, 3);
+ }
+ }
+
+ // Saves passing the Config object into other objects that only need
+ // the verbosity flag for debug output.
+ if (defined('PHP_CODESNIFFER_VERBOSITY') === false) {
+ define('PHP_CODESNIFFER_VERBOSITY', $this->config->verbosity);
+ }
+
+ // Create this class so it is autoloaded and sets up a bunch
+ // of PHP_CodeSniffer-specific token type constants.
+ $tokens = new Util\Tokens();
+
+ // Allow autoloading of custom files inside installed standards.
+ $installedStandards = Standards::getInstalledStandardDetails();
+ foreach ($installedStandards as $name => $details) {
+ Autoload::addSearchPath($details['path'], $details['namespace']);
+ }
+
+ // The ruleset contains all the information about how the files
+ // should be checked and/or fixed.
+ try {
+ $this->ruleset = new Ruleset($this->config);
+ } catch (RuntimeException $e) {
+ $error = 'ERROR: '.$e->getMessage().PHP_EOL.PHP_EOL;
+ $error .= $this->config->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ }//end init()
+
+
+ /**
+ * Performs the run.
+ *
+ * @return int The number of errors and warnings found.
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException
+ */
+ private function run()
+ {
+ // The class that manages all reporters for the run.
+ $this->reporter = new Reporter($this->config);
+
+ // Include bootstrap files.
+ foreach ($this->config->bootstrap as $bootstrap) {
+ include $bootstrap;
+ }
+
+ if ($this->config->stdin === true) {
+ $fileContents = $this->config->stdinContent;
+ if ($fileContents === null) {
+ $handle = fopen('php://stdin', 'r');
+ stream_set_blocking($handle, true);
+ $fileContents = stream_get_contents($handle);
+ fclose($handle);
+ }
+
+ $todo = new FileList($this->config, $this->ruleset);
+ $dummy = new DummyFile($fileContents, $this->ruleset, $this->config);
+ $todo->addFile($dummy->path, $dummy);
+ } else {
+ if (empty($this->config->files) === true) {
+ $error = 'ERROR: You must supply at least one file or directory to process.'.PHP_EOL.PHP_EOL;
+ $error .= $this->config->printShortUsage(true);
+ throw new DeepExitException($error, 3);
+ }
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Creating file list... ';
+ }
+
+ $todo = new FileList($this->config, $this->ruleset);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ $numFiles = count($todo);
+ echo "DONE ($numFiles files in queue)".PHP_EOL;
+ }
+
+ if ($this->config->cache === true) {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Loading cache... ';
+ }
+
+ Cache::load($this->ruleset, $this->config);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ $size = Cache::getSize();
+ echo "DONE ($size files in cache)".PHP_EOL;
+ }
+ }
+ }//end if
+
+ // Turn all sniff errors into exceptions.
+ set_error_handler([$this, 'handleErrors']);
+
+ // If verbosity is too high, turn off parallelism so the
+ // debug output is clean.
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ $this->config->parallel = 1;
+ }
+
+ // If the PCNTL extension isn't installed, we can't fork.
+ if (function_exists('pcntl_fork') === false) {
+ $this->config->parallel = 1;
+ }
+
+ $lastDir = '';
+ $numFiles = count($todo);
+
+ if ($this->config->parallel === 1) {
+ // Running normally.
+ $numProcessed = 0;
+ foreach ($todo as $path => $file) {
+ if ($file->ignored === false) {
+ $currDir = dirname($path);
+ if ($lastDir !== $currDir) {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Changing into directory '.Common::stripBasepath($currDir, $this->config->basepath).PHP_EOL;
+ }
+
+ $lastDir = $currDir;
+ }
+
+ $this->processFile($file);
+ } else if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Skipping '.basename($file->path).PHP_EOL;
+ }
+
+ $numProcessed++;
+ $this->printProgress($file, $numFiles, $numProcessed);
+ }
+ } else {
+ // Batching and forking.
+ $childProcs = [];
+ $numPerBatch = ceil($numFiles / $this->config->parallel);
+
+ for ($batch = 0; $batch < $this->config->parallel; $batch++) {
+ $startAt = ($batch * $numPerBatch);
+ if ($startAt >= $numFiles) {
+ break;
+ }
+
+ $endAt = ($startAt + $numPerBatch);
+ if ($endAt > $numFiles) {
+ $endAt = $numFiles;
+ }
+
+ $childOutFilename = tempnam(sys_get_temp_dir(), 'phpcs-child');
+ $pid = pcntl_fork();
+ if ($pid === -1) {
+ throw new RuntimeException('Failed to create child process');
+ } else if ($pid !== 0) {
+ $childProcs[$pid] = $childOutFilename;
+ } else {
+ // Move forward to the start of the batch.
+ $todo->rewind();
+ for ($i = 0; $i < $startAt; $i++) {
+ $todo->next();
+ }
+
+ // Reset the reporter to make sure only figures from this
+ // file batch are recorded.
+ $this->reporter->totalFiles = 0;
+ $this->reporter->totalErrors = 0;
+ $this->reporter->totalWarnings = 0;
+ $this->reporter->totalFixable = 0;
+ $this->reporter->totalFixed = 0;
+
+ // Process the files.
+ $pathsProcessed = [];
+ ob_start();
+ for ($i = $startAt; $i < $endAt; $i++) {
+ $path = $todo->key();
+ $file = $todo->current();
+
+ if ($file->ignored === true) {
+ $todo->next();
+ continue;
+ }
+
+ $currDir = dirname($path);
+ if ($lastDir !== $currDir) {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Changing into directory '.Common::stripBasepath($currDir, $this->config->basepath).PHP_EOL;
+ }
+
+ $lastDir = $currDir;
+ }
+
+ $this->processFile($file);
+
+ $pathsProcessed[] = $path;
+ $todo->next();
+ }//end for
+
+ $debugOutput = ob_get_contents();
+ ob_end_clean();
+
+ // Write information about the run to the filesystem
+ // so it can be picked up by the main process.
+ $childOutput = [
+ 'totalFiles' => $this->reporter->totalFiles,
+ 'totalErrors' => $this->reporter->totalErrors,
+ 'totalWarnings' => $this->reporter->totalWarnings,
+ 'totalFixable' => $this->reporter->totalFixable,
+ 'totalFixed' => $this->reporter->totalFixed,
+ ];
+
+ $output = '<'.'?php'."\n".' $childOutput = ';
+ $output .= var_export($childOutput, true);
+ $output .= ";\n\$debugOutput = ";
+ $output .= var_export($debugOutput, true);
+
+ if ($this->config->cache === true) {
+ $childCache = [];
+ foreach ($pathsProcessed as $path) {
+ $childCache[$path] = Cache::get($path);
+ }
+
+ $output .= ";\n\$childCache = ";
+ $output .= var_export($childCache, true);
+ }
+
+ $output .= ";\n?".'>';
+ file_put_contents($childOutFilename, $output);
+ exit();
+ }//end if
+ }//end for
+
+ $success = $this->processChildProcs($childProcs);
+ if ($success === false) {
+ throw new RuntimeException('One or more child processes failed to run');
+ }
+ }//end if
+
+ restore_error_handler();
+
+ if (PHP_CODESNIFFER_VERBOSITY === 0
+ && $this->config->interactive === false
+ && $this->config->showProgress === true
+ ) {
+ echo PHP_EOL.PHP_EOL;
+ }
+
+ if ($this->config->cache === true) {
+ Cache::save();
+ }
+
+ $ignoreWarnings = Config::getConfigData('ignore_warnings_on_exit');
+ $ignoreErrors = Config::getConfigData('ignore_errors_on_exit');
+
+ $return = ($this->reporter->totalErrors + $this->reporter->totalWarnings);
+ if ($ignoreErrors !== null) {
+ $ignoreErrors = (bool) $ignoreErrors;
+ if ($ignoreErrors === true) {
+ $return -= $this->reporter->totalErrors;
+ }
+ }
+
+ if ($ignoreWarnings !== null) {
+ $ignoreWarnings = (bool) $ignoreWarnings;
+ if ($ignoreWarnings === true) {
+ $return -= $this->reporter->totalWarnings;
+ }
+ }
+
+ return $return;
+
+ }//end run()
+
+
+ /**
+ * Converts all PHP errors into exceptions.
+ *
+ * This method forces a sniff to stop processing if it is not
+ * able to handle a specific piece of code, instead of continuing
+ * and potentially getting into a loop.
+ *
+ * @param int $code The level of error raised.
+ * @param string $message The error message.
+ * @param string $file The path of the file that raised the error.
+ * @param int $line The line number the error was raised at.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException
+ */
+ public function handleErrors($code, $message, $file, $line)
+ {
+ if ((error_reporting() & $code) === 0) {
+ // This type of error is being muted.
+ return true;
+ }
+
+ throw new RuntimeException("$message in $file on line $line");
+
+ }//end handleErrors()
+
+
+ /**
+ * Processes a single file, including checking and fixing.
+ *
+ * @param \PHP_CodeSniffer\Files\File $file The file to be processed.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\DeepExitException
+ */
+ public function processFile($file)
+ {
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ $startTime = microtime(true);
+ echo 'Processing '.basename($file->path).' ';
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo PHP_EOL;
+ }
+ }
+
+ try {
+ $file->process();
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ $timeTaken = ((microtime(true) - $startTime) * 1000);
+ if ($timeTaken < 1000) {
+ $timeTaken = round($timeTaken);
+ echo "DONE in {$timeTaken}ms";
+ } else {
+ $timeTaken = round(($timeTaken / 1000), 2);
+ echo "DONE in $timeTaken secs";
+ }
+
+ if (PHP_CODESNIFFER_CBF === true) {
+ $errors = $file->getFixableCount();
+ echo " ($errors fixable violations)".PHP_EOL;
+ } else {
+ $errors = $file->getErrorCount();
+ $warnings = $file->getWarningCount();
+ echo " ($errors errors, $warnings warnings)".PHP_EOL;
+ }
+ }
+ } catch (\Exception $e) {
+ $error = 'An error occurred during processing; checking has been aborted. The error message was: '.$e->getMessage();
+ $file->addErrorOnLine($error, 1, 'Internal.Exception');
+ }//end try
+
+ $this->reporter->cacheFileReport($file, $this->config);
+
+ if ($this->config->interactive === true) {
+ /*
+ Running interactively.
+ Print the error report for the current file and then wait for user input.
+ */
+
+ // Get current violations and then clear the list to make sure
+ // we only print violations for a single file each time.
+ $numErrors = null;
+ while ($numErrors !== 0) {
+ $numErrors = ($file->getErrorCount() + $file->getWarningCount());
+ if ($numErrors === 0) {
+ continue;
+ }
+
+ $this->reporter->printReport('full');
+
+ echo ' to recheck, [s] to skip or [q] to quit : ';
+ $input = fgets(STDIN);
+ $input = trim($input);
+
+ switch ($input) {
+ case 's':
+ break(2);
+ case 'q':
+ throw new DeepExitException('', 0);
+ default:
+ // Repopulate the sniffs because some of them save their state
+ // and only clear it when the file changes, but we are rechecking
+ // the same file.
+ $file->ruleset->populateTokenListeners();
+ $file->reloadContent();
+ $file->process();
+ $this->reporter->cacheFileReport($file, $this->config);
+ break;
+ }
+ }//end while
+ }//end if
+
+ // Clean up the file to save (a lot of) memory.
+ $file->cleanUp();
+
+ }//end processFile()
+
+
+ /**
+ * Waits for child processes to complete and cleans up after them.
+ *
+ * The reporting information returned by each child process is merged
+ * into the main reporter class.
+ *
+ * @param array $childProcs An array of child processes to wait for.
+ *
+ * @return bool
+ */
+ private function processChildProcs($childProcs)
+ {
+ $numProcessed = 0;
+ $totalBatches = count($childProcs);
+
+ $success = true;
+
+ while (count($childProcs) > 0) {
+ $pid = pcntl_waitpid(0, $status);
+ if ($pid <= 0) {
+ continue;
+ }
+
+ $out = $childProcs[$pid];
+ unset($childProcs[$pid]);
+ if (file_exists($out) === false) {
+ continue;
+ }
+
+ include $out;
+ unlink($out);
+
+ $numProcessed++;
+
+ if (isset($childOutput) === false) {
+ // The child process died, so the run has failed.
+ $file = new DummyFile('', $this->ruleset, $this->config);
+ $file->setErrorCounts(1, 0, 0, 0);
+ $this->printProgress($file, $totalBatches, $numProcessed);
+ $success = false;
+ continue;
+ }
+
+ $this->reporter->totalFiles += $childOutput['totalFiles'];
+ $this->reporter->totalErrors += $childOutput['totalErrors'];
+ $this->reporter->totalWarnings += $childOutput['totalWarnings'];
+ $this->reporter->totalFixable += $childOutput['totalFixable'];
+ $this->reporter->totalFixed += $childOutput['totalFixed'];
+
+ if (isset($debugOutput) === true) {
+ echo $debugOutput;
+ }
+
+ if (isset($childCache) === true) {
+ foreach ($childCache as $path => $cache) {
+ Cache::set($path, $cache);
+ }
+ }
+
+ // Fake a processed file so we can print progress output for the batch.
+ $file = new DummyFile('', $this->ruleset, $this->config);
+ $file->setErrorCounts(
+ $childOutput['totalErrors'],
+ $childOutput['totalWarnings'],
+ $childOutput['totalFixable'],
+ $childOutput['totalFixed']
+ );
+ $this->printProgress($file, $totalBatches, $numProcessed);
+ }//end while
+
+ return $success;
+
+ }//end processChildProcs()
+
+
+ /**
+ * Print progress information for a single processed file.
+ *
+ * @param \PHP_CodeSniffer\Files\File $file The file that was processed.
+ * @param int $numFiles The total number of files to process.
+ * @param int $numProcessed The number of files that have been processed,
+ * including this one.
+ *
+ * @return void
+ */
+ public function printProgress(File $file, $numFiles, $numProcessed)
+ {
+ if (PHP_CODESNIFFER_VERBOSITY > 0
+ || $this->config->showProgress === false
+ ) {
+ return;
+ }
+
+ // Show progress information.
+ if ($file->ignored === true) {
+ echo 'S';
+ } else {
+ $errors = $file->getErrorCount();
+ $warnings = $file->getWarningCount();
+ $fixable = $file->getFixableCount();
+ $fixed = $file->getFixedCount();
+
+ if (PHP_CODESNIFFER_CBF === true) {
+ // Files with fixed errors or warnings are F (green).
+ // Files with unfixable errors or warnings are E (red).
+ // Files with no errors or warnings are . (black).
+ if ($fixable > 0) {
+ if ($this->config->colors === true) {
+ echo "\033[31m";
+ }
+
+ echo 'E';
+
+ if ($this->config->colors === true) {
+ echo "\033[0m";
+ }
+ } else if ($fixed > 0) {
+ if ($this->config->colors === true) {
+ echo "\033[32m";
+ }
+
+ echo 'F';
+
+ if ($this->config->colors === true) {
+ echo "\033[0m";
+ }
+ } else {
+ echo '.';
+ }//end if
+ } else {
+ // Files with errors are E (red).
+ // Files with fixable errors are E (green).
+ // Files with warnings are W (yellow).
+ // Files with fixable warnings are W (green).
+ // Files with no errors or warnings are . (black).
+ if ($errors > 0) {
+ if ($this->config->colors === true) {
+ if ($fixable > 0) {
+ echo "\033[32m";
+ } else {
+ echo "\033[31m";
+ }
+ }
+
+ echo 'E';
+
+ if ($this->config->colors === true) {
+ echo "\033[0m";
+ }
+ } else if ($warnings > 0) {
+ if ($this->config->colors === true) {
+ if ($fixable > 0) {
+ echo "\033[32m";
+ } else {
+ echo "\033[33m";
+ }
+ }
+
+ echo 'W';
+
+ if ($this->config->colors === true) {
+ echo "\033[0m";
+ }
+ } else {
+ echo '.';
+ }//end if
+ }//end if
+ }//end if
+
+ $numPerLine = 60;
+ if ($numProcessed !== $numFiles && ($numProcessed % $numPerLine) !== 0) {
+ return;
+ }
+
+ $percent = round(($numProcessed / $numFiles) * 100);
+ $padding = (strlen($numFiles) - strlen($numProcessed));
+ if ($numProcessed === $numFiles
+ && $numFiles > $numPerLine
+ && ($numProcessed % $numPerLine) !== 0
+ ) {
+ $padding += ($numPerLine - ($numFiles - (floor($numFiles / $numPerLine) * $numPerLine)));
+ }
+
+ echo str_repeat(' ', $padding)." $numProcessed / $numFiles ($percent%)".PHP_EOL;
+
+ }//end printProgress()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractArraySniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractArraySniff.php
new file mode 100644
index 00000000..141b9a13
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractArraySniff.php
@@ -0,0 +1,172 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Sniffs;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+abstract class AbstractArraySniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ final public function register()
+ {
+ return [
+ T_ARRAY,
+ T_OPEN_SHORT_ARRAY,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if ($tokens[$stackPtr]['code'] === T_ARRAY) {
+ $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'no');
+
+ $arrayStart = $tokens[$stackPtr]['parenthesis_opener'];
+ if (isset($tokens[$arrayStart]['parenthesis_closer']) === false) {
+ // Incomplete array.
+ return;
+ }
+
+ $arrayEnd = $tokens[$arrayStart]['parenthesis_closer'];
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'yes');
+ $arrayStart = $stackPtr;
+ $arrayEnd = $tokens[$stackPtr]['bracket_closer'];
+ }
+
+ $lastContent = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($arrayEnd - 1), null, true);
+ if ($tokens[$lastContent]['code'] === T_COMMA) {
+ // Last array item ends with a comma.
+ $phpcsFile->recordMetric($stackPtr, 'Array end comma', 'yes');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Array end comma', 'no');
+ }
+
+ $indices = [];
+
+ $current = $arrayStart;
+ while (($next = $phpcsFile->findNext(Tokens::$emptyTokens, ($current + 1), $arrayEnd, true)) !== false) {
+ $end = $this->getNext($phpcsFile, $next, $arrayEnd);
+
+ if ($tokens[$end]['code'] === T_DOUBLE_ARROW) {
+ $indexEnd = $phpcsFile->findPrevious(T_WHITESPACE, ($end - 1), null, true);
+ $valueStart = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true);
+
+ $indices[] = [
+ 'index_start' => $next,
+ 'index_end' => $indexEnd,
+ 'arrow' => $end,
+ 'value_start' => $valueStart,
+ ];
+ } else {
+ $valueStart = $next;
+ $indices[] = ['value_start' => $valueStart];
+ }
+
+ $current = $this->getNext($phpcsFile, $valueStart, $arrayEnd);
+ }
+
+ if ($tokens[$arrayStart]['line'] === $tokens[$arrayEnd]['line']) {
+ $this->processSingleLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices);
+ } else {
+ $this->processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices);
+ }
+
+ }//end process()
+
+
+ /**
+ * Find next separator in array - either: comma or double arrow.
+ *
+ * @param File $phpcsFile The current file being checked.
+ * @param int $ptr The position of current token.
+ * @param int $arrayEnd The token that ends the array definition.
+ *
+ * @return int
+ */
+ private function getNext(File $phpcsFile, $ptr, $arrayEnd)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ while ($ptr < $arrayEnd) {
+ if (isset($tokens[$ptr]['scope_closer']) === true) {
+ $ptr = $tokens[$ptr]['scope_closer'];
+ } else if (isset($tokens[$ptr]['parenthesis_closer']) === true) {
+ $ptr = $tokens[$ptr]['parenthesis_closer'];
+ } else if (isset($tokens[$ptr]['bracket_closer']) === true) {
+ $ptr = $tokens[$ptr]['bracket_closer'];
+ }
+
+ if ($tokens[$ptr]['code'] === T_COMMA
+ || $tokens[$ptr]['code'] === T_DOUBLE_ARROW
+ ) {
+ return $ptr;
+ }
+
+ ++$ptr;
+ }
+
+ return $ptr;
+
+ }//end getNext()
+
+
+ /**
+ * Processes a single-line array definition.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $arrayStart The token that starts the array definition.
+ * @param int $arrayEnd The token that ends the array definition.
+ * @param array $indices An array of token positions for the array keys,
+ * double arrows, and values.
+ *
+ * @return void
+ */
+ abstract protected function processSingleLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices);
+
+
+ /**
+ * Processes a multi-line array definition.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $arrayStart The token that starts the array definition.
+ * @param int $arrayEnd The token that ends the array definition.
+ * @param array $indices An array of token positions for the array keys,
+ * double arrows, and values.
+ *
+ * @return void
+ */
+ abstract protected function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices);
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
new file mode 100644
index 00000000..66bc2f52
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
@@ -0,0 +1,936 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Sniffs;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+use PHP_CodeSniffer\Tokenizers\PHP;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+
+abstract class AbstractPatternSniff implements Sniff
+{
+
+ /**
+ * If true, comments will be ignored if they are found in the code.
+ *
+ * @var boolean
+ */
+ public $ignoreComments = false;
+
+ /**
+ * The current file being checked.
+ *
+ * @var string
+ */
+ protected $currFile = '';
+
+ /**
+ * The parsed patterns array.
+ *
+ * @var array
+ */
+ private $parsedPatterns = [];
+
+ /**
+ * Tokens that this sniff wishes to process outside of the patterns.
+ *
+ * @var int[]
+ * @see registerSupplementary()
+ * @see processSupplementary()
+ */
+ private $supplementaryTokens = [];
+
+ /**
+ * Positions in the stack where errors have occurred.
+ *
+ * @var array
+ */
+ private $errorPos = [];
+
+
+ /**
+ * Constructs a AbstractPatternSniff.
+ *
+ * @param boolean $ignoreComments If true, comments will be ignored.
+ */
+ public function __construct($ignoreComments=null)
+ {
+ // This is here for backwards compatibility.
+ if ($ignoreComments !== null) {
+ $this->ignoreComments = $ignoreComments;
+ }
+
+ $this->supplementaryTokens = $this->registerSupplementary();
+
+ }//end __construct()
+
+
+ /**
+ * Registers the tokens to listen to.
+ *
+ * Classes extending AbstractPatternTest should implement the
+ * getPatterns() method to register the patterns they wish to test.
+ *
+ * @return int[]
+ * @see process()
+ */
+ final public function register()
+ {
+ $listenTypes = [];
+ $patterns = $this->getPatterns();
+
+ foreach ($patterns as $pattern) {
+ $parsedPattern = $this->parse($pattern);
+
+ // Find a token position in the pattern that we can use
+ // for a listener token.
+ $pos = $this->getListenerTokenPos($parsedPattern);
+ $tokenType = $parsedPattern[$pos]['token'];
+ $listenTypes[] = $tokenType;
+
+ $patternArray = [
+ 'listen_pos' => $pos,
+ 'pattern' => $parsedPattern,
+ 'pattern_code' => $pattern,
+ ];
+
+ if (isset($this->parsedPatterns[$tokenType]) === false) {
+ $this->parsedPatterns[$tokenType] = [];
+ }
+
+ $this->parsedPatterns[$tokenType][] = $patternArray;
+ }//end foreach
+
+ return array_unique(array_merge($listenTypes, $this->supplementaryTokens));
+
+ }//end register()
+
+
+ /**
+ * Returns the token types that the specified pattern is checking for.
+ *
+ * Returned array is in the format:
+ *
+ * array(
+ * T_WHITESPACE => 0, // 0 is the position where the T_WHITESPACE token
+ * // should occur in the pattern.
+ * );
+ *
+ *
+ * @param array $pattern The parsed pattern to find the acquire the token
+ * types from.
+ *
+ * @return array
+ */
+ private function getPatternTokenTypes($pattern)
+ {
+ $tokenTypes = [];
+ foreach ($pattern as $pos => $patternInfo) {
+ if ($patternInfo['type'] === 'token') {
+ if (isset($tokenTypes[$patternInfo['token']]) === false) {
+ $tokenTypes[$patternInfo['token']] = $pos;
+ }
+ }
+ }
+
+ return $tokenTypes;
+
+ }//end getPatternTokenTypes()
+
+
+ /**
+ * Returns the position in the pattern that this test should register as
+ * a listener for the pattern.
+ *
+ * @param array $pattern The pattern to acquire the listener for.
+ *
+ * @return int The position in the pattern that this test should register
+ * as the listener.
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If we could not determine a token to listen for.
+ */
+ private function getListenerTokenPos($pattern)
+ {
+ $tokenTypes = $this->getPatternTokenTypes($pattern);
+ $tokenCodes = array_keys($tokenTypes);
+ $token = Tokens::getHighestWeightedToken($tokenCodes);
+
+ // If we could not get a token.
+ if ($token === false) {
+ $error = 'Could not determine a token to listen for';
+ throw new RuntimeException($error);
+ }
+
+ return $tokenTypes[$token];
+
+ }//end getListenerTokenPos()
+
+
+ /**
+ * Processes the test.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the
+ * token occurred.
+ * @param int $stackPtr The position in the tokens stack
+ * where the listening token type
+ * was found.
+ *
+ * @return void
+ * @see register()
+ */
+ final public function process(File $phpcsFile, $stackPtr)
+ {
+ $file = $phpcsFile->getFilename();
+ if ($this->currFile !== $file) {
+ // We have changed files, so clean up.
+ $this->errorPos = [];
+ $this->currFile = $file;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+
+ if (in_array($tokens[$stackPtr]['code'], $this->supplementaryTokens, true) === true) {
+ $this->processSupplementary($phpcsFile, $stackPtr);
+ }
+
+ $type = $tokens[$stackPtr]['code'];
+
+ // If the type is not set, then it must have been a token registered
+ // with registerSupplementary().
+ if (isset($this->parsedPatterns[$type]) === false) {
+ return;
+ }
+
+ $allErrors = [];
+
+ // Loop over each pattern that is listening to the current token type
+ // that we are processing.
+ foreach ($this->parsedPatterns[$type] as $patternInfo) {
+ // If processPattern returns false, then the pattern that we are
+ // checking the code with must not be designed to check that code.
+ $errors = $this->processPattern($patternInfo, $phpcsFile, $stackPtr);
+ if ($errors === false) {
+ // The pattern didn't match.
+ continue;
+ } else if (empty($errors) === true) {
+ // The pattern matched, but there were no errors.
+ break;
+ }
+
+ foreach ($errors as $stackPtr => $error) {
+ if (isset($this->errorPos[$stackPtr]) === false) {
+ $this->errorPos[$stackPtr] = true;
+ $allErrors[$stackPtr] = $error;
+ }
+ }
+ }
+
+ foreach ($allErrors as $stackPtr => $error) {
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+ }
+
+ }//end process()
+
+
+ /**
+ * Processes the pattern and verifies the code at $stackPtr.
+ *
+ * @param array $patternInfo Information about the pattern used
+ * for checking, which includes are
+ * parsed token representation of the
+ * pattern.
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the
+ * token occurred.
+ * @param int $stackPtr The position in the tokens stack where
+ * the listening token type was found.
+ *
+ * @return array
+ */
+ protected function processPattern($patternInfo, File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $pattern = $patternInfo['pattern'];
+ $patternCode = $patternInfo['pattern_code'];
+ $errors = [];
+ $found = '';
+
+ $ignoreTokens = [T_WHITESPACE => T_WHITESPACE];
+ if ($this->ignoreComments === true) {
+ $ignoreTokens += Tokens::$commentTokens;
+ }
+
+ $origStackPtr = $stackPtr;
+ $hasError = false;
+
+ if ($patternInfo['listen_pos'] > 0) {
+ $stackPtr--;
+
+ for ($i = ($patternInfo['listen_pos'] - 1); $i >= 0; $i--) {
+ if ($pattern[$i]['type'] === 'token') {
+ if ($pattern[$i]['token'] === T_WHITESPACE) {
+ if ($tokens[$stackPtr]['code'] === T_WHITESPACE) {
+ $found = $tokens[$stackPtr]['content'].$found;
+ }
+
+ // Only check the size of the whitespace if this is not
+ // the first token. We don't care about the size of
+ // leading whitespace, just that there is some.
+ if ($i !== 0) {
+ if ($tokens[$stackPtr]['content'] !== $pattern[$i]['value']) {
+ $hasError = true;
+ }
+ }
+ } else {
+ // Check to see if this important token is the same as the
+ // previous important token in the pattern. If it is not,
+ // then the pattern cannot be for this piece of code.
+ $prev = $phpcsFile->findPrevious(
+ $ignoreTokens,
+ $stackPtr,
+ null,
+ true
+ );
+
+ if ($prev === false
+ || $tokens[$prev]['code'] !== $pattern[$i]['token']
+ ) {
+ return false;
+ }
+
+ // If we skipped past some whitespace tokens, then add them
+ // to the found string.
+ $tokenContent = $phpcsFile->getTokensAsString(
+ ($prev + 1),
+ ($stackPtr - $prev - 1)
+ );
+
+ $found = $tokens[$prev]['content'].$tokenContent.$found;
+
+ if (isset($pattern[($i - 1)]) === true
+ && $pattern[($i - 1)]['type'] === 'skip'
+ ) {
+ $stackPtr = $prev;
+ } else {
+ $stackPtr = ($prev - 1);
+ }
+ }//end if
+ } else if ($pattern[$i]['type'] === 'skip') {
+ // Skip to next piece of relevant code.
+ if ($pattern[$i]['to'] === 'parenthesis_closer') {
+ $to = 'parenthesis_opener';
+ } else {
+ $to = 'scope_opener';
+ }
+
+ // Find the previous opener.
+ $next = $phpcsFile->findPrevious(
+ $ignoreTokens,
+ $stackPtr,
+ null,
+ true
+ );
+
+ if ($next === false || isset($tokens[$next][$to]) === false) {
+ // If there was not opener, then we must be
+ // using the wrong pattern.
+ return false;
+ }
+
+ if ($to === 'parenthesis_opener') {
+ $found = '{'.$found;
+ } else {
+ $found = '('.$found;
+ }
+
+ $found = '...'.$found;
+
+ // Skip to the opening token.
+ $stackPtr = ($tokens[$next][$to] - 1);
+ } else if ($pattern[$i]['type'] === 'string') {
+ $found = 'abc';
+ } else if ($pattern[$i]['type'] === 'newline') {
+ if ($this->ignoreComments === true
+ && isset(Tokens::$commentTokens[$tokens[$stackPtr]['code']]) === true
+ ) {
+ $startComment = $phpcsFile->findPrevious(
+ Tokens::$commentTokens,
+ ($stackPtr - 1),
+ null,
+ true
+ );
+
+ if ($tokens[$startComment]['line'] !== $tokens[($startComment + 1)]['line']) {
+ $startComment++;
+ }
+
+ $tokenContent = $phpcsFile->getTokensAsString(
+ $startComment,
+ ($stackPtr - $startComment + 1)
+ );
+
+ $found = $tokenContent.$found;
+ $stackPtr = ($startComment - 1);
+ }
+
+ if ($tokens[$stackPtr]['code'] === T_WHITESPACE) {
+ if ($tokens[$stackPtr]['content'] !== $phpcsFile->eolChar) {
+ $found = $tokens[$stackPtr]['content'].$found;
+
+ // This may just be an indent that comes after a newline
+ // so check the token before to make sure. If it is a newline, we
+ // can ignore the error here.
+ if (($tokens[($stackPtr - 1)]['content'] !== $phpcsFile->eolChar)
+ && ($this->ignoreComments === true
+ && isset(Tokens::$commentTokens[$tokens[($stackPtr - 1)]['code']]) === false)
+ ) {
+ $hasError = true;
+ } else {
+ $stackPtr--;
+ }
+ } else {
+ $found = 'EOL'.$found;
+ }
+ } else {
+ $found = $tokens[$stackPtr]['content'].$found;
+ $hasError = true;
+ }//end if
+
+ if ($hasError === false && $pattern[($i - 1)]['type'] !== 'newline') {
+ // Make sure they only have 1 newline.
+ $prev = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
+ if ($prev !== false && $tokens[$prev]['line'] !== $tokens[$stackPtr]['line']) {
+ $hasError = true;
+ }
+ }
+ }//end if
+ }//end for
+ }//end if
+
+ $stackPtr = $origStackPtr;
+ $lastAddedStackPtr = null;
+ $patternLen = count($pattern);
+
+ for ($i = $patternInfo['listen_pos']; $i < $patternLen; $i++) {
+ if (isset($tokens[$stackPtr]) === false) {
+ break;
+ }
+
+ if ($pattern[$i]['type'] === 'token') {
+ if ($pattern[$i]['token'] === T_WHITESPACE) {
+ if ($this->ignoreComments === true) {
+ // If we are ignoring comments, check to see if this current
+ // token is a comment. If so skip it.
+ if (isset(Tokens::$commentTokens[$tokens[$stackPtr]['code']]) === true) {
+ continue;
+ }
+
+ // If the next token is a comment, the we need to skip the
+ // current token as we should allow a space before a
+ // comment for readability.
+ if (isset($tokens[($stackPtr + 1)]) === true
+ && isset(Tokens::$commentTokens[$tokens[($stackPtr + 1)]['code']]) === true
+ ) {
+ continue;
+ }
+ }
+
+ $tokenContent = '';
+ if ($tokens[$stackPtr]['code'] === T_WHITESPACE) {
+ if (isset($pattern[($i + 1)]) === false) {
+ // This is the last token in the pattern, so just compare
+ // the next token of content.
+ $tokenContent = $tokens[$stackPtr]['content'];
+ } else {
+ // Get all the whitespace to the next token.
+ $next = $phpcsFile->findNext(
+ Tokens::$emptyTokens,
+ $stackPtr,
+ null,
+ true
+ );
+
+ $tokenContent = $phpcsFile->getTokensAsString(
+ $stackPtr,
+ ($next - $stackPtr)
+ );
+
+ $lastAddedStackPtr = $stackPtr;
+ $stackPtr = $next;
+ }//end if
+
+ if ($stackPtr !== $lastAddedStackPtr) {
+ $found .= $tokenContent;
+ }
+ } else {
+ if ($stackPtr !== $lastAddedStackPtr) {
+ $found .= $tokens[$stackPtr]['content'];
+ $lastAddedStackPtr = $stackPtr;
+ }
+ }//end if
+
+ if (isset($pattern[($i + 1)]) === true
+ && $pattern[($i + 1)]['type'] === 'skip'
+ ) {
+ // The next token is a skip token, so we just need to make
+ // sure the whitespace we found has *at least* the
+ // whitespace required.
+ if (strpos($tokenContent, $pattern[$i]['value']) !== 0) {
+ $hasError = true;
+ }
+ } else {
+ if ($tokenContent !== $pattern[$i]['value']) {
+ $hasError = true;
+ }
+ }
+ } else {
+ // Check to see if this important token is the same as the
+ // next important token in the pattern. If it is not, then
+ // the pattern cannot be for this piece of code.
+ $next = $phpcsFile->findNext(
+ $ignoreTokens,
+ $stackPtr,
+ null,
+ true
+ );
+
+ if ($next === false
+ || $tokens[$next]['code'] !== $pattern[$i]['token']
+ ) {
+ // The next important token did not match the pattern.
+ return false;
+ }
+
+ if ($lastAddedStackPtr !== null) {
+ if (($tokens[$next]['code'] === T_OPEN_CURLY_BRACKET
+ || $tokens[$next]['code'] === T_CLOSE_CURLY_BRACKET)
+ && isset($tokens[$next]['scope_condition']) === true
+ && $tokens[$next]['scope_condition'] > $lastAddedStackPtr
+ ) {
+ // This is a brace, but the owner of it is after the current
+ // token, which means it does not belong to any token in
+ // our pattern. This means the pattern is not for us.
+ return false;
+ }
+
+ if (($tokens[$next]['code'] === T_OPEN_PARENTHESIS
+ || $tokens[$next]['code'] === T_CLOSE_PARENTHESIS)
+ && isset($tokens[$next]['parenthesis_owner']) === true
+ && $tokens[$next]['parenthesis_owner'] > $lastAddedStackPtr
+ ) {
+ // This is a bracket, but the owner of it is after the current
+ // token, which means it does not belong to any token in
+ // our pattern. This means the pattern is not for us.
+ return false;
+ }
+ }//end if
+
+ // If we skipped past some whitespace tokens, then add them
+ // to the found string.
+ if (($next - $stackPtr) > 0) {
+ $hasComment = false;
+ for ($j = $stackPtr; $j < $next; $j++) {
+ $found .= $tokens[$j]['content'];
+ if (isset(Tokens::$commentTokens[$tokens[$j]['code']]) === true) {
+ $hasComment = true;
+ }
+ }
+
+ // If we are not ignoring comments, this additional
+ // whitespace or comment is not allowed. If we are
+ // ignoring comments, there needs to be at least one
+ // comment for this to be allowed.
+ if ($this->ignoreComments === false
+ || ($this->ignoreComments === true
+ && $hasComment === false)
+ ) {
+ $hasError = true;
+ }
+
+ // Even when ignoring comments, we are not allowed to include
+ // newlines without the pattern specifying them, so
+ // everything should be on the same line.
+ if ($tokens[$next]['line'] !== $tokens[$stackPtr]['line']) {
+ $hasError = true;
+ }
+ }//end if
+
+ if ($next !== $lastAddedStackPtr) {
+ $found .= $tokens[$next]['content'];
+ $lastAddedStackPtr = $next;
+ }
+
+ if (isset($pattern[($i + 1)]) === true
+ && $pattern[($i + 1)]['type'] === 'skip'
+ ) {
+ $stackPtr = $next;
+ } else {
+ $stackPtr = ($next + 1);
+ }
+ }//end if
+ } else if ($pattern[$i]['type'] === 'skip') {
+ if ($pattern[$i]['to'] === 'unknown') {
+ $next = $phpcsFile->findNext(
+ $pattern[($i + 1)]['token'],
+ $stackPtr
+ );
+
+ if ($next === false) {
+ // Couldn't find the next token, so we must
+ // be using the wrong pattern.
+ return false;
+ }
+
+ $found .= '...';
+ $stackPtr = $next;
+ } else {
+ // Find the previous opener.
+ $next = $phpcsFile->findPrevious(
+ Tokens::$blockOpeners,
+ $stackPtr
+ );
+
+ if ($next === false
+ || isset($tokens[$next][$pattern[$i]['to']]) === false
+ ) {
+ // If there was not opener, then we must
+ // be using the wrong pattern.
+ return false;
+ }
+
+ $found .= '...';
+ if ($pattern[$i]['to'] === 'parenthesis_closer') {
+ $found .= ')';
+ } else {
+ $found .= '}';
+ }
+
+ // Skip to the closing token.
+ $stackPtr = ($tokens[$next][$pattern[$i]['to']] + 1);
+ }//end if
+ } else if ($pattern[$i]['type'] === 'string') {
+ if ($tokens[$stackPtr]['code'] !== T_STRING) {
+ $hasError = true;
+ }
+
+ if ($stackPtr !== $lastAddedStackPtr) {
+ $found .= 'abc';
+ $lastAddedStackPtr = $stackPtr;
+ }
+
+ $stackPtr++;
+ } else if ($pattern[$i]['type'] === 'newline') {
+ // Find the next token that contains a newline character.
+ $newline = 0;
+ for ($j = $stackPtr; $j < $phpcsFile->numTokens; $j++) {
+ if (strpos($tokens[$j]['content'], $phpcsFile->eolChar) !== false) {
+ $newline = $j;
+ break;
+ }
+ }
+
+ if ($newline === 0) {
+ // We didn't find a newline character in the rest of the file.
+ $next = ($phpcsFile->numTokens - 1);
+ $hasError = true;
+ } else {
+ if ($this->ignoreComments === false) {
+ // The newline character cannot be part of a comment.
+ if (isset(Tokens::$commentTokens[$tokens[$newline]['code']]) === true) {
+ $hasError = true;
+ }
+ }
+
+ if ($newline === $stackPtr) {
+ $next = ($stackPtr + 1);
+ } else {
+ // Check that there were no significant tokens that we
+ // skipped over to find our newline character.
+ $next = $phpcsFile->findNext(
+ $ignoreTokens,
+ $stackPtr,
+ null,
+ true
+ );
+
+ if ($next < $newline) {
+ // We skipped a non-ignored token.
+ $hasError = true;
+ } else {
+ $next = ($newline + 1);
+ }
+ }
+ }//end if
+
+ if ($stackPtr !== $lastAddedStackPtr) {
+ $found .= $phpcsFile->getTokensAsString(
+ $stackPtr,
+ ($next - $stackPtr)
+ );
+
+ $lastAddedStackPtr = ($next - 1);
+ }
+
+ $stackPtr = $next;
+ }//end if
+ }//end for
+
+ if ($hasError === true) {
+ $error = $this->prepareError($found, $patternCode);
+ $errors[$origStackPtr] = $error;
+ }
+
+ return $errors;
+
+ }//end processPattern()
+
+
+ /**
+ * Prepares an error for the specified patternCode.
+ *
+ * @param string $found The actual found string in the code.
+ * @param string $patternCode The expected pattern code.
+ *
+ * @return string The error message.
+ */
+ protected function prepareError($found, $patternCode)
+ {
+ $found = str_replace("\r\n", '\n', $found);
+ $found = str_replace("\n", '\n', $found);
+ $found = str_replace("\r", '\n', $found);
+ $found = str_replace("\t", '\t', $found);
+ $found = str_replace('EOL', '\n', $found);
+ $expected = str_replace('EOL', '\n', $patternCode);
+
+ $error = "Expected \"$expected\"; found \"$found\"";
+
+ return $error;
+
+ }//end prepareError()
+
+
+ /**
+ * Returns the patterns that should be checked.
+ *
+ * @return string[]
+ */
+ abstract protected function getPatterns();
+
+
+ /**
+ * Registers any supplementary tokens that this test might wish to process.
+ *
+ * A sniff may wish to register supplementary tests when it wishes to group
+ * an arbitrary validation that cannot be performed using a pattern, with
+ * other pattern tests.
+ *
+ * @return int[]
+ * @see processSupplementary()
+ */
+ protected function registerSupplementary()
+ {
+ return [];
+
+ }//end registerSupplementary()
+
+
+ /**
+ * Processes any tokens registered with registerSupplementary().
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where to
+ * process the skip.
+ * @param int $stackPtr The position in the tokens stack to
+ * process.
+ *
+ * @return void
+ * @see registerSupplementary()
+ */
+ protected function processSupplementary(File $phpcsFile, $stackPtr)
+ {
+
+ }//end processSupplementary()
+
+
+ /**
+ * Parses a pattern string into an array of pattern steps.
+ *
+ * @param string $pattern The pattern to parse.
+ *
+ * @return array The parsed pattern array.
+ * @see createSkipPattern()
+ * @see createTokenPattern()
+ */
+ private function parse($pattern)
+ {
+ $patterns = [];
+ $length = strlen($pattern);
+ $lastToken = 0;
+ $firstToken = 0;
+
+ for ($i = 0; $i < $length; $i++) {
+ $specialPattern = false;
+ $isLastChar = ($i === ($length - 1));
+ $oldFirstToken = $firstToken;
+
+ if (substr($pattern, $i, 3) === '...') {
+ // It's a skip pattern. The skip pattern requires the
+ // content of the token in the "from" position and the token
+ // to skip to.
+ $specialPattern = $this->createSkipPattern($pattern, ($i - 1));
+ $lastToken = ($i - $firstToken);
+ $firstToken = ($i + 3);
+ $i += 2;
+
+ if ($specialPattern['to'] !== 'unknown') {
+ $firstToken++;
+ }
+ } else if (substr($pattern, $i, 3) === 'abc') {
+ $specialPattern = ['type' => 'string'];
+ $lastToken = ($i - $firstToken);
+ $firstToken = ($i + 3);
+ $i += 2;
+ } else if (substr($pattern, $i, 3) === 'EOL') {
+ $specialPattern = ['type' => 'newline'];
+ $lastToken = ($i - $firstToken);
+ $firstToken = ($i + 3);
+ $i += 2;
+ }//end if
+
+ if ($specialPattern !== false || $isLastChar === true) {
+ // If we are at the end of the string, don't worry about a limit.
+ if ($isLastChar === true) {
+ // Get the string from the end of the last skip pattern, if any,
+ // to the end of the pattern string.
+ $str = substr($pattern, $oldFirstToken);
+ } else {
+ // Get the string from the end of the last special pattern,
+ // if any, to the start of this special pattern.
+ if ($lastToken === 0) {
+ // Note that if the last special token was zero characters ago,
+ // there will be nothing to process so we can skip this bit.
+ // This happens if you have something like: EOL... in your pattern.
+ $str = '';
+ } else {
+ $str = substr($pattern, $oldFirstToken, $lastToken);
+ }
+ }
+
+ if ($str !== '') {
+ $tokenPatterns = $this->createTokenPattern($str);
+ foreach ($tokenPatterns as $tokenPattern) {
+ $patterns[] = $tokenPattern;
+ }
+ }
+
+ // Make sure we don't skip the last token.
+ if ($isLastChar === false && $i === ($length - 1)) {
+ $i--;
+ }
+ }//end if
+
+ // Add the skip pattern *after* we have processed
+ // all the tokens from the end of the last skip pattern
+ // to the start of this skip pattern.
+ if ($specialPattern !== false) {
+ $patterns[] = $specialPattern;
+ }
+ }//end for
+
+ return $patterns;
+
+ }//end parse()
+
+
+ /**
+ * Creates a skip pattern.
+ *
+ * @param string $pattern The pattern being parsed.
+ * @param string $from The token content that the skip pattern starts from.
+ *
+ * @return array The pattern step.
+ * @see createTokenPattern()
+ * @see parse()
+ */
+ private function createSkipPattern($pattern, $from)
+ {
+ $skip = ['type' => 'skip'];
+
+ $nestedParenthesis = 0;
+ $nestedBraces = 0;
+ for ($start = $from; $start >= 0; $start--) {
+ switch ($pattern[$start]) {
+ case '(':
+ if ($nestedParenthesis === 0) {
+ $skip['to'] = 'parenthesis_closer';
+ }
+
+ $nestedParenthesis--;
+ break;
+ case '{':
+ if ($nestedBraces === 0) {
+ $skip['to'] = 'scope_closer';
+ }
+
+ $nestedBraces--;
+ break;
+ case '}':
+ $nestedBraces++;
+ break;
+ case ')':
+ $nestedParenthesis++;
+ break;
+ }//end switch
+
+ if (isset($skip['to']) === true) {
+ break;
+ }
+ }//end for
+
+ if (isset($skip['to']) === false) {
+ $skip['to'] = 'unknown';
+ }
+
+ return $skip;
+
+ }//end createSkipPattern()
+
+
+ /**
+ * Creates a token pattern.
+ *
+ * @param string $str The tokens string that the pattern should match.
+ *
+ * @return array The pattern step.
+ * @see createSkipPattern()
+ * @see parse()
+ */
+ private function createTokenPattern($str)
+ {
+ // Don't add a space after the closing php tag as it will add a new
+ // whitespace token.
+ $tokenizer = new PHP('', null);
+
+ // Remove the getTokens();
+ $tokens = array_slice($tokens, 1, (count($tokens) - 2));
+
+ $patterns = [];
+ foreach ($tokens as $patternInfo) {
+ $patterns[] = [
+ 'type' => 'token',
+ 'token' => $patternInfo['code'],
+ 'value' => $patternInfo['content'],
+ ];
+ }
+
+ return $patterns;
+
+ }//end createTokenPattern()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php
new file mode 100644
index 00000000..70d8720a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php
@@ -0,0 +1,191 @@
+
+ * class ClassScopeTest extends PHP_CodeSniffer_Standards_AbstractScopeSniff
+ * {
+ * public function __construct()
+ * {
+ * parent::__construct(array(T_CLASS), array(T_FUNCTION));
+ * }
+ *
+ * protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $currScope)
+ * {
+ * $className = $phpcsFile->getDeclarationName($currScope);
+ * echo 'encountered a method within class '.$className;
+ * }
+ * }
+ *
+ *
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Sniffs;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+
+abstract class AbstractScopeSniff implements Sniff
+{
+
+ /**
+ * The token types that this test wishes to listen to within the scope.
+ *
+ * @var array
+ */
+ private $tokens = [];
+
+ /**
+ * The type of scope opener tokens that this test wishes to listen to.
+ *
+ * @var string
+ */
+ private $scopeTokens = [];
+
+ /**
+ * True if this test should fire on tokens outside of the scope.
+ *
+ * @var boolean
+ */
+ private $listenOutside = false;
+
+
+ /**
+ * Constructs a new AbstractScopeTest.
+ *
+ * @param array $scopeTokens The type of scope the test wishes to listen to.
+ * @param array $tokens The tokens that the test wishes to listen to
+ * within the scope.
+ * @param boolean $listenOutside If true this test will also alert the
+ * extending class when a token is found outside
+ * the scope, by calling the
+ * processTokenOutsideScope method.
+ *
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified tokens arrays are empty
+ * or invalid.
+ */
+ public function __construct(
+ array $scopeTokens,
+ array $tokens,
+ $listenOutside=false
+ ) {
+ if (empty($scopeTokens) === true) {
+ $error = 'The scope tokens list cannot be empty';
+ throw new RuntimeException($error);
+ }
+
+ if (empty($tokens) === true) {
+ $error = 'The tokens list cannot be empty';
+ throw new RuntimeException($error);
+ }
+
+ $invalidScopeTokens = array_intersect($scopeTokens, $tokens);
+ if (empty($invalidScopeTokens) === false) {
+ $invalid = implode(', ', $invalidScopeTokens);
+ $error = "Scope tokens [$invalid] can't be in the tokens array";
+ throw new RuntimeException($error);
+ }
+
+ $this->listenOutside = $listenOutside;
+ $this->scopeTokens = array_flip($scopeTokens);
+ $this->tokens = $tokens;
+
+ }//end __construct()
+
+
+ /**
+ * The method that is called to register the tokens this test wishes to
+ * listen to.
+ *
+ * DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register
+ * for the desired tokens and scope.
+ *
+ * @return int[]
+ * @see __constructor()
+ */
+ final public function register()
+ {
+ return $this->tokens;
+
+ }//end register()
+
+
+ /**
+ * Processes the tokens that this test is listening for.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
+ * @param int $stackPtr The position in the stack where this
+ * token was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ * @see processTokenWithinScope()
+ */
+ final public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $foundScope = false;
+ $skipTokens = [];
+ foreach ($tokens[$stackPtr]['conditions'] as $scope => $code) {
+ if (isset($this->scopeTokens[$code]) === true) {
+ $skipTokens[] = $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
+ $foundScope = true;
+ }
+ }
+
+ if ($this->listenOutside === true && $foundScope === false) {
+ $skipTokens[] = $this->processTokenOutsideScope($phpcsFile, $stackPtr);
+ }
+
+ if (empty($skipTokens) === false) {
+ return min($skipTokens);
+ }
+
+ return;
+
+ }//end process()
+
+
+ /**
+ * Processes a token that is found within the scope that this test is
+ * listening to.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
+ * @param int $stackPtr The position in the stack where this
+ * token was found.
+ * @param int $currScope The position in the tokens array that
+ * opened the scope that this test is
+ * listening for.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ abstract protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope);
+
+
+ /**
+ * Processes a token that is found outside the scope that this test is
+ * listening to.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
+ * @param int $stackPtr The position in the stack where this
+ * token was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return (count($tokens) + 1) to skip
+ * the rest of the file.
+ */
+ abstract protected function processTokenOutsideScope(File $phpcsFile, $stackPtr);
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php
new file mode 100644
index 00000000..5dc8ba55
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php
@@ -0,0 +1,230 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Sniffs;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+abstract class AbstractVariableSniff extends AbstractScopeSniff
+{
+
+ /**
+ * List of PHP Reserved variables.
+ *
+ * Used by various naming convention sniffs.
+ *
+ * @var array
+ */
+ protected $phpReservedVars = [
+ '_SERVER' => true,
+ '_GET' => true,
+ '_POST' => true,
+ '_REQUEST' => true,
+ '_SESSION' => true,
+ '_ENV' => true,
+ '_COOKIE' => true,
+ '_FILES' => true,
+ 'GLOBALS' => true,
+ 'http_response_header' => true,
+ 'HTTP_RAW_POST_DATA' => true,
+ 'php_errormsg' => true,
+ ];
+
+
+ /**
+ * Constructs an AbstractVariableTest.
+ */
+ public function __construct()
+ {
+ $scopes = Tokens::$ooScopeTokens;
+
+ $listen = [
+ T_VARIABLE,
+ T_DOUBLE_QUOTED_STRING,
+ T_HEREDOC,
+ ];
+
+ parent::__construct($scopes, $listen, true);
+
+ }//end __construct()
+
+
+ /**
+ * Processes the token in the specified PHP_CodeSniffer\Files\File.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where this
+ * token was found.
+ * @param int $stackPtr The position where the token was found.
+ * @param int $currScope The current scope opener token.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if ($tokens[$stackPtr]['code'] === T_DOUBLE_QUOTED_STRING
+ || $tokens[$stackPtr]['code'] === T_HEREDOC
+ ) {
+ // Check to see if this string has a variable in it.
+ $pattern = '|(?processVariableInString($phpcsFile, $stackPtr);
+ }
+
+ return;
+ }
+
+ // If this token is nested inside a function at a deeper
+ // level than the current OO scope that was found, it's a normal
+ // variable and not a member var.
+ $conditions = array_reverse($tokens[$stackPtr]['conditions'], true);
+ $inFunction = false;
+ foreach ($conditions as $scope => $code) {
+ if (isset(Tokens::$ooScopeTokens[$code]) === true) {
+ break;
+ }
+
+ if ($code === T_FUNCTION || $code === T_CLOSURE) {
+ $inFunction = true;
+ }
+ }
+
+ if ($scope !== $currScope) {
+ // We found a closer scope to this token, so ignore
+ // this particular time through the sniff. We will process
+ // this token when this closer scope is found to avoid
+ // duplicate checks.
+ return;
+ }
+
+ // Just make sure this isn't a variable in a function declaration.
+ if ($inFunction === false && isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
+ foreach ($tokens[$stackPtr]['nested_parenthesis'] as $opener => $closer) {
+ if (isset($tokens[$opener]['parenthesis_owner']) === false) {
+ // Check if this is a USE statement for a closure.
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($opener - 1), null, true);
+ if ($tokens[$prev]['code'] === T_USE) {
+ $inFunction = true;
+ break;
+ }
+
+ continue;
+ }
+
+ $owner = $tokens[$opener]['parenthesis_owner'];
+ if ($tokens[$owner]['code'] === T_FUNCTION
+ || $tokens[$owner]['code'] === T_CLOSURE
+ ) {
+ $inFunction = true;
+ break;
+ }
+ }
+ }//end if
+
+ if ($inFunction === true) {
+ return $this->processVariable($phpcsFile, $stackPtr);
+ } else {
+ return $this->processMemberVar($phpcsFile, $stackPtr);
+ }
+
+ }//end processTokenWithinScope()
+
+
+ /**
+ * Processes the token outside the scope in the file.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where this
+ * token was found.
+ * @param int $stackPtr The position where the token was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ // These variables are not member vars.
+ if ($tokens[$stackPtr]['code'] === T_VARIABLE) {
+ return $this->processVariable($phpcsFile, $stackPtr);
+ } else if ($tokens[$stackPtr]['code'] === T_DOUBLE_QUOTED_STRING
+ || $tokens[$stackPtr]['code'] === T_HEREDOC
+ ) {
+ // Check to see if this string has a variable in it.
+ $pattern = '|(?processVariableInString($phpcsFile, $stackPtr);
+ }
+ }
+
+ }//end processTokenOutsideScope()
+
+
+ /**
+ * Called to process class member vars.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where this
+ * token was found.
+ * @param int $stackPtr The position where the token was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ abstract protected function processMemberVar(File $phpcsFile, $stackPtr);
+
+
+ /**
+ * Called to process normal member vars.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where this
+ * token was found.
+ * @param int $stackPtr The position where the token was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ abstract protected function processVariable(File $phpcsFile, $stackPtr);
+
+
+ /**
+ * Called to process variables found in double quoted strings or heredocs.
+ *
+ * Note that there may be more than one variable in the string, which will
+ * result only in one call for the string or one call per line for heredocs.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where this
+ * token was found.
+ * @param int $stackPtr The position where the double quoted
+ * string was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return ($phpcsFile->numTokens + 1) to skip
+ * the rest of the file.
+ */
+ abstract protected function processVariableInString(File $phpcsFile, $stackPtr);
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php
new file mode 100644
index 00000000..3f0fb6a1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/Sniff.php
@@ -0,0 +1,80 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Sniffs;
+
+use PHP_CodeSniffer\Files\File;
+
+interface Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * An example return value for a sniff that wants to listen for whitespace
+ * and any comments would be:
+ *
+ *
+ * return array(
+ * T_WHITESPACE,
+ * T_DOC_COMMENT,
+ * T_COMMENT,
+ * );
+ *
+ *
+ * @return mixed[]
+ * @see Tokens.php
+ */
+ public function register();
+
+
+ /**
+ * Called when one of the token types that this sniff is listening for
+ * is found.
+ *
+ * The stackPtr variable indicates where in the stack the token was found.
+ * A sniff can acquire information about this token, along with all the other
+ * tokens within the stack by first acquiring the token stack:
+ *
+ *
+ * $tokens = $phpcsFile->getTokens();
+ * echo 'Encountered a '.$tokens[$stackPtr]['type'].' token';
+ * echo 'token information: ';
+ * print_r($tokens[$stackPtr]);
+ *
+ *
+ * If the sniff discovers an anomaly in the code, they can raise an error
+ * by calling addError() on the \PHP_CodeSniffer\Files\File object, specifying an error
+ * message and the position of the offending token:
+ *
+ *
+ * $phpcsFile->addError('Encountered an error', $stackPtr);
+ *
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The PHP_CodeSniffer file where the
+ * token was found.
+ * @param int $stackPtr The position in the PHP_CodeSniffer
+ * file's token stack where the token
+ * was found.
+ *
+ * @return void|int Optionally returns a stack pointer. The sniff will not be
+ * called again on the current file until the returned stack
+ * pointer is reached. Return (count($tokens) + 1) to skip
+ * the rest of the file.
+ */
+ public function process(File $phpcsFile, $stackPtr);
+
+
+}//end interface
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowLongArraySyntaxStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowLongArraySyntaxStandard.xml
new file mode 100644
index 00000000..21b0d27d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowLongArraySyntaxStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ [
+ 'foo' => 'bar',
+];
+ ]]>
+
+
+ array(
+ 'foo' => 'bar',
+);
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowShortArraySyntaxStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowShortArraySyntaxStandard.xml
new file mode 100644
index 00000000..f24767ca
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Arrays/DisallowShortArraySyntaxStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ array(
+ 'foo' => 'bar',
+);
+ ]]>
+
+
+ [
+ 'foo' => 'bar',
+];
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/DuplicateClassNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/DuplicateClassNameStandard.xml
new file mode 100644
index 00000000..4b0ec96d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/DuplicateClassNameStandard.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+ Foo
+{
+}
+ ]]>
+
+
+ Foo
+{
+}
+
+class Foo
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/OpeningBraceSameLineStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/OpeningBraceSameLineStandard.xml
new file mode 100644
index 00000000..6226a3ff
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/OpeningBraceSameLineStandard.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ {
+}
+ ]]>
+
+
+ {
+}
+ ]]>
+
+
+ // Start of class.
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/AssignmentInConditionStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/AssignmentInConditionStandard.xml
new file mode 100644
index 00000000..9961ea05
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/AssignmentInConditionStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ $test === 'abc') {
+ // Code.
+}
+ ]]>
+
+
+ $test = 'abc') {
+ // Code.
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/EmptyStatementStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/EmptyStatementStandard.xml
new file mode 100644
index 00000000..c400d75e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/EmptyStatementStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ // do nothing
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopShouldBeWhileLoopStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopShouldBeWhileLoopStandard.xml
new file mode 100644
index 00000000..06f0b7a5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopShouldBeWhileLoopStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ $i = 0; $i < 10; $i++) {
+ echo "{$i}\n";
+}
+ ]]>
+
+
+ ;$test;) {
+ $test = doSomething();
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopWithTestFunctionCallStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopWithTestFunctionCallStandard.xml
new file mode 100644
index 00000000..f40d94bb
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/ForLoopWithTestFunctionCallStandard.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ $end = count($foo);
+for ($i = 0; $i < $end; $i++) {
+ echo $foo[$i]."\n";
+}
+ ]]>
+
+
+ count($foo); $i++) {
+ echo $foo[$i]."\n";
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/JumbledIncrementerStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/JumbledIncrementerStandard.xml
new file mode 100644
index 00000000..50f07828
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/JumbledIncrementerStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ $i++) {
+ for ($j = 0; $j < 10; $j++) {
+ }
+}
+ ]]>
+
+
+ $i++) {
+ for ($j = 0; $j < 10; $i++) {
+ }
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnconditionalIfStatementStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnconditionalIfStatementStandard.xml
new file mode 100644
index 00000000..b2eaabe7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnconditionalIfStatementStandard.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ $test) {
+ $var = 1;
+}
+ ]]>
+
+
+ true) {
+ $var = 1;
+}
+ ]]>
+
+
+
+
+ $test) {
+ $var = 1;
+}
+ ]]>
+
+
+ false) {
+ $var = 1;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnnecessaryFinalModifierStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnnecessaryFinalModifierStandard.xml
new file mode 100644
index 00000000..89367407
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnnecessaryFinalModifierStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+ final function bar()
+ {
+ }
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnusedFunctionParameterStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnusedFunctionParameterStandard.xml
new file mode 100644
index 00000000..181dff4e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UnusedFunctionParameterStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ $a + $b + $c;
+}
+ ]]>
+
+
+ $a + $b;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UselessOverridingMethodStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UselessOverridingMethodStandard.xml
new file mode 100644
index 00000000..ba8bd7e4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/CodeAnalysis/UselessOverridingMethodStandard.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ $this->doSomethingElse();
+ }
+}
+ ]]>
+
+
+ parent::bar();
+ }
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/FixmeStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/FixmeStandard.xml
new file mode 100644
index 00000000..174c6b0a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/FixmeStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Handle strange case
+if ($test) {
+ $var = 1;
+}
+ ]]>
+
+
+ FIXME: This needs to be fixed!
+if ($test) {
+ $var = 1;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/TodoStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/TodoStandard.xml
new file mode 100644
index 00000000..c9c4fc06
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Commenting/TodoStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Handle strange case
+if ($test) {
+ $var = 1;
+}
+ ]]>
+
+
+ TODO: This needs to be fixed!
+if ($test) {
+ $var = 1;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/DisallowYodaConditionsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/DisallowYodaConditionsStandard.xml
new file mode 100644
index 00000000..570e4192
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/DisallowYodaConditionsStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ {
+ $var = 1;
+}
+ ]]>
+
+
+ {
+ $var = 1;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/InlineControlStructureStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/InlineControlStructureStandard.xml
new file mode 100644
index 00000000..06ae14b7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/InlineControlStructureStandard.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ {
+ $var = 1;
+}
+ ]]>
+
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/CSSLintStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/CSSLintStandard.xml
new file mode 100644
index 00000000..b57a9706
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/CSSLintStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ %; }
+ ]]>
+
+
+ %; }
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/ClosureLinterStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/ClosureLinterStandard.xml
new file mode 100644
index 00000000..9df9aec4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/ClosureLinterStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ ];
+ ]]>
+
+
+ ,];
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/JSHintStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/JSHintStandard.xml
new file mode 100644
index 00000000..7525e9e6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Debug/JSHintStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ var foo = 5;
+ ]]>
+
+
+ foo = 5;
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ByteOrderMarkStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ByteOrderMarkStandard.xml
new file mode 100644
index 00000000..88591f92
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ByteOrderMarkStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNewlineStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNewlineStandard.xml
new file mode 100644
index 00000000..aa757edc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNewlineStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNoNewlineStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNoNewlineStandard.xml
new file mode 100644
index 00000000..227d5621
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/EndFileNoNewlineStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ExecutableFileStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ExecutableFileStandard.xml
new file mode 100644
index 00000000..6114f24c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/ExecutableFileStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/InlineHTMLStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/InlineHTMLStandard.xml
new file mode 100644
index 00000000..3fbf5024
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/InlineHTMLStandard.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+ some string here
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineEndingsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineEndingsStandard.xml
new file mode 100644
index 00000000..4554d0f3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineEndingsStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineLengthStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineLengthStandard.xml
new file mode 100644
index 00000000..31342e3c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LineLengthStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LowercasedFilenameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LowercasedFilenameStandard.xml
new file mode 100644
index 00000000..a1be34cb
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/LowercasedFilenameStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneClassPerFileStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneClassPerFileStandard.xml
new file mode 100644
index 00000000..7b585763
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneClassPerFileStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ class Foo
+{
+}
+ ]]>
+
+
+ class Foo
+{
+}
+
+class Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneInterfacePerFileStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneInterfacePerFileStandard.xml
new file mode 100644
index 00000000..de975319
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneInterfacePerFileStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ interface Foo
+{
+}
+ ]]>
+
+
+ interface Foo
+{
+}
+
+interface Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneObjectStructurePerFileStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneObjectStructurePerFileStandard.xml
new file mode 100644
index 00000000..4d957e70
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneObjectStructurePerFileStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ trait Foo
+{
+}
+ ]]>
+
+
+ trait Foo
+{
+}
+
+class Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneTraitPerFileStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneTraitPerFileStandard.xml
new file mode 100644
index 00000000..58a6482f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/OneTraitPerFileStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ trait Foo
+{
+}
+ ]]>
+
+
+ trait Foo
+{
+}
+
+trait Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/DisallowMultipleStatementsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/DisallowMultipleStatementsStandard.xml
new file mode 100644
index 00000000..f0d4490c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/DisallowMultipleStatementsStandard.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml
new file mode 100644
index 00000000..4c33d763
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ = (1 + 2);
+$veryLongVarName = 'string';
+$var = foo($bar, $baz);
+ ]]>
+
+
+ = (1 + 2);
+$veryLongVarName = 'string';
+$var = foo($bar, $baz);
+ ]]>
+
+
+
+
+
+
+
+ += 1;
+$veryLongVarName = 1;
+ ]]>
+
+
+ += 1;
+$veryLongVarName = 1;
+ ]]>
+
+
+
+
+ = 1;
+$veryLongVarName -= 1;
+ ]]>
+
+
+ = 1;
+$veryLongVarName -= 1;
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/NoSpaceAfterCastStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/NoSpaceAfterCastStandard.xml
new file mode 100644
index 00000000..042e4f80
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/NoSpaceAfterCastStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+ 1;
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterCastStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterCastStandard.xml
new file mode 100644
index 00000000..75eba77c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterCastStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ 1;
+ ]]>
+
+
+ 1;
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterNotStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterNotStandard.xml
new file mode 100644
index 00000000..dd3e7731
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/SpaceAfterNotStandard.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ $someVar || !$x instanceOf stdClass) {};
+ ]]>
+
+
+ $someVar || !$x instanceOf stdClass) {};
+ ]]>
+
+
+ $someVar || !
+ $x instanceOf stdClass) {};
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/CallTimePassByReferenceStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/CallTimePassByReferenceStandard.xml
new file mode 100644
index 00000000..738998d4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/CallTimePassByReferenceStandard.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ &$bar)
+{
+ $bar++;
+}
+
+$baz = 1;
+foo($baz);
+ ]]>
+
+
+ &$baz);
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml
new file mode 100644
index 00000000..9809844d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ $baz)
+{
+}
+ ]]>
+
+
+ $baz)
+{
+}
+ ]]>
+
+
+
+
+ =true)
+{
+}
+ ]]>
+
+
+ =true)
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceBsdAllmanStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceBsdAllmanStandard.xml
new file mode 100644
index 00000000..414dc289
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceBsdAllmanStandard.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ {
+ ...
+}
+ ]]>
+
+
+ {
+ ...
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceKernighanRitchieStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceKernighanRitchieStandard.xml
new file mode 100644
index 00000000..84c2bdd8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/OpeningFunctionBraceKernighanRitchieStandard.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ {
+ ...
+}
+ ]]>
+
+
+ {
+ ...
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/CyclomaticComplexityStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/CyclomaticComplexityStandard.xml
new file mode 100644
index 00000000..a928e7db
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/CyclomaticComplexityStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/NestingLevelStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/NestingLevelStandard.xml
new file mode 100644
index 00000000..f66cd92c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Metrics/NestingLevelStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/AbstractClassNamePrefixStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/AbstractClassNamePrefixStandard.xml
new file mode 100644
index 00000000..c30d26e9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/AbstractClassNamePrefixStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ AbstractBar
+{
+}
+ ]]>
+
+
+ Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/CamelCapsFunctionNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/CamelCapsFunctionNameStandard.xml
new file mode 100644
index 00000000..f5345b71
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/CamelCapsFunctionNameStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ doSomething()
+{
+}
+ ]]>
+
+
+ do_something()
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/ConstructorNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/ConstructorNameStandard.xml
new file mode 100644
index 00000000..9dfc175f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/ConstructorNameStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ __construct()
+ {
+ }
+}
+ ]]>
+
+
+ Foo()
+ {
+ }
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/InterfaceNameSuffixStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/InterfaceNameSuffixStandard.xml
new file mode 100644
index 00000000..0aa0c76e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/InterfaceNameSuffixStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ BarInterface
+{
+}
+ ]]>
+
+
+ Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/TraitNameSuffixStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/TraitNameSuffixStandard.xml
new file mode 100644
index 00000000..711867e4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/TraitNameSuffixStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ BarTrait
+{
+}
+ ]]>
+
+
+ Bar
+{
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/UpperCaseConstantNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/UpperCaseConstantNameStandard.xml
new file mode 100644
index 00000000..6ef61b93
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/UpperCaseConstantNameStandard.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ FOO_CONSTANT', 'foo');
+
+class FooClass
+{
+ const FOO_CONSTANT = 'foo';
+}
+ ]]>
+
+
+ Foo_Constant', 'foo');
+
+class FooClass
+{
+ const foo_constant = 'foo';
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/BacktickOperatorStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/BacktickOperatorStandard.xml
new file mode 100644
index 00000000..4ebd6770
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/BacktickOperatorStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/CharacterBeforePHPOpeningTagStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/CharacterBeforePHPOpeningTagStandard.xml
new file mode 100644
index 00000000..df5a0eba
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/CharacterBeforePHPOpeningTagStandard.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+ Beginning content
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ClosingPHPTagStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ClosingPHPTagStandard.xml
new file mode 100644
index 00000000..09afb2d7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ClosingPHPTagStandard.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+echo 'Foo';
+?>
+ ]]>
+
+
+
+echo 'Foo';
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DeprecatedFunctionsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DeprecatedFunctionsStandard.xml
new file mode 100644
index 00000000..33b803a7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DeprecatedFunctionsStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ explode('a', $bar);
+ ]]>
+
+
+ split('a', $bar);
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowAlternativePHPTagsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowAlternativePHPTagsStandard.xml
new file mode 100644
index 00000000..bdfd5dc1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowAlternativePHPTagsStandard.xml
@@ -0,0 +1,7 @@
+
+
+ to delimit PHP code, do not use the ASP <% %> style tags nor the tags. This is the most portable way to include PHP code on differing operating systems and setups.
+ ]]>
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml
new file mode 100644
index 00000000..f9476942
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowShortOpenTagStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowShortOpenTagStandard.xml
new file mode 100644
index 00000000..8086ea27
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowShortOpenTagStandard.xml
@@ -0,0 +1,7 @@
+
+
+ to delimit PHP code, not the ?> shorthand. This is the most portable way to include PHP code on differing operating systems and setups.
+ ]]>
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DiscourageGotoStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DiscourageGotoStandard.xml
new file mode 100644
index 00000000..83bceef4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DiscourageGotoStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ForbiddenFunctionsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ForbiddenFunctionsStandard.xml
new file mode 100644
index 00000000..c0f18b55
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ForbiddenFunctionsStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ count($bar);
+ ]]>
+
+
+ sizeof($bar);
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseConstantStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseConstantStandard.xml
new file mode 100644
index 00000000..7dc30c10
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseConstantStandard.xml
@@ -0,0 +1,23 @@
+
+
+ true, false and null constants must always be lowercase.
+ ]]>
+
+
+
+ false || $var === null) {
+ $var = true;
+}
+ ]]>
+
+
+ FALSE || $var === NULL) {
+ $var = TRUE;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseKeywordStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseKeywordStandard.xml
new file mode 100644
index 00000000..965742d9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseKeywordStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ array();
+ ]]>
+
+
+ Array();
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseTypeStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseTypeStandard.xml
new file mode 100644
index 00000000..f38df3af
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/LowerCaseTypeStandard.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+ Int $foo) : STRING {
+}
+ ]]>
+
+
+
+
+
+
+
+
+
+
+ (BOOL) $isValid;
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/NoSilencedErrorsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/NoSilencedErrorsStandard.xml
new file mode 100644
index 00000000..df698879
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/NoSilencedErrorsStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ isset($foo) && $foo) {
+ echo "Hello\n";
+}
+ ]]>
+
+
+ @$foo) {
+ echo "Hello\n";
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/SAPIUsageStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/SAPIUsageStandard.xml
new file mode 100644
index 00000000..e74005ad
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/SAPIUsageStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ PHP_SAPI === 'cli') {
+ echo "Hello, CLI user.";
+}
+ ]]>
+
+
+ php_sapi_name() === 'cli') {
+ echo "Hello, CLI user.";
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/UpperCaseConstantStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/UpperCaseConstantStandard.xml
new file mode 100644
index 00000000..1f337f77
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/UpperCaseConstantStandard.xml
@@ -0,0 +1,23 @@
+
+
+ true, false and null constants must always be uppercase.
+ ]]>
+
+
+
+ FALSE || $var === NULL) {
+ $var = TRUE;
+}
+ ]]>
+
+
+ false || $var === null) {
+ $var = true;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Strings/UnnecessaryStringConcatStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Strings/UnnecessaryStringConcatStandard.xml
new file mode 100644
index 00000000..a4c9887b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Strings/UnnecessaryStringConcatStandard.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/VersionControl/SubversionPropertiesStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/VersionControl/SubversionPropertiesStandard.xml
new file mode 100644
index 00000000..f4f3e19c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/VersionControl/SubversionPropertiesStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ArbitraryParenthesesSpacingStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ArbitraryParenthesesSpacingStandard.xml
new file mode 100644
index 00000000..30e0def9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ArbitraryParenthesesSpacingStandard.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowSpaceIndentStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowSpaceIndentStandard.xml
new file mode 100644
index 00000000..2e399b34
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowSpaceIndentStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowTabIndentStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowTabIndentStandard.xml
new file mode 100644
index 00000000..7013ffd9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowTabIndentStandard.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ScopeIndentStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ScopeIndentStandard.xml
new file mode 100644
index 00000000..bdd36d49
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/ScopeIndentStandard.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ $var = 1;
+}
+ ]]>
+
+
+ $var = 1;
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/SpreadOperatorSpacingAfterStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/SpreadOperatorSpacingAfterStandard.xml
new file mode 100644
index 00000000..d33b6051
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/SpreadOperatorSpacingAfterStandard.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ &...$spread) {
+ bar(...$spread);
+
+ bar(
+ [...$foo],
+ ...array_values($keyedArray)
+ );
+}
+ ]]>
+
+
+ ... $spread) {
+ bar(...
+ $spread
+ );
+
+ bar(
+ [... $foo ],.../*comment*/array_values($keyedArray)
+ );
+}
+ ]]>
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/ArrayIndentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/ArrayIndentSniff.php
new file mode 100644
index 00000000..adb74ec8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/ArrayIndentSniff.php
@@ -0,0 +1,177 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays;
+
+use PHP_CodeSniffer\Sniffs\AbstractArraySniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class ArrayIndentSniff extends AbstractArraySniff
+{
+
+ /**
+ * The number of spaces each array key should be indented.
+ *
+ * @var integer
+ */
+ public $indent = 4;
+
+
+ /**
+ * Processes a single-line array definition.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $arrayStart The token that starts the array definition.
+ * @param int $arrayEnd The token that ends the array definition.
+ * @param array $indices An array of token positions for the array keys,
+ * double arrows, and values.
+ *
+ * @return void
+ */
+ public function processSingleLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices)
+ {
+
+ }//end processSingleLineArray()
+
+
+ /**
+ * Processes a multi-line array definition.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $arrayStart The token that starts the array definition.
+ * @param int $arrayEnd The token that ends the array definition.
+ * @param array $indices An array of token positions for the array keys,
+ * double arrows, and values.
+ *
+ * @return void
+ */
+ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $arrayEnd, $indices)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Determine how far indented the entire array declaration should be.
+ $ignore = Tokens::$emptyTokens;
+ $ignore[] = T_DOUBLE_ARROW;
+ $ignore[] = T_COMMA;
+ $prev = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
+ $start = $phpcsFile->findStartOfStatement($prev);
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $start, true);
+ $baseIndent = ($tokens[$first]['column'] - 1);
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $stackPtr, true);
+ $startIndent = ($tokens[$first]['column'] - 1);
+
+ // If the open brace is not indented to at least to the level of the start
+ // of the statement, the sniff will conflict with other sniffs trying to
+ // check indent levels because it's not valid. But we don't enforce exactly
+ // how far indented it should be.
+ if ($startIndent < $baseIndent) {
+ $error = 'Array open brace not indented correctly; expected at least %s spaces but found %s';
+ $data = [
+ $baseIndent,
+ $startIndent,
+ ];
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'OpenBraceIncorrect', $data);
+ if ($fix === true) {
+ $padding = str_repeat(' ', $baseIndent);
+ if ($startIndent === 0) {
+ $phpcsFile->fixer->addContentBefore($first, $padding);
+ } else {
+ $phpcsFile->fixer->replaceToken(($first - 1), $padding);
+ }
+ }
+
+ return;
+ }//end if
+
+ $expectedIndent = ($startIndent + $this->indent);
+
+ foreach ($indices as $index) {
+ if (isset($index['index_start']) === true) {
+ $start = $index['index_start'];
+ } else {
+ $start = $index['value_start'];
+ }
+
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($start - 1), null, true);
+ if ($tokens[$prev]['line'] === $tokens[$start]['line']) {
+ // This index isn't the only content on the line
+ // so we can't check indent rules.
+ continue;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $start, true);
+
+ $foundIndent = ($tokens[$first]['column'] - 1);
+ if ($foundIndent === $expectedIndent) {
+ continue;
+ }
+
+ $error = 'Array key not indented correctly; expected %s spaces but found %s';
+ $data = [
+ $expectedIndent,
+ $foundIndent,
+ ];
+ $fix = $phpcsFile->addFixableError($error, $first, 'KeyIncorrect', $data);
+ if ($fix === false) {
+ continue;
+ }
+
+ $padding = str_repeat(' ', $expectedIndent);
+ if ($foundIndent === 0) {
+ $phpcsFile->fixer->addContentBefore($first, $padding);
+ } else {
+ $phpcsFile->fixer->replaceToken(($first - 1), $padding);
+ }
+ }//end foreach
+
+ $prev = $phpcsFile->findPrevious(T_WHITESPACE, ($arrayEnd - 1), null, true);
+ if ($tokens[$prev]['line'] === $tokens[$arrayEnd]['line']) {
+ $error = 'Closing brace of array declaration must be on a new line';
+ $fix = $phpcsFile->addFixableError($error, $arrayEnd, 'CloseBraceNotNewLine');
+ if ($fix === true) {
+ $padding = $phpcsFile->eolChar.str_repeat(' ', $expectedIndent);
+ $phpcsFile->fixer->addContentBefore($arrayEnd, $padding);
+ }
+
+ return;
+ }
+
+ // The close brace must be indented one stop less.
+ $expectedIndent -= $this->indent;
+ $foundIndent = ($tokens[$arrayEnd]['column'] - 1);
+ if ($foundIndent === $expectedIndent) {
+ return;
+ }
+
+ $error = 'Array close brace not indented correctly; expected %s spaces but found %s';
+ $data = [
+ $expectedIndent,
+ $foundIndent,
+ ];
+ $fix = $phpcsFile->addFixableError($error, $arrayEnd, 'CloseBraceIncorrect', $data);
+ if ($fix === false) {
+ return;
+ }
+
+ $padding = str_repeat(' ', $expectedIndent);
+ if ($foundIndent === 0) {
+ $phpcsFile->fixer->addContentBefore($arrayEnd, $padding);
+ } else {
+ $phpcsFile->fixer->replaceToken(($arrayEnd - 1), $padding);
+ }
+
+ }//end processMultiLineArray()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php
new file mode 100644
index 00000000..bf7f3ed1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php
@@ -0,0 +1,78 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DisallowLongArraySyntaxSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_ARRAY];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'no');
+
+ $error = 'Short array syntax must be used to define arrays';
+
+ if (isset($tokens[$stackPtr]['parenthesis_opener']) === false
+ || isset($tokens[$stackPtr]['parenthesis_closer']) === false
+ ) {
+ // Live coding/parse error, just show the error, don't try and fix it.
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+ return;
+ }
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found');
+
+ if ($fix === true) {
+ $opener = $tokens[$stackPtr]['parenthesis_opener'];
+ $closer = $tokens[$stackPtr]['parenthesis_closer'];
+
+ $phpcsFile->fixer->beginChangeset();
+
+ if ($opener === null) {
+ $phpcsFile->fixer->replaceToken($stackPtr, '[]');
+ } else {
+ $phpcsFile->fixer->replaceToken($stackPtr, '');
+ $phpcsFile->fixer->replaceToken($opener, '[');
+ $phpcsFile->fixer->replaceToken($closer, ']');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php
new file mode 100644
index 00000000..2ba42d67
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowShortArraySyntaxSniff.php
@@ -0,0 +1,61 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DisallowShortArraySyntaxSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_SHORT_ARRAY];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'yes');
+
+ $error = 'Short array syntax is not allowed';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found');
+
+ if ($fix === true) {
+ $tokens = $phpcsFile->getTokens();
+ $opener = $tokens[$stackPtr]['bracket_opener'];
+ $closer = $tokens[$stackPtr]['bracket_closer'];
+
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->replaceToken($opener, 'array(');
+ $phpcsFile->fixer->replaceToken($closer, ')');
+ $phpcsFile->fixer->endChangeset();
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php
new file mode 100644
index 00000000..3243f8b7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php
@@ -0,0 +1,118 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Classes;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DuplicateClassNameSniff implements Sniff
+{
+
+ /**
+ * List of classes that have been found during checking.
+ *
+ * @var array
+ */
+ protected $foundClasses = [];
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $namespace = '';
+ $findTokens = [
+ T_CLASS,
+ T_INTERFACE,
+ T_TRAIT,
+ T_ENUM,
+ T_NAMESPACE,
+ T_CLOSE_TAG,
+ ];
+
+ $stackPtr = $phpcsFile->findNext($findTokens, ($stackPtr + 1));
+ while ($stackPtr !== false) {
+ if ($tokens[$stackPtr]['code'] === T_CLOSE_TAG) {
+ // We can stop here. The sniff will continue from the next open
+ // tag when PHPCS reaches that token, if there is one.
+ return;
+ }
+
+ // Keep track of what namespace we are in.
+ if ($tokens[$stackPtr]['code'] === T_NAMESPACE) {
+ $nsEnd = $phpcsFile->findNext(
+ [
+ T_NS_SEPARATOR,
+ T_STRING,
+ T_WHITESPACE,
+ ],
+ ($stackPtr + 1),
+ null,
+ true
+ );
+
+ $namespace = trim($phpcsFile->getTokensAsString(($stackPtr + 1), ($nsEnd - $stackPtr - 1)));
+ $stackPtr = $nsEnd;
+ } else {
+ $nameToken = $phpcsFile->findNext(T_STRING, $stackPtr);
+ $name = $tokens[$nameToken]['content'];
+ if ($namespace !== '') {
+ $name = $namespace.'\\'.$name;
+ }
+
+ $compareName = strtolower($name);
+ if (isset($this->foundClasses[$compareName]) === true) {
+ $type = strtolower($tokens[$stackPtr]['content']);
+ $file = $this->foundClasses[$compareName]['file'];
+ $line = $this->foundClasses[$compareName]['line'];
+ $error = 'Duplicate %s name "%s" found; first defined in %s on line %s';
+ $data = [
+ $type,
+ $name,
+ $file,
+ $line,
+ ];
+ $phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
+ } else {
+ $this->foundClasses[$compareName] = [
+ 'file' => $phpcsFile->getFilename(),
+ 'line' => $tokens[$stackPtr]['line'],
+ ];
+ }
+ }//end if
+
+ $stackPtr = $phpcsFile->findNext($findTokens, ($stackPtr + 1));
+ }//end while
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php
new file mode 100644
index 00000000..dfd925f9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php
@@ -0,0 +1,124 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Classes;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class OpeningBraceSameLineSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_CLASS,
+ T_INTERFACE,
+ T_TRAIT,
+ T_ENUM,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $scopeIdentifier = $phpcsFile->findNext(T_STRING, ($stackPtr + 1));
+ $errorData = [strtolower($tokens[$stackPtr]['content']).' '.$tokens[$scopeIdentifier]['content']];
+
+ if (isset($tokens[$stackPtr]['scope_opener']) === false) {
+ $error = 'Possible parse error: %s missing opening or closing brace';
+ $phpcsFile->addWarning($error, $stackPtr, 'MissingBrace', $errorData);
+ return;
+ }
+
+ $openingBrace = $tokens[$stackPtr]['scope_opener'];
+
+ // Is the brace on the same line as the class/interface/trait declaration ?
+ $lastClassLineToken = $phpcsFile->findPrevious(T_WHITESPACE, ($openingBrace - 1), $stackPtr, true);
+ $lastClassLine = $tokens[$lastClassLineToken]['line'];
+ $braceLine = $tokens[$openingBrace]['line'];
+ $lineDifference = ($braceLine - $lastClassLine);
+
+ if ($lineDifference > 0) {
+ $phpcsFile->recordMetric($stackPtr, 'Class opening brace placement', 'new line');
+ $error = 'Opening brace should be on the same line as the declaration for %s';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceOnNewLine', $errorData);
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->addContent($lastClassLineToken, ' {');
+ $phpcsFile->fixer->replaceToken($openingBrace, '');
+ $phpcsFile->fixer->endChangeset();
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Class opening brace placement', 'same line');
+ }
+
+ // Is the opening brace the last thing on the line ?
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($openingBrace + 1), null, true);
+ if ($tokens[$next]['line'] === $tokens[$openingBrace]['line']) {
+ if ($next === $tokens[$stackPtr]['scope_closer']) {
+ // Ignore empty classes.
+ return;
+ }
+
+ $error = 'Opening brace must be the last content on the line';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'ContentAfterBrace');
+ if ($fix === true) {
+ $phpcsFile->fixer->addNewline($openingBrace);
+ }
+ }
+
+ // Only continue checking if the opening brace looks good.
+ if ($lineDifference > 0) {
+ return;
+ }
+
+ // Is there precisely one space before the opening brace ?
+ if ($tokens[($openingBrace - 1)]['code'] !== T_WHITESPACE) {
+ $length = 0;
+ } else if ($tokens[($openingBrace - 1)]['content'] === "\t") {
+ $length = '\t';
+ } else {
+ $length = $tokens[($openingBrace - 1)]['length'];
+ }
+
+ if ($length !== 1) {
+ $error = 'Expected 1 space before opening brace; found %s';
+ $data = [$length];
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'SpaceBeforeBrace', $data);
+ if ($fix === true) {
+ if ($length === 0 || $length === '\t') {
+ $phpcsFile->fixer->addContentBefore($openingBrace, ' ');
+ } else {
+ $phpcsFile->fixer->replaceToken(($openingBrace - 1), ' ');
+ }
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php
new file mode 100644
index 00000000..8788a912
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php
@@ -0,0 +1,171 @@
+
+ * @copyright 2017 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class AssignmentInConditionSniff implements Sniff
+{
+
+ /**
+ * Assignment tokens to trigger on.
+ *
+ * Set in the register() method.
+ *
+ * @var array
+ */
+ protected $assignmentTokens = [];
+
+ /**
+ * The tokens that indicate the start of a condition.
+ *
+ * @var array
+ */
+ protected $conditionStartTokens = [];
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ $this->assignmentTokens = Tokens::$assignmentTokens;
+ unset($this->assignmentTokens[T_DOUBLE_ARROW]);
+
+ $starters = Tokens::$booleanOperators;
+ $starters[T_SEMICOLON] = T_SEMICOLON;
+ $starters[T_OPEN_PARENTHESIS] = T_OPEN_PARENTHESIS;
+
+ $this->conditionStartTokens = $starters;
+
+ return [
+ T_IF,
+ T_ELSEIF,
+ T_FOR,
+ T_SWITCH,
+ T_CASE,
+ T_WHILE,
+ T_MATCH,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Find the condition opener/closer.
+ if ($token['code'] === T_FOR) {
+ if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) {
+ return;
+ }
+
+ $semicolon = $phpcsFile->findNext(T_SEMICOLON, ($token['parenthesis_opener'] + 1), ($token['parenthesis_closer']));
+ if ($semicolon === false) {
+ return;
+ }
+
+ $opener = $semicolon;
+
+ $semicolon = $phpcsFile->findNext(T_SEMICOLON, ($opener + 1), ($token['parenthesis_closer']));
+ if ($semicolon === false) {
+ return;
+ }
+
+ $closer = $semicolon;
+ unset($semicolon);
+ } else if ($token['code'] === T_CASE) {
+ if (isset($token['scope_opener']) === false) {
+ return;
+ }
+
+ $opener = $stackPtr;
+ $closer = $token['scope_opener'];
+ } else {
+ if (isset($token['parenthesis_opener'], $token['parenthesis_closer']) === false) {
+ return;
+ }
+
+ $opener = $token['parenthesis_opener'];
+ $closer = $token['parenthesis_closer'];
+ }//end if
+
+ $startPos = $opener;
+
+ do {
+ $hasAssignment = $phpcsFile->findNext($this->assignmentTokens, ($startPos + 1), $closer);
+ if ($hasAssignment === false) {
+ return;
+ }
+
+ // Examine whether the left side is a variable.
+ $hasVariable = false;
+ $conditionStart = $startPos;
+ $altConditionStart = $phpcsFile->findPrevious($this->conditionStartTokens, ($hasAssignment - 1), $startPos);
+ if ($altConditionStart !== false) {
+ $conditionStart = $altConditionStart;
+ }
+
+ for ($i = $hasAssignment; $i > $conditionStart; $i--) {
+ if (isset(Tokens::$emptyTokens[$tokens[$i]['code']]) === true) {
+ continue;
+ }
+
+ // If this is a variable or array, we've seen all we need to see.
+ if ($tokens[$i]['code'] === T_VARIABLE || $tokens[$i]['code'] === T_CLOSE_SQUARE_BRACKET) {
+ $hasVariable = true;
+ break;
+ }
+
+ // If this is a function call or something, we are OK.
+ if ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS) {
+ break;
+ }
+ }
+
+ if ($hasVariable === true) {
+ $errorCode = 'Found';
+ if ($token['code'] === T_WHILE) {
+ $errorCode = 'FoundInWhileCondition';
+ }
+
+ $phpcsFile->addWarning(
+ 'Variable assignment found within a condition. Did you mean to do a comparison ?',
+ $hasAssignment,
+ $errorCode
+ );
+ }
+
+ $startPos = $hasAssignment;
+ } while ($startPos < $closer);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php
new file mode 100644
index 00000000..1c9e4000
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyPHPStatementSniff.php
@@ -0,0 +1,162 @@
+
+ * @copyright 2017 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class EmptyPHPStatementSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [
+ T_SEMICOLON,
+ T_CLOSE_TAG,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ switch ($tokens[$stackPtr]['type']) {
+ // Detect `something();;`.
+ case 'T_SEMICOLON':
+ $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
+
+ if ($prevNonEmpty === false) {
+ return;
+ }
+
+ if ($tokens[$prevNonEmpty]['code'] !== T_SEMICOLON
+ && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG
+ && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO
+ ) {
+ if (isset($tokens[$prevNonEmpty]['scope_condition']) === false) {
+ return;
+ }
+
+ if ($tokens[$prevNonEmpty]['scope_opener'] !== $prevNonEmpty
+ && $tokens[$prevNonEmpty]['code'] !== T_CLOSE_CURLY_BRACKET
+ ) {
+ return;
+ }
+
+ $scopeOwner = $tokens[$tokens[$prevNonEmpty]['scope_condition']]['code'];
+ if ($scopeOwner === T_CLOSURE || $scopeOwner === T_ANON_CLASS || $scopeOwner === T_MATCH) {
+ return;
+ }
+
+ // Else, it's something like `if (foo) {};` and the semi-colon is not needed.
+ }
+
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
+ $nested = $tokens[$stackPtr]['nested_parenthesis'];
+ $lastCloser = array_pop($nested);
+ if (isset($tokens[$lastCloser]['parenthesis_owner']) === true
+ && $tokens[$tokens[$lastCloser]['parenthesis_owner']]['code'] === T_FOR
+ ) {
+ // Empty for() condition.
+ return;
+ }
+ }
+
+ $fix = $phpcsFile->addFixableWarning(
+ 'Empty PHP statement detected: superfluous semi-colon.',
+ $stackPtr,
+ 'SemicolonWithoutCodeDetected'
+ );
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+
+ if ($tokens[$prevNonEmpty]['code'] === T_OPEN_TAG
+ || $tokens[$prevNonEmpty]['code'] === T_OPEN_TAG_WITH_ECHO
+ ) {
+ // Check for superfluous whitespace after the semi-colon which will be
+ // removed as the `fixer->replaceToken(($stackPtr + 1), $replacement);
+ }
+ }
+
+ for ($i = $stackPtr; $i > $prevNonEmpty; $i--) {
+ if ($tokens[$i]['code'] !== T_SEMICOLON
+ && $tokens[$i]['code'] !== T_WHITESPACE
+ ) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }//end if
+ break;
+
+ // Detect ``.
+ case 'T_CLOSE_TAG':
+ $prevNonEmpty = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
+
+ if ($prevNonEmpty === false
+ || ($tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG
+ && $tokens[$prevNonEmpty]['code'] !== T_OPEN_TAG_WITH_ECHO)
+ ) {
+ return;
+ }
+
+ $fix = $phpcsFile->addFixableWarning(
+ 'Empty PHP open/close tag combination detected.',
+ $prevNonEmpty,
+ 'EmptyPHPOpenCloseTagsDetected'
+ );
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+
+ for ($i = $prevNonEmpty; $i <= $stackPtr; $i++) {
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ break;
+
+ default:
+ // Deliberately left empty.
+ break;
+ }//end switch
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php
new file mode 100644
index 00000000..574bb0ba
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php
@@ -0,0 +1,97 @@
+
+ * stmt {
+ * // foo
+ * }
+ * stmt (conditions) {
+ * // foo
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @author Greg Sherwood
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class EmptyStatementSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [
+ T_TRY,
+ T_CATCH,
+ T_FINALLY,
+ T_DO,
+ T_ELSE,
+ T_ELSEIF,
+ T_FOR,
+ T_FOREACH,
+ T_IF,
+ T_SWITCH,
+ T_WHILE,
+ T_MATCH,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip statements without a body.
+ if (isset($token['scope_opener']) === false) {
+ return;
+ }
+
+ $next = $phpcsFile->findNext(
+ Tokens::$emptyTokens,
+ ($token['scope_opener'] + 1),
+ ($token['scope_closer'] - 1),
+ true
+ );
+
+ if ($next !== false) {
+ return;
+ }
+
+ // Get token identifier.
+ $name = strtoupper($token['content']);
+ $error = 'Empty %s statement detected';
+ $phpcsFile->addError($error, $stackPtr, 'Detected'.ucfirst(strtolower($name)), [$name]);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php
new file mode 100644
index 00000000..f583e938
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php
@@ -0,0 +1,91 @@
+
+ * class Foo
+ * {
+ * public function bar($x)
+ * {
+ * for (;true;) true; // No Init or Update part, may as well be: while (true)
+ * }
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class ForLoopShouldBeWhileLoopSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_FOR];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip invalid statement.
+ if (isset($token['parenthesis_opener']) === false) {
+ return;
+ }
+
+ $next = ++$token['parenthesis_opener'];
+ $end = --$token['parenthesis_closer'];
+
+ $parts = [
+ 0,
+ 0,
+ 0,
+ ];
+ $index = 0;
+
+ for (; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+ if ($code === T_SEMICOLON) {
+ ++$index;
+ } else if (isset(Tokens::$emptyTokens[$code]) === false) {
+ ++$parts[$index];
+ }
+ }
+
+ if ($parts[0] === 0 && $parts[2] === 0 && $parts[1] > 0) {
+ $error = 'This FOR loop can be simplified to a WHILE loop';
+ $phpcsFile->addWarning($error, $stackPtr, 'CanSimplify');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopWithTestFunctionCallSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopWithTestFunctionCallSniff.php
new file mode 100644
index 00000000..62a07b26
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/ForLoopWithTestFunctionCallSniff.php
@@ -0,0 +1,101 @@
+
+ * class Foo
+ * {
+ * public function bar($x)
+ * {
+ * $a = array(1, 2, 3, 4);
+ * for ($i = 0; $i < count($a); $i++) {
+ * $a[$i] *= $i;
+ * }
+ * }
+ * }
+ *
+ *
+ * @author Greg Sherwood
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class ForLoopWithTestFunctionCallSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_FOR];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip invalid statement.
+ if (isset($token['parenthesis_opener']) === false) {
+ return;
+ }
+
+ $next = ++$token['parenthesis_opener'];
+ $end = --$token['parenthesis_closer'];
+
+ $position = 0;
+
+ for (; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+ if ($code === T_SEMICOLON) {
+ ++$position;
+ }
+
+ if ($position < 1) {
+ continue;
+ } else if ($position > 1) {
+ break;
+ } else if ($code !== T_VARIABLE && $code !== T_STRING) {
+ continue;
+ }
+
+ // Find next non empty token, if it is a open curly brace we have a
+ // function call.
+ $index = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+
+ if ($tokens[$index]['code'] === T_OPEN_PARENTHESIS) {
+ $error = 'Avoid function calls in a FOR loop test part';
+ $phpcsFile->addWarning($error, $stackPtr, 'NotAllowed');
+ break;
+ }
+ }//end for
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php
new file mode 100644
index 00000000..364658db
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php
@@ -0,0 +1,134 @@
+
+ * class Foo
+ * {
+ * public function bar($x)
+ * {
+ * for ($i = 0; $i < 10; $i++)
+ * {
+ * for ($k = 0; $k < 20; $i++)
+ * {
+ * echo 'Hello';
+ * }
+ * }
+ * }
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class JumbledIncrementerSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_FOR];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip for-loop without body.
+ if (isset($token['scope_opener']) === false) {
+ return;
+ }
+
+ // Find incrementors for outer loop.
+ $outer = $this->findIncrementers($tokens, $token);
+
+ // Skip if empty.
+ if (count($outer) === 0) {
+ return;
+ }
+
+ // Find nested for loops.
+ $start = ++$token['scope_opener'];
+ $end = --$token['scope_closer'];
+
+ for (; $start <= $end; ++$start) {
+ if ($tokens[$start]['code'] !== T_FOR) {
+ continue;
+ }
+
+ $inner = $this->findIncrementers($tokens, $tokens[$start]);
+ $diff = array_intersect($outer, $inner);
+
+ if (count($diff) !== 0) {
+ $error = 'Loop incrementor (%s) jumbling with inner loop';
+ $data = [join(', ', $diff)];
+ $phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
+ }
+ }
+
+ }//end process()
+
+
+ /**
+ * Get all used variables in the incrementer part of a for statement.
+ *
+ * @param array(integer=>array) $tokens Array with all code sniffer tokens.
+ * @param array(string=>mixed) $token Current for loop token
+ *
+ * @return string[] List of all found incrementer variables.
+ */
+ protected function findIncrementers(array $tokens, array $token)
+ {
+ // Skip invalid statement.
+ if (isset($token['parenthesis_opener']) === false) {
+ return [];
+ }
+
+ $start = ++$token['parenthesis_opener'];
+ $end = --$token['parenthesis_closer'];
+
+ $incrementers = [];
+ $semicolons = 0;
+ for ($next = $start; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+ if ($code === T_SEMICOLON) {
+ ++$semicolons;
+ } else if ($semicolons === 2 && $code === T_VARIABLE) {
+ $incrementers[] = $tokens[$next]['content'];
+ }
+ }
+
+ return $incrementers;
+
+ }//end findIncrementers()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php
new file mode 100644
index 00000000..cc9958c5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php
@@ -0,0 +1,93 @@
+true or false
+ *
+ *
+ * class Foo
+ * {
+ * public function close()
+ * {
+ * if (true)
+ * {
+ * // ...
+ * }
+ * }
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UnconditionalIfStatementSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [
+ T_IF,
+ T_ELSEIF,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip if statement without body.
+ if (isset($token['parenthesis_opener']) === false) {
+ return;
+ }
+
+ $next = ++$token['parenthesis_opener'];
+ $end = --$token['parenthesis_closer'];
+
+ $goodCondition = false;
+ for (; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+
+ if (isset(Tokens::$emptyTokens[$code]) === true) {
+ continue;
+ } else if ($code !== T_TRUE && $code !== T_FALSE) {
+ $goodCondition = true;
+ }
+ }
+
+ if ($goodCondition === false) {
+ $error = 'Avoid IF statements that are always true or false';
+ $phpcsFile->addWarning($error, $stackPtr, 'Found');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php
new file mode 100644
index 00000000..bed67c93
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php
@@ -0,0 +1,85 @@
+
+ * final class Foo
+ * {
+ * public final function bar()
+ * {
+ * }
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UnnecessaryFinalModifierSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_CLASS];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip for-statements without body.
+ if (isset($token['scope_opener']) === false) {
+ return;
+ }
+
+ // Fetch previous token.
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
+
+ // Skip for non final class.
+ if ($prev === false || $tokens[$prev]['code'] !== T_FINAL) {
+ return;
+ }
+
+ $next = ++$token['scope_opener'];
+ $end = --$token['scope_closer'];
+
+ for (; $next <= $end; ++$next) {
+ if ($tokens[$next]['code'] === T_FINAL) {
+ $error = 'Unnecessary FINAL modifier in FINAL class';
+ $phpcsFile->addWarning($error, $next, 'Found');
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
new file mode 100644
index 00000000..58aa29fe
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
@@ -0,0 +1,265 @@
+
+ * @author Greg Sherwood
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UnusedFunctionParameterSniff implements Sniff
+{
+
+ /**
+ * The list of class type hints which will be ignored.
+ *
+ * @var array
+ */
+ public $ignoreTypeHints = [];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_FUNCTION,
+ T_CLOSURE,
+ T_FN,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip broken function declarations.
+ if (isset($token['scope_opener']) === false || isset($token['parenthesis_opener']) === false) {
+ return;
+ }
+
+ $errorCode = 'Found';
+ $implements = false;
+ $extends = false;
+ $classPtr = $phpcsFile->getCondition($stackPtr, T_CLASS);
+ if ($classPtr !== false) {
+ $implements = $phpcsFile->findImplementedInterfaceNames($classPtr);
+ $extends = $phpcsFile->findExtendedClassName($classPtr);
+ if ($extends !== false) {
+ $errorCode .= 'InExtendedClass';
+ } else if ($implements !== false) {
+ $errorCode .= 'InImplementedInterface';
+ }
+ }
+
+ $params = [];
+ $methodParams = $phpcsFile->getMethodParameters($stackPtr);
+
+ // Skip when no parameters found.
+ $methodParamsCount = count($methodParams);
+ if ($methodParamsCount === 0) {
+ return;
+ }
+
+ foreach ($methodParams as $param) {
+ if (isset($param['property_visibility']) === true) {
+ // Ignore constructor property promotion.
+ continue;
+ }
+
+ $params[$param['name']] = $stackPtr;
+ }
+
+ $next = ++$token['scope_opener'];
+ $end = --$token['scope_closer'];
+
+ // Check the end token for arrow functions as
+ // they can end at a content token due to not having
+ // a clearly defined closing token.
+ if ($token['code'] === T_FN) {
+ ++$end;
+ }
+
+ $foundContent = false;
+ $validTokens = [
+ T_HEREDOC => T_HEREDOC,
+ T_NOWDOC => T_NOWDOC,
+ T_END_HEREDOC => T_END_HEREDOC,
+ T_END_NOWDOC => T_END_NOWDOC,
+ T_DOUBLE_QUOTED_STRING => T_DOUBLE_QUOTED_STRING,
+ ];
+ $validTokens += Tokens::$emptyTokens;
+
+ for (; $next <= $end; ++$next) {
+ $token = $tokens[$next];
+ $code = $token['code'];
+
+ // Ignorable tokens.
+ if (isset(Tokens::$emptyTokens[$code]) === true) {
+ continue;
+ }
+
+ if ($foundContent === false) {
+ // A throw statement as the first content indicates an interface method.
+ if ($code === T_THROW && $implements !== false) {
+ return;
+ }
+
+ // A return statement as the first content indicates an interface method.
+ if ($code === T_RETURN) {
+ $tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+ if ($tmp === false && $implements !== false) {
+ return;
+ }
+
+ // There is a return.
+ if ($tokens[$tmp]['code'] === T_SEMICOLON && $implements !== false) {
+ return;
+ }
+
+ $tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($tmp + 1), null, true);
+ if ($tmp !== false && $tokens[$tmp]['code'] === T_SEMICOLON && $implements !== false) {
+ // There is a return .
+ return;
+ }
+ }//end if
+ }//end if
+
+ $foundContent = true;
+
+ if ($code === T_VARIABLE && isset($params[$token['content']]) === true) {
+ unset($params[$token['content']]);
+ } else if ($code === T_DOLLAR) {
+ $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($next + 1), null, true);
+ if ($tokens[$nextToken]['code'] === T_OPEN_CURLY_BRACKET) {
+ $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($nextToken + 1), null, true);
+ if ($tokens[$nextToken]['code'] === T_STRING) {
+ $varContent = '$'.$tokens[$nextToken]['content'];
+ if (isset($params[$varContent]) === true) {
+ unset($params[$varContent]);
+ }
+ }
+ }
+ } else if ($code === T_DOUBLE_QUOTED_STRING
+ || $code === T_START_HEREDOC
+ || $code === T_START_NOWDOC
+ ) {
+ // Tokenize strings that can contain variables.
+ // Make sure the string is re-joined if it occurs over multiple lines.
+ $content = $token['content'];
+ for ($i = ($next + 1); $i <= $end; $i++) {
+ if (isset($validTokens[$tokens[$i]['code']]) === true) {
+ $content .= $tokens[$i]['content'];
+ $next++;
+ } else {
+ break;
+ }
+ }
+
+ $stringTokens = token_get_all(sprintf('', $content));
+ foreach ($stringTokens as $stringPtr => $stringToken) {
+ if (is_array($stringToken) === false) {
+ continue;
+ }
+
+ $varContent = '';
+ if ($stringToken[0] === T_DOLLAR_OPEN_CURLY_BRACES) {
+ $varContent = '$'.$stringTokens[($stringPtr + 1)][1];
+ } else if ($stringToken[0] === T_VARIABLE) {
+ $varContent = $stringToken[1];
+ }
+
+ if ($varContent !== '' && isset($params[$varContent]) === true) {
+ unset($params[$varContent]);
+ }
+ }
+ }//end if
+ }//end for
+
+ if ($foundContent === true && count($params) > 0) {
+ $error = 'The method parameter %s is never used';
+
+ // If there is only one parameter and it is unused, no need for additional errorcode toggling logic.
+ if ($methodParamsCount === 1) {
+ foreach ($params as $paramName => $position) {
+ if (in_array($methodParams[0]['type_hint'], $this->ignoreTypeHints, true) === true) {
+ continue;
+ }
+
+ $data = [$paramName];
+ $phpcsFile->addWarning($error, $position, $errorCode, $data);
+ }
+
+ return;
+ }
+
+ $foundLastUsed = false;
+ $lastIndex = ($methodParamsCount - 1);
+ $errorInfo = [];
+ for ($i = $lastIndex; $i >= 0; --$i) {
+ if ($foundLastUsed !== false) {
+ if (isset($params[$methodParams[$i]['name']]) === true) {
+ $errorInfo[$methodParams[$i]['name']] = [
+ 'position' => $params[$methodParams[$i]['name']],
+ 'errorcode' => $errorCode.'BeforeLastUsed',
+ 'typehint' => $methodParams[$i]['type_hint'],
+ ];
+ }
+ } else {
+ if (isset($params[$methodParams[$i]['name']]) === false) {
+ $foundLastUsed = true;
+ } else {
+ $errorInfo[$methodParams[$i]['name']] = [
+ 'position' => $params[$methodParams[$i]['name']],
+ 'errorcode' => $errorCode.'AfterLastUsed',
+ 'typehint' => $methodParams[$i]['type_hint'],
+ ];
+ }
+ }
+ }//end for
+
+ if (count($errorInfo) > 0) {
+ $errorInfo = array_reverse($errorInfo);
+ foreach ($errorInfo as $paramName => $info) {
+ if (in_array($info['typehint'], $this->ignoreTypeHints, true) === true) {
+ continue;
+ }
+
+ $data = [$paramName];
+ $phpcsFile->addWarning($error, $info['position'], $info['errorcode'], $data);
+ }
+ }
+ }//end if
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php
new file mode 100644
index 00000000..fded9295
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php
@@ -0,0 +1,161 @@
+
+ * class FooBar {
+ * public function __construct($a, $b) {
+ * parent::__construct($a, $b);
+ * }
+ * }
+ *
+ *
+ * @author Manuel Pichler
+ * @copyright 2007-2014 Manuel Pichler. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UselessOverridingMethodSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_FUNCTION];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $token = $tokens[$stackPtr];
+
+ // Skip function without body.
+ if (isset($token['scope_opener']) === false) {
+ return;
+ }
+
+ // Get function name.
+ $methodName = $phpcsFile->getDeclarationName($stackPtr);
+
+ // Get all parameters from method signature.
+ $signature = [];
+ foreach ($phpcsFile->getMethodParameters($stackPtr) as $param) {
+ $signature[] = $param['name'];
+ }
+
+ $next = ++$token['scope_opener'];
+ $end = --$token['scope_closer'];
+
+ for (; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+
+ if (isset(Tokens::$emptyTokens[$code]) === true) {
+ continue;
+ } else if ($code === T_RETURN) {
+ continue;
+ }
+
+ break;
+ }
+
+ // Any token except 'parent' indicates correct code.
+ if ($tokens[$next]['code'] !== T_PARENT) {
+ return;
+ }
+
+ // Find next non empty token index, should be double colon.
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+
+ // Skip for invalid code.
+ if ($next === false || $tokens[$next]['code'] !== T_DOUBLE_COLON) {
+ return;
+ }
+
+ // Find next non empty token index, should be the function name.
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+
+ // Skip for invalid code or other method.
+ if ($next === false || $tokens[$next]['content'] !== $methodName) {
+ return;
+ }
+
+ // Find next non empty token index, should be the open parenthesis.
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+
+ // Skip for invalid code.
+ if ($next === false || $tokens[$next]['code'] !== T_OPEN_PARENTHESIS) {
+ return;
+ }
+
+ $parameters = [''];
+ $parenthesisCount = 1;
+ $count = count($tokens);
+ for (++$next; $next < $count; ++$next) {
+ $code = $tokens[$next]['code'];
+
+ if ($code === T_OPEN_PARENTHESIS) {
+ ++$parenthesisCount;
+ } else if ($code === T_CLOSE_PARENTHESIS) {
+ --$parenthesisCount;
+ } else if ($parenthesisCount === 1 && $code === T_COMMA) {
+ $parameters[] = '';
+ } else if (isset(Tokens::$emptyTokens[$code]) === false) {
+ $parameters[(count($parameters) - 1)] .= $tokens[$next]['content'];
+ }
+
+ if ($parenthesisCount === 0) {
+ break;
+ }
+ }//end for
+
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($next + 1), null, true);
+ if ($next === false || $tokens[$next]['code'] !== T_SEMICOLON) {
+ return;
+ }
+
+ // Check rest of the scope.
+ for (++$next; $next <= $end; ++$next) {
+ $code = $tokens[$next]['code'];
+ // Skip for any other content.
+ if (isset(Tokens::$emptyTokens[$code]) === false) {
+ return;
+ }
+ }
+
+ $parameters = array_map('trim', $parameters);
+ $parameters = array_filter($parameters);
+
+ if (count($parameters) === count($signature) && $parameters === $signature) {
+ $phpcsFile->addWarning('Possible useless method overriding detected', $stackPtr, 'Found');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/DocCommentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/DocCommentSniff.php
new file mode 100644
index 00000000..545319be
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/DocCommentSniff.php
@@ -0,0 +1,353 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DocCommentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_DOC_COMMENT_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if (isset($tokens[$stackPtr]['comment_closer']) === false
+ || ($tokens[$tokens[$stackPtr]['comment_closer']]['content'] === ''
+ && $tokens[$stackPtr]['comment_closer'] === ($phpcsFile->numTokens - 1))
+ ) {
+ // Don't process an unfinished comment during live coding.
+ return;
+ }
+
+ $commentStart = $stackPtr;
+ $commentEnd = $tokens[$stackPtr]['comment_closer'];
+
+ $empty = [
+ T_DOC_COMMENT_WHITESPACE,
+ T_DOC_COMMENT_STAR,
+ ];
+
+ $short = $phpcsFile->findNext($empty, ($stackPtr + 1), $commentEnd, true);
+ if ($short === false) {
+ // No content at all.
+ $error = 'Doc comment is empty';
+ $phpcsFile->addError($error, $stackPtr, 'Empty');
+ return;
+ }
+
+ // The first line of the comment should just be the /** code.
+ if ($tokens[$short]['line'] === $tokens[$stackPtr]['line']) {
+ $error = 'The open comment tag must be the only content on the line';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'ContentAfterOpen');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->addNewline($stackPtr);
+ $phpcsFile->fixer->addContentBefore($short, '* ');
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ // The last line of the comment should just be the */ code.
+ $prev = $phpcsFile->findPrevious($empty, ($commentEnd - 1), $stackPtr, true);
+ if ($tokens[$prev]['line'] === $tokens[$commentEnd]['line']) {
+ $error = 'The close comment tag must be the only content on the line';
+ $fix = $phpcsFile->addFixableError($error, $commentEnd, 'ContentBeforeClose');
+ if ($fix === true) {
+ $phpcsFile->fixer->addNewlineBefore($commentEnd);
+ }
+ }
+
+ // Check for additional blank lines at the end of the comment.
+ if ($tokens[$prev]['line'] < ($tokens[$commentEnd]['line'] - 1)) {
+ $error = 'Additional blank lines found at end of doc comment';
+ $fix = $phpcsFile->addFixableError($error, $commentEnd, 'SpacingAfter');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = ($prev + 1); $i < $commentEnd; $i++) {
+ if ($tokens[($i + 1)]['line'] === $tokens[$commentEnd]['line']) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ // Check for a comment description.
+ if ($tokens[$short]['code'] !== T_DOC_COMMENT_STRING) {
+ $error = 'Missing short description in doc comment';
+ $phpcsFile->addError($error, $stackPtr, 'MissingShort');
+ } else {
+ // No extra newline before short description.
+ if ($tokens[$short]['line'] !== ($tokens[$stackPtr]['line'] + 1)) {
+ $error = 'Doc comment short description must be on the first line';
+ $fix = $phpcsFile->addFixableError($error, $short, 'SpacingBeforeShort');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = $stackPtr; $i < $short; $i++) {
+ if ($tokens[$i]['line'] === $tokens[$stackPtr]['line']) {
+ continue;
+ } else if ($tokens[$i]['line'] === $tokens[$short]['line']) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ // Account for the fact that a short description might cover
+ // multiple lines.
+ $shortContent = $tokens[$short]['content'];
+ $shortEnd = $short;
+ for ($i = ($short + 1); $i < $commentEnd; $i++) {
+ if ($tokens[$i]['code'] === T_DOC_COMMENT_STRING) {
+ if ($tokens[$i]['line'] === ($tokens[$shortEnd]['line'] + 1)) {
+ $shortContent .= $tokens[$i]['content'];
+ $shortEnd = $i;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (preg_match('/^\p{Ll}/u', $shortContent) === 1) {
+ $error = 'Doc comment short description must start with a capital letter';
+ $phpcsFile->addError($error, $short, 'ShortNotCapital');
+ }
+
+ $long = $phpcsFile->findNext($empty, ($shortEnd + 1), ($commentEnd - 1), true);
+ if ($long !== false && $tokens[$long]['code'] === T_DOC_COMMENT_STRING) {
+ if ($tokens[$long]['line'] !== ($tokens[$shortEnd]['line'] + 2)) {
+ $error = 'There must be exactly one blank line between descriptions in a doc comment';
+ $fix = $phpcsFile->addFixableError($error, $long, 'SpacingBetween');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = ($shortEnd + 1); $i < $long; $i++) {
+ if ($tokens[$i]['line'] === $tokens[$shortEnd]['line']) {
+ continue;
+ } else if ($tokens[$i]['line'] === ($tokens[$long]['line'] - 1)) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ if (preg_match('/^\p{Ll}/u', $tokens[$long]['content']) === 1) {
+ $error = 'Doc comment long description must start with a capital letter';
+ $phpcsFile->addError($error, $long, 'LongNotCapital');
+ }
+ }//end if
+ }//end if
+
+ if (empty($tokens[$commentStart]['comment_tags']) === true) {
+ // No tags in the comment.
+ return;
+ }
+
+ $firstTag = $tokens[$commentStart]['comment_tags'][0];
+ $prev = $phpcsFile->findPrevious($empty, ($firstTag - 1), $stackPtr, true);
+ if ($tokens[$firstTag]['line'] !== ($tokens[$prev]['line'] + 2)
+ && $tokens[$prev]['code'] !== T_DOC_COMMENT_OPEN_TAG
+ ) {
+ $error = 'There must be exactly one blank line before the tags in a doc comment';
+ $fix = $phpcsFile->addFixableError($error, $firstTag, 'SpacingBeforeTags');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = ($prev + 1); $i < $firstTag; $i++) {
+ if ($tokens[$i]['line'] === $tokens[$firstTag]['line']) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $indent = str_repeat(' ', $tokens[$stackPtr]['column']);
+ $phpcsFile->fixer->addContent($prev, $phpcsFile->eolChar.$indent.'*'.$phpcsFile->eolChar);
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ // Break out the tags into groups and check alignment within each.
+ // A tag group is one where there are no blank lines between tags.
+ // The param tag group is special as it requires all @param tags to be inside.
+ $tagGroups = [];
+ $groupid = 0;
+ $paramGroupid = null;
+ foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
+ if ($pos > 0) {
+ $prev = $phpcsFile->findPrevious(
+ T_DOC_COMMENT_STRING,
+ ($tag - 1),
+ $tokens[$commentStart]['comment_tags'][($pos - 1)]
+ );
+
+ if ($prev === false) {
+ $prev = $tokens[$commentStart]['comment_tags'][($pos - 1)];
+ }
+
+ if ($tokens[$prev]['line'] !== ($tokens[$tag]['line'] - 1)) {
+ $groupid++;
+ }
+ }
+
+ if ($tokens[$tag]['content'] === '@param') {
+ if ($paramGroupid !== null
+ && $paramGroupid !== $groupid
+ ) {
+ $error = 'Parameter tags must be grouped together in a doc comment';
+ $phpcsFile->addError($error, $tag, 'ParamGroup');
+ }
+
+ if ($paramGroupid === null) {
+ $paramGroupid = $groupid;
+ }
+ }//end if
+
+ $tagGroups[$groupid][] = $tag;
+ }//end foreach
+
+ foreach ($tagGroups as $groupid => $group) {
+ $maxLength = 0;
+ $paddings = [];
+ foreach ($group as $pos => $tag) {
+ if ($paramGroupid === $groupid
+ && $tokens[$tag]['content'] !== '@param'
+ ) {
+ $error = 'Tag %s cannot be grouped with parameter tags in a doc comment';
+ $data = [$tokens[$tag]['content']];
+ $phpcsFile->addError($error, $tag, 'NonParamGroup', $data);
+ }
+
+ $tagLength = $tokens[$tag]['length'];
+ if ($tagLength > $maxLength) {
+ $maxLength = $tagLength;
+ }
+
+ // Check for a value. No value means no padding needed.
+ $string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd);
+ if ($string !== false && $tokens[$string]['line'] === $tokens[$tag]['line']) {
+ $paddings[$tag] = $tokens[($tag + 1)]['length'];
+ }
+ }
+
+ // Check that there was single blank line after the tag block
+ // but account for a multi-line tag comments.
+ $lastTag = $group[$pos];
+ $next = $phpcsFile->findNext(T_DOC_COMMENT_TAG, ($lastTag + 3), $commentEnd);
+ if ($next !== false) {
+ $prev = $phpcsFile->findPrevious([T_DOC_COMMENT_TAG, T_DOC_COMMENT_STRING], ($next - 1), $commentStart);
+ if ($tokens[$next]['line'] !== ($tokens[$prev]['line'] + 2)) {
+ $error = 'There must be a single blank line after a tag group';
+ $fix = $phpcsFile->addFixableError($error, $lastTag, 'SpacingAfterTagGroup');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = ($prev + 1); $i < $next; $i++) {
+ if ($tokens[$i]['line'] === $tokens[$next]['line']) {
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $indent = str_repeat(' ', $tokens[$stackPtr]['column']);
+ $phpcsFile->fixer->addContent($prev, $phpcsFile->eolChar.$indent.'*'.$phpcsFile->eolChar);
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+ }//end if
+
+ // Now check paddings.
+ foreach ($paddings as $tag => $padding) {
+ $required = ($maxLength - $tokens[$tag]['length'] + 1);
+
+ if ($padding !== $required) {
+ $error = 'Tag value for %s tag indented incorrectly; expected %s spaces but found %s';
+ $data = [
+ $tokens[$tag]['content'],
+ $required,
+ $padding,
+ ];
+
+ $fix = $phpcsFile->addFixableError($error, ($tag + 1), 'TagValueIndent', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($tag + 1), str_repeat(' ', $required));
+ }
+ }
+ }
+ }//end foreach
+
+ // If there is a param group, it needs to be first.
+ if ($paramGroupid !== null && $paramGroupid !== 0) {
+ $error = 'Parameter tags must be defined first in a doc comment';
+ $phpcsFile->addError($error, $tagGroups[$paramGroupid][0], 'ParamNotFirst');
+ }
+
+ $foundTags = [];
+ foreach ($tokens[$stackPtr]['comment_tags'] as $pos => $tag) {
+ $tagName = $tokens[$tag]['content'];
+ if (isset($foundTags[$tagName]) === true) {
+ $lastTag = $tokens[$stackPtr]['comment_tags'][($pos - 1)];
+ if ($tokens[$lastTag]['content'] !== $tagName) {
+ $error = 'Tags must be grouped together in a doc comment';
+ $phpcsFile->addError($error, $tag, 'TagsNotGrouped');
+ }
+
+ continue;
+ }
+
+ $foundTags[$tagName] = true;
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php
new file mode 100644
index 00000000..84385221
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/FixmeSniff.php
@@ -0,0 +1,78 @@
+
+ * @author Sam Graham
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class FixmeSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $content = $tokens[$stackPtr]['content'];
+ $matches = [];
+ preg_match('/(?:\A|[^\p{L}]+)fixme([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
+ if (empty($matches) === false) {
+ // Clear whitespace and some common characters not required at
+ // the end of a fixme message to make the error more informative.
+ $type = 'CommentFound';
+ $fixmeMessage = trim($matches[1]);
+ $fixmeMessage = trim($fixmeMessage, '-:[](). ');
+ $error = 'Comment refers to a FIXME task';
+ $data = [$fixmeMessage];
+ if ($fixmeMessage !== '') {
+ $type = 'TaskFound';
+ $error .= ' "%s"';
+ }
+
+ $phpcsFile->addError($error, $stackPtr, $type, $data);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/TodoSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/TodoSniff.php
new file mode 100644
index 00000000..63968046
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/TodoSniff.php
@@ -0,0 +1,77 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Commenting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class TodoSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array_diff(Tokens::$commentTokens, Tokens::$phpcsCommentTokens);
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $content = $tokens[$stackPtr]['content'];
+ $matches = [];
+ preg_match('/(?:\A|[^\p{L}]+)todo([^\p{L}]+(.*)|\Z)/ui', $content, $matches);
+ if (empty($matches) === false) {
+ // Clear whitespace and some common characters not required at
+ // the end of a to-do message to make the warning more informative.
+ $type = 'CommentFound';
+ $todoMessage = trim($matches[1]);
+ $todoMessage = trim($todoMessage, '-:[](). ');
+ $error = 'Comment refers to a TODO task';
+ $data = [$todoMessage];
+ if ($todoMessage !== '') {
+ $type = 'TaskFound';
+ $error .= ' "%s"';
+ }
+
+ $phpcsFile->addWarning($error, $stackPtr, $type, $data);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php
new file mode 100644
index 00000000..f760fa1c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php
@@ -0,0 +1,188 @@
+
+ * @author Mark Scherer
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class DisallowYodaConditionsSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$comparisonTokens;
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $previousIndex = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
+ $relevantTokens = [
+ T_CLOSE_SHORT_ARRAY,
+ T_CLOSE_PARENTHESIS,
+ T_TRUE,
+ T_FALSE,
+ T_NULL,
+ T_LNUMBER,
+ T_DNUMBER,
+ T_CONSTANT_ENCAPSED_STRING,
+ ];
+
+ if ($previousIndex === false
+ || in_array($tokens[$previousIndex]['code'], $relevantTokens, true) === false
+ ) {
+ return;
+ }
+
+ if ($tokens[$previousIndex]['code'] === T_CLOSE_SHORT_ARRAY) {
+ $previousIndex = $tokens[$previousIndex]['bracket_opener'];
+ if ($this->isArrayStatic($phpcsFile, $previousIndex) === false) {
+ return;
+ }
+ }
+
+ $prevIndex = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($previousIndex - 1), null, true);
+ if ($prevIndex === false) {
+ return;
+ }
+
+ if (in_array($tokens[$prevIndex]['code'], Tokens::$arithmeticTokens, true) === true) {
+ return;
+ }
+
+ if ($tokens[$prevIndex]['code'] === T_STRING_CONCAT) {
+ return;
+ }
+
+ // Is it a parenthesis.
+ if ($tokens[$previousIndex]['code'] === T_CLOSE_PARENTHESIS) {
+ // Check what exists inside the parenthesis.
+ $closeParenthesisIndex = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($tokens[$previousIndex]['parenthesis_opener'] - 1),
+ null,
+ true
+ );
+
+ if ($closeParenthesisIndex === false || $tokens[$closeParenthesisIndex]['code'] !== T_ARRAY) {
+ if ($tokens[$closeParenthesisIndex]['code'] === T_STRING) {
+ return;
+ }
+
+ // If it is not an array check what is inside.
+ $found = $phpcsFile->findPrevious(
+ T_VARIABLE,
+ ($previousIndex - 1),
+ $tokens[$previousIndex]['parenthesis_opener']
+ );
+
+ // If a variable exists, it is not Yoda.
+ if ($found !== false) {
+ return;
+ }
+
+ // If there is nothing inside the parenthesis, it it not a Yoda.
+ $opener = $tokens[$previousIndex]['parenthesis_opener'];
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($previousIndex - 1), ($opener + 1), true);
+ if ($prev === false) {
+ return;
+ }
+ } else if ($tokens[$closeParenthesisIndex]['code'] === T_ARRAY
+ && $this->isArrayStatic($phpcsFile, $closeParenthesisIndex) === false
+ ) {
+ return;
+ }//end if
+ }//end if
+
+ $phpcsFile->addError(
+ 'Usage of Yoda conditions is not allowed; switch the expression order',
+ $stackPtr,
+ 'Found'
+ );
+
+ }//end process()
+
+
+ /**
+ * Determines if an array is a static definition.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $arrayToken The position of the array token.
+ *
+ * @return bool
+ */
+ public function isArrayStatic(File $phpcsFile, $arrayToken)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $arrayEnd = null;
+ if ($tokens[$arrayToken]['code'] === T_OPEN_SHORT_ARRAY) {
+ $start = $arrayToken;
+ $end = $tokens[$arrayToken]['bracket_closer'];
+ } else if ($tokens[$arrayToken]['code'] === T_ARRAY) {
+ $start = $tokens[$arrayToken]['parenthesis_opener'];
+ $end = $tokens[$arrayToken]['parenthesis_closer'];
+ } else {
+ return true;
+ }
+
+ $staticTokens = Tokens::$emptyTokens;
+ $staticTokens += Tokens::$textStringTokens;
+ $staticTokens += Tokens::$assignmentTokens;
+ $staticTokens += Tokens::$equalityTokens;
+ $staticTokens += Tokens::$comparisonTokens;
+ $staticTokens += Tokens::$arithmeticTokens;
+ $staticTokens += Tokens::$operators;
+ $staticTokens += Tokens::$booleanOperators;
+ $staticTokens += Tokens::$castTokens;
+ $staticTokens += Tokens::$bracketTokens;
+ $staticTokens += [
+ T_DOUBLE_ARROW => T_DOUBLE_ARROW,
+ T_COMMA => T_COMMA,
+ T_TRUE => T_TRUE,
+ T_FALSE => T_FALSE,
+ ];
+
+ for ($i = ($start + 1); $i < $end; $i++) {
+ if (isset($tokens[$i]['scope_closer']) === true) {
+ $i = $tokens[$i]['scope_closer'];
+ continue;
+ }
+
+ if (isset($staticTokens[$tokens[$i]['code']]) === false) {
+ return false;
+ }
+ }
+
+ return true;
+
+ }//end isArrayStatic()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php
new file mode 100644
index 00000000..a67a6a79
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php
@@ -0,0 +1,381 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\ControlStructures;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class InlineControlStructureSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+ /**
+ * If true, an error will be thrown; otherwise a warning.
+ *
+ * @var boolean
+ */
+ public $error = true;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_IF,
+ T_ELSE,
+ T_ELSEIF,
+ T_FOREACH,
+ T_WHILE,
+ T_DO,
+ T_SWITCH,
+ T_FOR,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if (isset($tokens[$stackPtr]['scope_opener']) === true) {
+ $phpcsFile->recordMetric($stackPtr, 'Control structure defined inline', 'no');
+ return;
+ }
+
+ // Ignore the ELSE in ELSE IF. We'll process the IF part later.
+ if ($tokens[$stackPtr]['code'] === T_ELSE) {
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ if ($tokens[$next]['code'] === T_IF) {
+ return;
+ }
+ }
+
+ if ($tokens[$stackPtr]['code'] === T_WHILE || $tokens[$stackPtr]['code'] === T_FOR) {
+ // This could be from a DO WHILE, which doesn't have an opening brace or a while/for without body.
+ if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) {
+ $afterParensCloser = $phpcsFile->findNext(Tokens::$emptyTokens, ($tokens[$stackPtr]['parenthesis_closer'] + 1), null, true);
+ if ($afterParensCloser === false) {
+ // Live coding.
+ return;
+ }
+
+ if ($tokens[$afterParensCloser]['code'] === T_SEMICOLON) {
+ $phpcsFile->recordMetric($stackPtr, 'Control structure defined inline', 'no');
+ return;
+ }
+ }
+
+ // In Javascript DO WHILE loops without curly braces are legal. This
+ // is only valid if a single statement is present between the DO and
+ // the WHILE. We can detect this by checking only a single semicolon
+ // is present between them.
+ if ($tokens[$stackPtr]['code'] === T_WHILE && $phpcsFile->tokenizerType === 'JS') {
+ $lastDo = $phpcsFile->findPrevious(T_DO, ($stackPtr - 1));
+ $lastSemicolon = $phpcsFile->findPrevious(T_SEMICOLON, ($stackPtr - 1));
+ if ($lastDo !== false && $lastSemicolon !== false && $lastDo < $lastSemicolon) {
+ $precedingSemicolon = $phpcsFile->findPrevious(T_SEMICOLON, ($lastSemicolon - 1));
+ if ($precedingSemicolon === false || $precedingSemicolon < $lastDo) {
+ return;
+ }
+ }
+ }
+ }//end if
+
+ if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false
+ && $tokens[$stackPtr]['code'] !== T_ELSE
+ ) {
+ if ($tokens[$stackPtr]['code'] !== T_DO) {
+ // Live coding or parse error.
+ return;
+ }
+
+ $nextWhile = $phpcsFile->findNext(T_WHILE, ($stackPtr + 1));
+ if ($nextWhile !== false
+ && isset($tokens[$nextWhile]['parenthesis_opener'], $tokens[$nextWhile]['parenthesis_closer']) === false
+ ) {
+ // Live coding or parse error.
+ return;
+ }
+
+ unset($nextWhile);
+ }
+
+ $start = $stackPtr;
+ if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) {
+ $start = $tokens[$stackPtr]['parenthesis_closer'];
+ }
+
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($start + 1), null, true);
+ if ($nextNonEmpty === false) {
+ // Live coding or parse error.
+ return;
+ }
+
+ if ($tokens[$nextNonEmpty]['code'] === T_OPEN_CURLY_BRACKET
+ || $tokens[$nextNonEmpty]['code'] === T_COLON
+ ) {
+ // T_CLOSE_CURLY_BRACKET missing, or alternative control structure with
+ // T_END... missing. Either live coding, parse error or end
+ // tag in short open tags and scan run with short_open_tag=Off.
+ // Bow out completely as any further detection will be unreliable
+ // and create incorrect fixes or cause fixer conflicts.
+ return ($phpcsFile->numTokens + 1);
+ }
+
+ unset($nextNonEmpty, $start);
+
+ // This is a control structure without an opening brace,
+ // so it is an inline statement.
+ if ($this->error === true) {
+ $fix = $phpcsFile->addFixableError('Inline control structures are not allowed', $stackPtr, 'NotAllowed');
+ } else {
+ $fix = $phpcsFile->addFixableWarning('Inline control structures are discouraged', $stackPtr, 'Discouraged');
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Control structure defined inline', 'yes');
+
+ // Stop here if we are not fixing the error.
+ if ($fix !== true) {
+ return;
+ }
+
+ $phpcsFile->fixer->beginChangeset();
+ if (isset($tokens[$stackPtr]['parenthesis_closer']) === true) {
+ $closer = $tokens[$stackPtr]['parenthesis_closer'];
+ } else {
+ $closer = $stackPtr;
+ }
+
+ if ($tokens[($closer + 1)]['code'] === T_WHITESPACE
+ || $tokens[($closer + 1)]['code'] === T_SEMICOLON
+ ) {
+ $phpcsFile->fixer->addContent($closer, ' {');
+ } else {
+ $phpcsFile->fixer->addContent($closer, ' { ');
+ }
+
+ $fixableScopeOpeners = $this->register();
+
+ $lastNonEmpty = $closer;
+ for ($end = ($closer + 1); $end < $phpcsFile->numTokens; $end++) {
+ if ($tokens[$end]['code'] === T_SEMICOLON) {
+ break;
+ }
+
+ if ($tokens[$end]['code'] === T_CLOSE_TAG) {
+ $end = $lastNonEmpty;
+ break;
+ }
+
+ if (in_array($tokens[$end]['code'], $fixableScopeOpeners, true) === true
+ && isset($tokens[$end]['scope_opener']) === false
+ ) {
+ // The best way to fix nested inline scopes is middle-out.
+ // So skip this one. It will be detected and fixed on a future loop.
+ $phpcsFile->fixer->rollbackChangeset();
+ return;
+ }
+
+ if (isset($tokens[$end]['scope_opener']) === true) {
+ $type = $tokens[$end]['code'];
+ $end = $tokens[$end]['scope_closer'];
+ if ($type === T_DO
+ || $type === T_IF || $type === T_ELSEIF
+ || $type === T_TRY || $type === T_CATCH || $type === T_FINALLY
+ ) {
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true);
+ if ($next === false) {
+ break;
+ }
+
+ $nextType = $tokens[$next]['code'];
+
+ // Let additional conditions loop and find their ending.
+ if (($type === T_IF
+ || $type === T_ELSEIF)
+ && ($nextType === T_ELSEIF
+ || $nextType === T_ELSE)
+ ) {
+ continue;
+ }
+
+ // Account for TRY... CATCH/FINALLY statements.
+ if (($type === T_TRY
+ || $type === T_CATCH
+ || $type === T_FINALLY)
+ && ($nextType === T_CATCH
+ || $nextType === T_FINALLY)
+ ) {
+ continue;
+ }
+
+ // Account for DO... WHILE conditions.
+ if ($type === T_DO && $nextType === T_WHILE) {
+ $end = $phpcsFile->findNext(T_SEMICOLON, ($next + 1));
+ }
+ } else if ($type === T_CLOSURE) {
+ // There should be a semicolon after the closing brace.
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true);
+ if ($next !== false && $tokens[$next]['code'] === T_SEMICOLON) {
+ $end = $next;
+ }
+ }//end if
+
+ if ($tokens[$end]['code'] !== T_END_HEREDOC
+ && $tokens[$end]['code'] !== T_END_NOWDOC
+ ) {
+ break;
+ }
+ }//end if
+
+ if (isset($tokens[$end]['parenthesis_closer']) === true) {
+ $end = $tokens[$end]['parenthesis_closer'];
+ $lastNonEmpty = $end;
+ continue;
+ }
+
+ if ($tokens[$end]['code'] !== T_WHITESPACE) {
+ $lastNonEmpty = $end;
+ }
+ }//end for
+
+ if ($end === $phpcsFile->numTokens) {
+ $end = $lastNonEmpty;
+ }
+
+ $nextContent = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true);
+ if ($nextContent === false || $tokens[$nextContent]['line'] !== $tokens[$end]['line']) {
+ // Looks for completely empty statements.
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($closer + 1), ($end + 1), true);
+ } else {
+ $next = ($end + 1);
+ $endLine = $end;
+ }
+
+ if ($next !== $end) {
+ if ($nextContent === false || $tokens[$nextContent]['line'] !== $tokens[$end]['line']) {
+ // Account for a comment on the end of the line.
+ for ($endLine = $end; $endLine < $phpcsFile->numTokens; $endLine++) {
+ if (isset($tokens[($endLine + 1)]) === false
+ || $tokens[$endLine]['line'] !== $tokens[($endLine + 1)]['line']
+ ) {
+ break;
+ }
+ }
+
+ if (isset(Tokens::$commentTokens[$tokens[$endLine]['code']]) === false
+ && ($tokens[$endLine]['code'] !== T_WHITESPACE
+ || isset(Tokens::$commentTokens[$tokens[($endLine - 1)]['code']]) === false)
+ ) {
+ $endLine = $end;
+ }
+ }
+
+ if ($endLine !== $end) {
+ $endToken = $endLine;
+ $addedContent = '';
+ } else {
+ $endToken = $end;
+ $addedContent = $phpcsFile->eolChar;
+
+ if ($tokens[$end]['code'] !== T_SEMICOLON
+ && $tokens[$end]['code'] !== T_CLOSE_CURLY_BRACKET
+ ) {
+ $phpcsFile->fixer->addContent($end, '; ');
+ }
+ }
+
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($endToken + 1), null, true);
+ if ($next !== false
+ && ($tokens[$next]['code'] === T_ELSE
+ || $tokens[$next]['code'] === T_ELSEIF)
+ ) {
+ $phpcsFile->fixer->addContentBefore($next, '} ');
+ } else {
+ $indent = '';
+ for ($first = $stackPtr; $first > 0; $first--) {
+ if ($tokens[$first]['column'] === 1) {
+ break;
+ }
+ }
+
+ if ($tokens[$first]['code'] === T_WHITESPACE) {
+ $indent = $tokens[$first]['content'];
+ } else if ($tokens[$first]['code'] === T_INLINE_HTML
+ || $tokens[$first]['code'] === T_OPEN_TAG
+ ) {
+ $addedContent = '';
+ }
+
+ $addedContent .= $indent.'}';
+ if ($next !== false && $tokens[$endToken]['code'] === T_COMMENT) {
+ $addedContent .= $phpcsFile->eolChar;
+ }
+
+ $phpcsFile->fixer->addContent($endToken, $addedContent);
+ }//end if
+ } else {
+ if ($nextContent === false || $tokens[$nextContent]['line'] !== $tokens[$end]['line']) {
+ // Account for a comment on the end of the line.
+ for ($endLine = $end; $endLine < $phpcsFile->numTokens; $endLine++) {
+ if (isset($tokens[($endLine + 1)]) === false
+ || $tokens[$endLine]['line'] !== $tokens[($endLine + 1)]['line']
+ ) {
+ break;
+ }
+ }
+
+ if ($tokens[$endLine]['code'] !== T_COMMENT
+ && ($tokens[$endLine]['code'] !== T_WHITESPACE
+ || $tokens[($endLine - 1)]['code'] !== T_COMMENT)
+ ) {
+ $endLine = $end;
+ }
+ }
+
+ if ($endLine !== $end) {
+ $phpcsFile->fixer->replaceToken($end, '');
+ $phpcsFile->fixer->addNewlineBefore($endLine);
+ $phpcsFile->fixer->addContent($endLine, '}');
+ } else {
+ $phpcsFile->fixer->replaceToken($end, '}');
+ }
+ }//end if
+
+ $phpcsFile->fixer->endChangeset();
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php
new file mode 100644
index 00000000..81284787
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php
@@ -0,0 +1,96 @@
+
+ * @copyright 2013-2014 Roman Levishchenko
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Debug;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Common;
+
+class CSSLintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = ['CSS'];
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes the tokens that this sniff is interested in.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
+ * @param int $stackPtr The position in the stack where
+ * the token was found.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $csslintPath = Config::getExecutablePath('csslint');
+ if ($csslintPath === null) {
+ return;
+ }
+
+ $fileName = $phpcsFile->getFilename();
+
+ $cmd = Common::escapeshellcmd($csslintPath).' '.escapeshellarg($fileName).' 2>&1';
+ exec($cmd, $output, $retval);
+
+ if (is_array($output) === false) {
+ return;
+ }
+
+ $count = count($output);
+
+ for ($i = 0; $i < $count; $i++) {
+ $matches = [];
+ $numMatches = preg_match(
+ '/(error|warning) at line (\d+)/',
+ $output[$i],
+ $matches
+ );
+
+ if ($numMatches === 0) {
+ continue;
+ }
+
+ $line = (int) $matches[2];
+ $message = 'csslint says: '.$output[($i + 1)];
+ // First line is message with error line and error code.
+ // Second is error message.
+ // Third is wrong line in file.
+ // Fourth is empty line.
+ $i += 4;
+
+ $phpcsFile->addWarningOnLine($message, $line, 'ExternalTool');
+ }//end for
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
new file mode 100644
index 00000000..19204718
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
@@ -0,0 +1,117 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Debug;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Common;
+
+class ClosureLinterSniff implements Sniff
+{
+
+ /**
+ * A list of error codes that should show errors.
+ *
+ * All other error codes will show warnings.
+ *
+ * @var integer
+ */
+ public $errorCodes = [];
+
+ /**
+ * A list of error codes to ignore.
+ *
+ * @var integer
+ */
+ public $ignoreCodes = [];
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = ['JS'];
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes the tokens that this sniff is interested in.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
+ * @param int $stackPtr The position in the stack where
+ * the token was found.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jslint.js could not be run
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $lintPath = Config::getExecutablePath('gjslint');
+ if ($lintPath === null) {
+ return;
+ }
+
+ $fileName = $phpcsFile->getFilename();
+
+ $lintPath = Common::escapeshellcmd($lintPath);
+ $cmd = $lintPath.' --nosummary --notime --unix_mode '.escapeshellarg($fileName);
+ exec($cmd, $output, $retval);
+
+ if (is_array($output) === false) {
+ return;
+ }
+
+ foreach ($output as $finding) {
+ $matches = [];
+ $numMatches = preg_match('/^(.*):([0-9]+):\(.*?([0-9]+)\)(.*)$/', $finding, $matches);
+ if ($numMatches === 0) {
+ continue;
+ }
+
+ // Skip error codes we are ignoring.
+ $code = $matches[3];
+ if (in_array($code, $this->ignoreCodes) === true) {
+ continue;
+ }
+
+ $line = (int) $matches[2];
+ $error = trim($matches[4]);
+
+ $message = 'gjslint says: (%s) %s';
+ $data = [
+ $code,
+ $error,
+ ];
+ if (in_array($code, $this->errorCodes) === true) {
+ $phpcsFile->addErrorOnLine($message, $line, 'ExternalToolError', $data);
+ } else {
+ $phpcsFile->addWarningOnLine($message, $line, 'ExternalTool', $data);
+ }
+ }//end foreach
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ESLintSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ESLintSniff.php
new file mode 100644
index 00000000..d11d3470
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ESLintSniff.php
@@ -0,0 +1,113 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Debug;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Common;
+
+class ESLintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = ['JS'];
+
+ /**
+ * ESLint configuration file path.
+ *
+ * @var string|null Path to eslintrc. Null to autodetect.
+ */
+ public $configFile = null;
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes the tokens that this sniff is interested in.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
+ * @param int $stackPtr The position in the stack where
+ * the token was found.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jshint.js could not be run
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $eslintPath = Config::getExecutablePath('eslint');
+ if ($eslintPath === null) {
+ return;
+ }
+
+ $filename = $phpcsFile->getFilename();
+
+ $configFile = $this->configFile;
+ if (empty($configFile) === true) {
+ // Attempt to autodetect.
+ $candidates = glob('.eslintrc{.js,.yaml,.yml,.json}', GLOB_BRACE);
+ if (empty($candidates) === false) {
+ $configFile = $candidates[0];
+ }
+ }
+
+ $eslintOptions = ['--format json'];
+ if (empty($configFile) === false) {
+ $eslintOptions[] = '--config '.escapeshellarg($configFile);
+ }
+
+ $cmd = Common::escapeshellcmd(escapeshellarg($eslintPath).' '.implode(' ', $eslintOptions).' '.escapeshellarg($filename));
+
+ // Execute!
+ exec($cmd, $stdout, $code);
+
+ if ($code <= 0) {
+ // No errors, continue.
+ return ($phpcsFile->numTokens + 1);
+ }
+
+ $data = json_decode(implode("\n", $stdout));
+ if (json_last_error() !== JSON_ERROR_NONE) {
+ // Ignore any errors.
+ return ($phpcsFile->numTokens + 1);
+ }
+
+ // Data is a list of files, but we only pass a single one.
+ $messages = $data[0]->messages;
+ foreach ($messages as $error) {
+ $message = 'eslint says: '.$error->message;
+ if (empty($error->fatal) === false || $error->severity === 2) {
+ $phpcsFile->addErrorOnLine($message, $error->line, 'ExternalTool');
+ } else {
+ $phpcsFile->addWarningOnLine($message, $error->line, 'ExternalTool');
+ }
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/JSHintSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/JSHintSniff.php
new file mode 100644
index 00000000..06de3594
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/JSHintSniff.php
@@ -0,0 +1,95 @@
+
+ * @author Alexander Wei§
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Debug;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Common;
+
+class JSHintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = ['JS'];
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes the tokens that this sniff is interested in.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
+ * @param int $stackPtr The position in the stack where
+ * the token was found.
+ *
+ * @return void
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If jshint.js could not be run
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $rhinoPath = Config::getExecutablePath('rhino');
+ $jshintPath = Config::getExecutablePath('jshint');
+ if ($rhinoPath === null && $jshintPath === null) {
+ return;
+ }
+
+ $fileName = $phpcsFile->getFilename();
+ $jshintPath = Common::escapeshellcmd($jshintPath);
+
+ if ($rhinoPath !== null) {
+ $rhinoPath = Common::escapeshellcmd($rhinoPath);
+ $cmd = "$rhinoPath \"$jshintPath\" ".escapeshellarg($fileName);
+ exec($cmd, $output, $retval);
+
+ $regex = '`^(?P.+)\(.+:(?P[0-9]+).*:[0-9]+\)$`';
+ } else {
+ $cmd = "$jshintPath ".escapeshellarg($fileName);
+ exec($cmd, $output, $retval);
+
+ $regex = '`^(.+?): line (?P[0-9]+), col [0-9]+, (?P.+)$`';
+ }
+
+ if (is_array($output) === true) {
+ foreach ($output as $finding) {
+ $matches = [];
+ $numMatches = preg_match($regex, $finding, $matches);
+ if ($numMatches === 0) {
+ continue;
+ }
+
+ $line = (int) $matches['line'];
+ $message = 'jshint says: '.trim($matches['error']);
+ $phpcsFile->addWarningOnLine($message, $line, 'ExternalTool');
+ }
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php
new file mode 100644
index 00000000..cee8ecc5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php
@@ -0,0 +1,80 @@
+
+ * @author Greg Sherwood
+ * @copyright 2010-2014 mediaSELF Sp. z o.o.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class ByteOrderMarkSniff implements Sniff
+{
+
+ /**
+ * List of supported BOM definitions.
+ *
+ * Use encoding names as keys and hex BOM representations as values.
+ *
+ * @var array
+ */
+ protected $bomDefinitions = [
+ 'UTF-8' => 'efbbbf',
+ 'UTF-16 (BE)' => 'feff',
+ 'UTF-16 (LE)' => 'fffe',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_INLINE_HTML];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ // The BOM will be the very first token in the file.
+ if ($stackPtr !== 0) {
+ return;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+
+ foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
+ $bomByteLength = (strlen($expectedBomHex) / 2);
+ $htmlBomHex = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength));
+ if ($htmlBomHex === $expectedBomHex) {
+ $errorData = [$bomName];
+ $error = 'File contains %s byte order mark, which may corrupt your application';
+ $phpcsFile->addError($error, $stackPtr, 'Found', $errorData);
+ $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes');
+ return;
+ }
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no');
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNewlineSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNewlineSniff.php
new file mode 100644
index 00000000..d5375dc5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNewlineSniff.php
@@ -0,0 +1,84 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class EndFileNewlineSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ 'CSS',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ // Skip to the end of the file.
+ $tokens = $phpcsFile->getTokens();
+ $stackPtr = ($phpcsFile->numTokens - 1);
+
+ if ($tokens[$stackPtr]['content'] === '') {
+ $stackPtr--;
+ }
+
+ $eolCharLen = strlen($phpcsFile->eolChar);
+ $lastChars = substr($tokens[$stackPtr]['content'], ($eolCharLen * -1));
+ if ($lastChars !== $phpcsFile->eolChar) {
+ $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'no');
+
+ $error = 'File must end with a newline character';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotFound');
+ if ($fix === true) {
+ $phpcsFile->fixer->addNewline($stackPtr);
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'yes');
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNoNewlineSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNoNewlineSniff.php
new file mode 100644
index 00000000..41c9c749
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNoNewlineSniff.php
@@ -0,0 +1,91 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class EndFileNoNewlineSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ 'CSS',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ // Skip to the end of the file.
+ $tokens = $phpcsFile->getTokens();
+ $stackPtr = ($phpcsFile->numTokens - 1);
+
+ if ($tokens[$stackPtr]['content'] === '') {
+ --$stackPtr;
+ }
+
+ $eolCharLen = strlen($phpcsFile->eolChar);
+ $lastChars = substr($tokens[$stackPtr]['content'], ($eolCharLen * -1));
+ if ($lastChars === $phpcsFile->eolChar) {
+ $error = 'File must not end with a newline character';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+
+ for ($i = $stackPtr; $i > 0; $i--) {
+ $newContent = rtrim($tokens[$i]['content'], $phpcsFile->eolChar);
+ $phpcsFile->fixer->replaceToken($i, $newContent);
+
+ if ($newContent !== '') {
+ break;
+ }
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ExecutableFileSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ExecutableFileSniff.php
new file mode 100644
index 00000000..e1213d5f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/ExecutableFileSniff.php
@@ -0,0 +1,62 @@
+
+ * @copyright 2019 Matthew Peveler
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class ExecutableFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $filename = $phpcsFile->getFilename();
+
+ if ($filename !== 'STDIN') {
+ $perms = fileperms($phpcsFile->getFilename());
+ if (($perms & 0x0040) !== 0 || ($perms & 0x0008) !== 0 || ($perms & 0x0001) !== 0) {
+ $error = 'A PHP file should not be executable; found file permissions set to %s';
+ $data = [substr(sprintf('%o', $perms), -4)];
+ $phpcsFile->addError($error, 0, 'Executable', $data);
+ }
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php
new file mode 100644
index 00000000..eb01da87
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php
@@ -0,0 +1,79 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class InlineHTMLSniff implements Sniff
+{
+
+ /**
+ * List of supported BOM definitions.
+ *
+ * Use encoding names as keys and hex BOM representations as values.
+ *
+ * @var array
+ */
+ protected $bomDefinitions = [
+ 'UTF-8' => 'efbbbf',
+ 'UTF-16 (BE)' => 'feff',
+ 'UTF-16 (LE)' => 'fffe',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_INLINE_HTML];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int|null
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ // Allow a byte-order mark.
+ $tokens = $phpcsFile->getTokens();
+ foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
+ $bomByteLength = (strlen($expectedBomHex) / 2);
+ $htmlBomHex = bin2hex(substr($tokens[0]['content'], 0, $bomByteLength));
+ if ($htmlBomHex === $expectedBomHex && strlen($tokens[0]['content']) === $bomByteLength) {
+ return;
+ }
+ }
+
+ // Ignore shebang lines.
+ $tokens = $phpcsFile->getTokens();
+ if (substr($tokens[$stackPtr]['content'], 0, 2) === '#!') {
+ return;
+ }
+
+ $error = 'PHP files must only contain PHP code';
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+
+ return $phpcsFile->numTokens;
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
new file mode 100644
index 00000000..845e1bcf
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
@@ -0,0 +1,148 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class LineEndingsSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ 'CSS',
+ ];
+
+ /**
+ * The valid EOL character.
+ *
+ * @var string
+ */
+ public $eolChar = '\n';
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $found = $phpcsFile->eolChar;
+ $found = str_replace("\n", '\n', $found);
+ $found = str_replace("\r", '\r', $found);
+
+ $phpcsFile->recordMetric($stackPtr, 'EOL char', $found);
+
+ if ($found === $this->eolChar) {
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+ }
+
+ // Check for single line files without an EOL. This is a very special
+ // case and the EOL char is set to \n when this happens.
+ if ($found === '\n') {
+ $tokens = $phpcsFile->getTokens();
+ $lastToken = ($phpcsFile->numTokens - 1);
+ if ($tokens[$lastToken]['line'] === 1
+ && $tokens[$lastToken]['content'] !== "\n"
+ ) {
+ return;
+ }
+ }
+
+ $error = 'End of line character is invalid; expected "%s" but found "%s"';
+ $expected = $this->eolChar;
+ $expected = str_replace("\n", '\n', $expected);
+ $expected = str_replace("\r", '\r', $expected);
+ $data = [
+ $expected,
+ $found,
+ ];
+
+ // Errors are always reported on line 1, no matter where the first PHP tag is.
+ $fix = $phpcsFile->addFixableError($error, 0, 'InvalidEOLChar', $data);
+
+ if ($fix === true) {
+ $tokens = $phpcsFile->getTokens();
+ switch ($this->eolChar) {
+ case '\n':
+ $eolChar = "\n";
+ break;
+ case '\r':
+ $eolChar = "\r";
+ break;
+ case '\r\n':
+ $eolChar = "\r\n";
+ break;
+ default:
+ $eolChar = $this->eolChar;
+ break;
+ }
+
+ for ($i = 0; $i < $phpcsFile->numTokens; $i++) {
+ if (isset($tokens[($i + 1)]) === true
+ && $tokens[($i + 1)]['line'] <= $tokens[$i]['line']
+ ) {
+ continue;
+ }
+
+ // Token is the last on a line.
+ if (isset($tokens[$i]['orig_content']) === true) {
+ $tokenContent = $tokens[$i]['orig_content'];
+ } else {
+ $tokenContent = $tokens[$i]['content'];
+ }
+
+ if ($tokenContent === '') {
+ // Special case for JS/CSS close tag.
+ continue;
+ }
+
+ $newContent = rtrim($tokenContent, "\r\n");
+ $newContent .= $eolChar;
+ if ($tokenContent !== $newContent) {
+ $phpcsFile->fixer->replaceToken($i, $newContent);
+ }
+ }//end for
+ }//end if
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php
new file mode 100644
index 00000000..5aa45ea0
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php
@@ -0,0 +1,201 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class LineLengthSniff implements Sniff
+{
+
+ /**
+ * The limit that the length of a line should not exceed.
+ *
+ * @var integer
+ */
+ public $lineLimit = 80;
+
+ /**
+ * The limit that the length of a line must not exceed.
+ *
+ * Set to zero (0) to disable.
+ *
+ * @var integer
+ */
+ public $absoluteLineLimit = 100;
+
+ /**
+ * Whether or not to ignore trailing comments.
+ *
+ * This has the effect of also ignoring all lines
+ * that only contain comments.
+ *
+ * @var boolean
+ */
+ public $ignoreComments = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ for ($i = 1; $i < $phpcsFile->numTokens; $i++) {
+ if ($tokens[$i]['column'] === 1) {
+ $this->checkLineLength($phpcsFile, $tokens, $i);
+ }
+ }
+
+ $this->checkLineLength($phpcsFile, $tokens, $i);
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+ /**
+ * Checks if a line is too long.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param array $tokens The token stack.
+ * @param int $stackPtr The first token on the next line.
+ *
+ * @return void
+ */
+ protected function checkLineLength($phpcsFile, $tokens, $stackPtr)
+ {
+ // The passed token is the first on the line.
+ $stackPtr--;
+
+ if ($tokens[$stackPtr]['column'] === 1
+ && $tokens[$stackPtr]['length'] === 0
+ ) {
+ // Blank line.
+ return;
+ }
+
+ if ($tokens[$stackPtr]['column'] !== 1
+ && $tokens[$stackPtr]['content'] === $phpcsFile->eolChar
+ ) {
+ $stackPtr--;
+ }
+
+ $onlyComment = false;
+ if (isset(Tokens::$commentTokens[$tokens[$stackPtr]['code']]) === true) {
+ $prevNonWhiteSpace = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
+ if ($tokens[$stackPtr]['line'] !== $tokens[$prevNonWhiteSpace]['line']) {
+ $onlyComment = true;
+ }
+ }
+
+ if ($onlyComment === true
+ && isset(Tokens::$phpcsCommentTokens[$tokens[$stackPtr]['code']]) === true
+ ) {
+ // Ignore PHPCS annotation comments that are on a line by themselves.
+ return;
+ }
+
+ $lineLength = ($tokens[$stackPtr]['column'] + $tokens[$stackPtr]['length'] - 1);
+
+ if ($this->ignoreComments === true
+ && isset(Tokens::$commentTokens[$tokens[$stackPtr]['code']]) === true
+ ) {
+ // Trailing comments are being ignored in line length calculations.
+ if ($onlyComment === true) {
+ // The comment is the only thing on the line, so no need to check length.
+ return;
+ }
+
+ $lineLength -= $tokens[$stackPtr]['length'];
+ }
+
+ // Record metrics for common line length groupings.
+ if ($lineLength <= 80) {
+ $phpcsFile->recordMetric($stackPtr, 'Line length', '80 or less');
+ } else if ($lineLength <= 120) {
+ $phpcsFile->recordMetric($stackPtr, 'Line length', '81-120');
+ } else if ($lineLength <= 150) {
+ $phpcsFile->recordMetric($stackPtr, 'Line length', '121-150');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Line length', '151 or more');
+ }
+
+ if ($onlyComment === true) {
+ // If this is a long comment, check if it can be broken up onto multiple lines.
+ // Some comments contain unbreakable strings like URLs and so it makes sense
+ // to ignore the line length in these cases if the URL would be longer than the max
+ // line length once you indent it to the correct level.
+ if ($lineLength > $this->lineLimit) {
+ $oldLength = strlen($tokens[$stackPtr]['content']);
+ $newLength = strlen(ltrim($tokens[$stackPtr]['content'], "/#\t "));
+ $indent = (($tokens[$stackPtr]['column'] - 1) + ($oldLength - $newLength));
+
+ $nonBreakingLength = $tokens[$stackPtr]['length'];
+
+ $space = strrpos($tokens[$stackPtr]['content'], ' ');
+ if ($space !== false) {
+ $nonBreakingLength -= ($space + 1);
+ }
+
+ if (($nonBreakingLength + $indent) > $this->lineLimit) {
+ return;
+ }
+ }
+ }//end if
+
+ if ($this->absoluteLineLimit > 0
+ && $lineLength > $this->absoluteLineLimit
+ ) {
+ $data = [
+ $this->absoluteLineLimit,
+ $lineLength,
+ ];
+
+ $error = 'Line exceeds maximum limit of %s characters; contains %s characters';
+ $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data);
+ } else if ($lineLength > $this->lineLimit) {
+ $data = [
+ $this->lineLimit,
+ $lineLength,
+ ];
+
+ $warning = 'Line exceeds %s characters; contains %s characters';
+ $phpcsFile->addWarning($warning, $stackPtr, 'TooLong', $data);
+ }
+
+ }//end checkLineLength()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php
new file mode 100644
index 00000000..a9fd4c5d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php
@@ -0,0 +1,70 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class LowercasedFilenameSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $filename = $phpcsFile->getFilename();
+ if ($filename === 'STDIN') {
+ return;
+ }
+
+ $filename = basename($filename);
+ $lowercaseFilename = strtolower($filename);
+ if ($filename !== $lowercaseFilename) {
+ $data = [
+ $filename,
+ $lowercaseFilename,
+ ];
+ $error = 'Filename "%s" doesn\'t match the expected filename "%s"';
+ $phpcsFile->addError($error, $stackPtr, 'NotFound', $data);
+ $phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'no');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Lowercase filename', 'yes');
+ }
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php
new file mode 100644
index 00000000..52d5d84c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php
@@ -0,0 +1,57 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class OneClassPerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_CLASS];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $start = ($stackPtr + 1);
+ if (isset($tokens[$stackPtr]['scope_closer']) === true) {
+ $start = ($tokens[$stackPtr]['scope_closer'] + 1);
+ }
+
+ $nextClass = $phpcsFile->findNext($this->register(), $start);
+ if ($nextClass !== false) {
+ $error = 'Only one class is allowed in a file';
+ $phpcsFile->addError($error, $nextClass, 'MultipleFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneInterfacePerFileSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneInterfacePerFileSniff.php
new file mode 100644
index 00000000..9a6f5bcc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneInterfacePerFileSniff.php
@@ -0,0 +1,57 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class OneInterfacePerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_INTERFACE];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $start = ($stackPtr + 1);
+ if (isset($tokens[$stackPtr]['scope_closer']) === true) {
+ $start = ($tokens[$stackPtr]['scope_closer'] + 1);
+ }
+
+ $nextInterface = $phpcsFile->findNext($this->register(), $start);
+ if ($nextInterface !== false) {
+ $error = 'Only one interface is allowed in a file';
+ $phpcsFile->addError($error, $nextInterface, 'MultipleFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneObjectStructurePerFileSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneObjectStructurePerFileSniff.php
new file mode 100644
index 00000000..4d417e06
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneObjectStructurePerFileSniff.php
@@ -0,0 +1,62 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class OneObjectStructurePerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_CLASS,
+ T_INTERFACE,
+ T_TRAIT,
+ T_ENUM,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $start = ($stackPtr + 1);
+ if (isset($tokens[$stackPtr]['scope_closer']) === true) {
+ $start = ($tokens[$stackPtr]['scope_closer'] + 1);
+ }
+
+ $nextClass = $phpcsFile->findNext($this->register(), $start);
+ if ($nextClass !== false) {
+ $error = 'Only one object structure is allowed in a file';
+ $phpcsFile->addError($error, $nextClass, 'MultipleFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneTraitPerFileSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneTraitPerFileSniff.php
new file mode 100644
index 00000000..7ae523f7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneTraitPerFileSniff.php
@@ -0,0 +1,57 @@
+
+ * @copyright 2010-2014 Alexander Obuhovich
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Files;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class OneTraitPerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_TRAIT];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $start = ($stackPtr + 1);
+ if (isset($tokens[$stackPtr]['scope_closer']) === true) {
+ $start = ($tokens[$stackPtr]['scope_closer'] + 1);
+ }
+
+ $nextClass = $phpcsFile->findNext($this->register(), $start);
+ if ($nextClass !== false) {
+ $error = 'Only one trait is allowed in a file';
+ $phpcsFile->addError($error, $nextClass, 'MultipleFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/DisallowMultipleStatementsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/DisallowMultipleStatementsSniff.php
new file mode 100644
index 00000000..6f9ff9f9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/DisallowMultipleStatementsSniff.php
@@ -0,0 +1,105 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DisallowMultipleStatementsSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_SEMICOLON];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $fixable = true;
+ $prev = $stackPtr;
+
+ do {
+ $prev = $phpcsFile->findPrevious([T_SEMICOLON, T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_PHPCS_IGNORE], ($prev - 1));
+ if ($prev === false
+ || $tokens[$prev]['code'] === T_OPEN_TAG
+ || $tokens[$prev]['code'] === T_OPEN_TAG_WITH_ECHO
+ ) {
+ $phpcsFile->recordMetric($stackPtr, 'Multiple statements on same line', 'no');
+ return;
+ }
+
+ if ($tokens[$prev]['code'] === T_PHPCS_IGNORE) {
+ $fixable = false;
+ }
+ } while ($tokens[$prev]['code'] === T_PHPCS_IGNORE);
+
+ // Ignore multiple statements in a FOR condition.
+ foreach ([$stackPtr, $prev] as $checkToken) {
+ if (isset($tokens[$checkToken]['nested_parenthesis']) === true) {
+ foreach ($tokens[$checkToken]['nested_parenthesis'] as $bracket) {
+ if (isset($tokens[$bracket]['parenthesis_owner']) === false) {
+ // Probably a closure sitting inside a function call.
+ continue;
+ }
+
+ $owner = $tokens[$bracket]['parenthesis_owner'];
+ if ($tokens[$owner]['code'] === T_FOR) {
+ return;
+ }
+ }
+ }
+ }
+
+ if ($tokens[$prev]['line'] === $tokens[$stackPtr]['line']) {
+ $phpcsFile->recordMetric($stackPtr, 'Multiple statements on same line', 'yes');
+
+ $error = 'Each PHP statement must be on a line by itself';
+ $code = 'SameLine';
+ if ($fixable === false) {
+ $phpcsFile->addError($error, $stackPtr, $code);
+ return;
+ }
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, $code);
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->addNewline($prev);
+ if ($tokens[($prev + 1)]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->replaceToken(($prev + 1), '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Multiple statements on same line', 'no');
+ }//end if
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php
new file mode 100644
index 00000000..802e5944
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php
@@ -0,0 +1,426 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class MultipleStatementAlignmentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+ /**
+ * If true, an error will be thrown; otherwise a warning.
+ *
+ * @var boolean
+ */
+ public $error = false;
+
+ /**
+ * The maximum amount of padding before the alignment is ignored.
+ *
+ * If the amount of padding required to align this assignment with the
+ * surrounding assignments exceeds this number, the assignment will be
+ * ignored and no errors or warnings will be thrown.
+ *
+ * @var integer
+ */
+ public $maxPadding = 1000;
+
+ /**
+ * Controls which side of the assignment token is used for alignment.
+ *
+ * @var boolean
+ */
+ public $alignAtEnd = true;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ $tokens = Tokens::$assignmentTokens;
+ unset($tokens[T_DOUBLE_ARROW]);
+ return $tokens;
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $lastAssign = $this->checkAlignment($phpcsFile, $stackPtr);
+ return ($lastAssign + 1);
+
+ }//end process()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $end The token where checking should end.
+ * If NULL, the entire file will be checked.
+ *
+ * @return int
+ */
+ public function checkAlignment($phpcsFile, $stackPtr, $end=null)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Ignore assignments used in a condition, like an IF or FOR or closure param defaults.
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
+ // If the parenthesis is on the same line as the assignment,
+ // then it should be ignored as it is specifically being grouped.
+ $parens = $tokens[$stackPtr]['nested_parenthesis'];
+ $lastParen = array_pop($parens);
+ if ($tokens[$lastParen]['line'] === $tokens[$stackPtr]['line']) {
+ return $stackPtr;
+ }
+
+ foreach ($tokens[$stackPtr]['nested_parenthesis'] as $start => $end) {
+ if (isset($tokens[$start]['parenthesis_owner']) === true) {
+ return $stackPtr;
+ }
+ }
+ }
+
+ $assignments = [];
+ $prevAssign = null;
+ $lastLine = $tokens[$stackPtr]['line'];
+ $maxPadding = null;
+ $stopped = null;
+ $lastCode = $stackPtr;
+ $lastSemi = null;
+ $arrayEnd = null;
+
+ if ($end === null) {
+ $end = $phpcsFile->numTokens;
+ }
+
+ $find = Tokens::$assignmentTokens;
+ unset($find[T_DOUBLE_ARROW]);
+
+ $scopes = Tokens::$scopeOpeners;
+ unset($scopes[T_CLOSURE]);
+ unset($scopes[T_ANON_CLASS]);
+ unset($scopes[T_OBJECT]);
+
+ for ($assign = $stackPtr; $assign < $end; $assign++) {
+ if ($tokens[$assign]['level'] < $tokens[$stackPtr]['level']) {
+ // Statement is in a different context, so the block is over.
+ break;
+ }
+
+ if (isset($tokens[$assign]['scope_opener']) === true
+ && $tokens[$assign]['level'] === $tokens[$stackPtr]['level']
+ ) {
+ if (isset($scopes[$tokens[$assign]['code']]) === true) {
+ // This type of scope indicates that the assignment block is over.
+ break;
+ }
+
+ // Skip over the scope block because it is seen as part of the assignment block,
+ // but also process any assignment blocks that are inside as well.
+ $nextAssign = $phpcsFile->findNext($find, ($assign + 1), ($tokens[$assign]['scope_closer'] - 1));
+ if ($nextAssign !== false) {
+ $assign = $this->checkAlignment($phpcsFile, $nextAssign);
+ } else {
+ $assign = $tokens[$assign]['scope_closer'];
+ }
+
+ $lastCode = $assign;
+ continue;
+ }
+
+ if ($assign === $arrayEnd) {
+ $arrayEnd = null;
+ }
+
+ if (isset($find[$tokens[$assign]['code']]) === false) {
+ // A blank line indicates that the assignment block has ended.
+ if (isset(Tokens::$emptyTokens[$tokens[$assign]['code']]) === false
+ && ($tokens[$assign]['line'] - $tokens[$lastCode]['line']) > 1
+ && $tokens[$assign]['level'] === $tokens[$stackPtr]['level']
+ && $arrayEnd === null
+ ) {
+ break;
+ }
+
+ if ($tokens[$assign]['code'] === T_CLOSE_TAG) {
+ // Breaking out of PHP ends the assignment block.
+ break;
+ }
+
+ if ($tokens[$assign]['code'] === T_OPEN_SHORT_ARRAY
+ && isset($tokens[$assign]['bracket_closer']) === true
+ ) {
+ $arrayEnd = $tokens[$assign]['bracket_closer'];
+ }
+
+ if ($tokens[$assign]['code'] === T_ARRAY
+ && isset($tokens[$assign]['parenthesis_opener']) === true
+ && isset($tokens[$tokens[$assign]['parenthesis_opener']]['parenthesis_closer']) === true
+ ) {
+ $arrayEnd = $tokens[$tokens[$assign]['parenthesis_opener']]['parenthesis_closer'];
+ }
+
+ if (isset(Tokens::$emptyTokens[$tokens[$assign]['code']]) === false) {
+ $lastCode = $assign;
+
+ if ($tokens[$assign]['code'] === T_SEMICOLON) {
+ if ($tokens[$assign]['conditions'] === $tokens[$stackPtr]['conditions']) {
+ if ($lastSemi !== null && $prevAssign !== null && $lastSemi > $prevAssign) {
+ // This statement did not have an assignment operator in it.
+ break;
+ } else {
+ $lastSemi = $assign;
+ }
+ } else if ($tokens[$assign]['level'] < $tokens[$stackPtr]['level']) {
+ // Statement is in a different context, so the block is over.
+ break;
+ }
+ }
+ }//end if
+
+ continue;
+ } else if ($assign !== $stackPtr && $tokens[$assign]['line'] === $lastLine) {
+ // Skip multiple assignments on the same line. We only need to
+ // try and align the first assignment.
+ continue;
+ }//end if
+
+ if ($assign !== $stackPtr) {
+ if ($tokens[$assign]['level'] > $tokens[$stackPtr]['level']) {
+ // Has to be nested inside the same conditions as the first assignment.
+ // We've gone one level down, so process this new block.
+ $assign = $this->checkAlignment($phpcsFile, $assign);
+ $lastCode = $assign;
+ continue;
+ } else if ($tokens[$assign]['level'] < $tokens[$stackPtr]['level']) {
+ // We've gone one level up, so the block we are processing is done.
+ break;
+ } else if ($arrayEnd !== null) {
+ // Assignments inside arrays are not part of
+ // the original block, so process this new block.
+ $assign = ($this->checkAlignment($phpcsFile, $assign, $arrayEnd) - 1);
+ $arrayEnd = null;
+ $lastCode = $assign;
+ continue;
+ }
+
+ // Make sure it is not assigned inside a condition (eg. IF, FOR).
+ if (isset($tokens[$assign]['nested_parenthesis']) === true) {
+ // If the parenthesis is on the same line as the assignment,
+ // then it should be ignored as it is specifically being grouped.
+ $parens = $tokens[$assign]['nested_parenthesis'];
+ $lastParen = array_pop($parens);
+ if ($tokens[$lastParen]['line'] === $tokens[$assign]['line']) {
+ break;
+ }
+
+ foreach ($tokens[$assign]['nested_parenthesis'] as $start => $end) {
+ if (isset($tokens[$start]['parenthesis_owner']) === true) {
+ break(2);
+ }
+ }
+ }
+ }//end if
+
+ $var = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($assign - 1),
+ null,
+ true
+ );
+
+ // Make sure we wouldn't break our max padding length if we
+ // aligned with this statement, or they wouldn't break the max
+ // padding length if they aligned with us.
+ $varEnd = $tokens[($var + 1)]['column'];
+ $assignLen = $tokens[$assign]['length'];
+ if ($this->alignAtEnd !== true) {
+ $assignLen = 1;
+ }
+
+ if ($assign !== $stackPtr) {
+ if ($prevAssign === null) {
+ // Processing an inner block but no assignments found.
+ break;
+ }
+
+ if (($varEnd + 1) > $assignments[$prevAssign]['assign_col']) {
+ $padding = 1;
+ $assignColumn = ($varEnd + 1);
+ } else {
+ $padding = ($assignments[$prevAssign]['assign_col'] - $varEnd + $assignments[$prevAssign]['assign_len'] - $assignLen);
+ if ($padding <= 0) {
+ $padding = 1;
+ }
+
+ if ($padding > $this->maxPadding) {
+ $stopped = $assign;
+ break;
+ }
+
+ $assignColumn = ($varEnd + $padding);
+ }//end if
+
+ if (($assignColumn + $assignLen) > ($assignments[$maxPadding]['assign_col'] + $assignments[$maxPadding]['assign_len'])) {
+ $newPadding = ($varEnd - $assignments[$maxPadding]['var_end'] + $assignLen - $assignments[$maxPadding]['assign_len'] + 1);
+ if ($newPadding > $this->maxPadding) {
+ $stopped = $assign;
+ break;
+ } else {
+ // New alignment settings for previous assignments.
+ foreach ($assignments as $i => $data) {
+ if ($i === $assign) {
+ break;
+ }
+
+ $newPadding = ($varEnd - $data['var_end'] + $assignLen - $data['assign_len'] + 1);
+ $assignments[$i]['expected'] = $newPadding;
+ $assignments[$i]['assign_col'] = ($data['var_end'] + $newPadding);
+ }
+
+ $padding = 1;
+ $assignColumn = ($varEnd + 1);
+ }
+ } else if ($padding > $assignments[$maxPadding]['expected']) {
+ $maxPadding = $assign;
+ }//end if
+ } else {
+ $padding = 1;
+ $assignColumn = ($varEnd + 1);
+ $maxPadding = $assign;
+ }//end if
+
+ $found = 0;
+ if ($tokens[($var + 1)]['code'] === T_WHITESPACE) {
+ $found = $tokens[($var + 1)]['length'];
+ if ($found === 0) {
+ // This means a newline was found.
+ $found = 1;
+ }
+ }
+
+ $assignments[$assign] = [
+ 'var_end' => $varEnd,
+ 'assign_len' => $assignLen,
+ 'assign_col' => $assignColumn,
+ 'expected' => $padding,
+ 'found' => $found,
+ ];
+
+ $lastLine = $tokens[$assign]['line'];
+ $prevAssign = $assign;
+ }//end for
+
+ if (empty($assignments) === true) {
+ return $stackPtr;
+ }
+
+ $numAssignments = count($assignments);
+
+ $errorGenerated = false;
+ foreach ($assignments as $assignment => $data) {
+ if ($data['found'] === $data['expected']) {
+ continue;
+ }
+
+ $expectedText = $data['expected'].' space';
+ if ($data['expected'] !== 1) {
+ $expectedText .= 's';
+ }
+
+ if ($data['found'] === null) {
+ $foundText = 'a new line';
+ } else {
+ $foundText = $data['found'].' space';
+ if ($data['found'] !== 1) {
+ $foundText .= 's';
+ }
+ }
+
+ if ($numAssignments === 1) {
+ $type = 'Incorrect';
+ $error = 'Equals sign not aligned correctly; expected %s but found %s';
+ } else {
+ $type = 'NotSame';
+ $error = 'Equals sign not aligned with surrounding assignments; expected %s but found %s';
+ }
+
+ $errorData = [
+ $expectedText,
+ $foundText,
+ ];
+
+ if ($this->error === true) {
+ $fix = $phpcsFile->addFixableError($error, $assignment, $type, $errorData);
+ } else {
+ $fix = $phpcsFile->addFixableWarning($error, $assignment, $type.'Warning', $errorData);
+ }
+
+ $errorGenerated = true;
+
+ if ($fix === true && $data['found'] !== null) {
+ $newContent = str_repeat(' ', $data['expected']);
+ if ($data['found'] === 0) {
+ $phpcsFile->fixer->addContentBefore($assignment, $newContent);
+ } else {
+ $phpcsFile->fixer->replaceToken(($assignment - 1), $newContent);
+ }
+ }
+ }//end foreach
+
+ if ($numAssignments > 1) {
+ if ($errorGenerated === true) {
+ $phpcsFile->recordMetric($stackPtr, 'Adjacent assignments aligned', 'no');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Adjacent assignments aligned', 'yes');
+ }
+ }
+
+ if ($stopped !== null) {
+ return $this->checkAlignment($phpcsFile, $stopped);
+ } else {
+ return $assign;
+ }
+
+ }//end checkAlignment()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php
new file mode 100644
index 00000000..f6a37daf
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php
@@ -0,0 +1,61 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ *
+ * @deprecated 3.4.0 Use the Generic.Formatting.SpaceAfterCast sniff with
+ * the $spacing property set to 0 instead.
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class NoSpaceAfterCastSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$castTokens;
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
+ return;
+ }
+
+ $error = 'A cast statement must not be followed by a space';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SpaceFound');
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($stackPtr + 1), '');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php
new file mode 100644
index 00000000..f19489e8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php
@@ -0,0 +1,153 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class SpaceAfterCastSniff implements Sniff
+{
+
+ /**
+ * The number of spaces desired after a cast token.
+ *
+ * @var integer
+ */
+ public $spacing = 1;
+
+ /**
+ * Allow newlines instead of spaces.
+ *
+ * @var boolean
+ */
+ public $ignoreNewlines = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$castTokens;
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $this->spacing = (int) $this->spacing;
+
+ if ($tokens[$stackPtr]['code'] === T_BINARY_CAST
+ && $tokens[$stackPtr]['content'] === 'b'
+ ) {
+ // You can't replace a space after this type of binary casting.
+ return;
+ }
+
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
+ if ($nextNonEmpty === false) {
+ return;
+ }
+
+ if ($this->ignoreNewlines === true
+ && $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']
+ ) {
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 'newline');
+ return;
+ }
+
+ if ($this->spacing === 0 && $nextNonEmpty === ($stackPtr + 1)) {
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
+ return;
+ }
+
+ $nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ if ($nextNonEmpty !== $nextNonWhitespace) {
+ $error = 'Expected %s space(s) after cast statement; comment found';
+ $data = [$this->spacing];
+ $phpcsFile->addError($error, $stackPtr, 'CommentFound', $data);
+
+ if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $tokens[($stackPtr + 1)]['length']);
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
+ }
+
+ return;
+ }
+
+ $found = 0;
+ if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
+ $found = 'newline';
+ } else if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
+ $found = $tokens[($stackPtr + 1)]['length'];
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $found);
+
+ if ($found === $this->spacing) {
+ return;
+ }
+
+ $error = 'Expected %s space(s) after cast statement; %s found';
+ $data = [
+ $this->spacing,
+ $found,
+ ];
+
+ $errorCode = 'TooMuchSpace';
+ if ($this->spacing !== 0) {
+ if ($found === 0) {
+ $errorCode = 'NoSpace';
+ } else if ($found !== 'newline' && $found < $this->spacing) {
+ $errorCode = 'TooLittleSpace';
+ }
+ }
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
+
+ if ($fix === true) {
+ $padding = str_repeat(' ', $this->spacing);
+ if ($found === 0) {
+ $phpcsFile->fixer->addContent($stackPtr, $padding);
+ } else {
+ $phpcsFile->fixer->beginChangeset();
+ $start = ($stackPtr + 1);
+
+ if ($this->spacing > 0) {
+ $phpcsFile->fixer->replaceToken($start, $padding);
+ ++$start;
+ }
+
+ for ($i = $start; $i < $nextNonWhitespace; $i++) {
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php
new file mode 100644
index 00000000..b74ca80e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php
@@ -0,0 +1,135 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class SpaceAfterNotSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = [
+ 'PHP',
+ 'JS',
+ ];
+
+ /**
+ * The number of spaces desired after the NOT operator.
+ *
+ * @var integer
+ */
+ public $spacing = 1;
+
+ /**
+ * Allow newlines instead of spaces.
+ *
+ * @var boolean
+ */
+ public $ignoreNewlines = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_BOOLEAN_NOT];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $this->spacing = (int) $this->spacing;
+
+ $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
+ if ($nextNonEmpty === false) {
+ return;
+ }
+
+ if ($this->ignoreNewlines === true
+ && $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']
+ ) {
+ return;
+ }
+
+ if ($this->spacing === 0 && $nextNonEmpty === ($stackPtr + 1)) {
+ return;
+ }
+
+ $nextNonWhitespace = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ if ($nextNonEmpty !== $nextNonWhitespace) {
+ $error = 'Expected %s space(s) after NOT operator; comment found';
+ $data = [$this->spacing];
+ $phpcsFile->addError($error, $stackPtr, 'CommentFound', $data);
+ return;
+ }
+
+ $found = 0;
+ if ($tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']) {
+ $found = 'newline';
+ } else if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
+ $found = $tokens[($stackPtr + 1)]['length'];
+ }
+
+ if ($found === $this->spacing) {
+ return;
+ }
+
+ $error = 'Expected %s space(s) after NOT operator; %s found';
+ $data = [
+ $this->spacing,
+ $found,
+ ];
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Incorrect', $data);
+ if ($fix === true) {
+ $padding = str_repeat(' ', $this->spacing);
+ if ($found === 0) {
+ $phpcsFile->fixer->addContent($stackPtr, $padding);
+ } else {
+ $phpcsFile->fixer->beginChangeset();
+ $start = ($stackPtr + 1);
+
+ if ($this->spacing > 0) {
+ $phpcsFile->fixer->replaceToken($start, $padding);
+ ++$start;
+ }
+
+ for ($i = $start; $i < $nextNonWhitespace; $i++) {
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceBeforeCastSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceBeforeCastSniff.php
new file mode 100644
index 00000000..a4f85aeb
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceBeforeCastSniff.php
@@ -0,0 +1,73 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class SpaceBeforeCastSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$castTokens;
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if ($tokens[$stackPtr]['column'] === 1) {
+ return;
+ }
+
+ if ($tokens[($stackPtr - 1)]['code'] !== T_WHITESPACE) {
+ $error = 'A cast statement must be preceded by a single space';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpace');
+ if ($fix === true) {
+ $phpcsFile->fixer->addContentBefore($stackPtr, ' ');
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Spacing before cast statement', 0);
+ return;
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Spacing before cast statement', $tokens[($stackPtr - 1)]['length']);
+
+ if ($tokens[($stackPtr - 1)]['column'] !== 1 && $tokens[($stackPtr - 1)]['length'] !== 1) {
+ $error = 'A cast statement must be preceded by a single space';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'TooMuchSpace');
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($stackPtr - 1), ' ');
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php
new file mode 100644
index 00000000..425748ce
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php
@@ -0,0 +1,141 @@
+
+ * @copyright 2009-2014 Florian Grandel
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Functions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class CallTimePassByReferenceSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_STRING,
+ T_VARIABLE,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $findTokens = Tokens::$emptyTokens;
+ $findTokens[] = T_BITWISE_AND;
+
+ $prev = $phpcsFile->findPrevious($findTokens, ($stackPtr - 1), null, true);
+
+ // Skip tokens that are the names of functions or classes
+ // within their definitions. For example: function myFunction...
+ // "myFunction" is T_STRING but we should skip because it is not a
+ // function or method *call*.
+ $prevCode = $tokens[$prev]['code'];
+ if ($prevCode === T_FUNCTION || $prevCode === T_CLASS) {
+ return;
+ }
+
+ // If the next non-whitespace token after the function or method call
+ // is not an opening parenthesis then it cant really be a *call*.
+ $functionName = $stackPtr;
+ $openBracket = $phpcsFile->findNext(
+ Tokens::$emptyTokens,
+ ($functionName + 1),
+ null,
+ true
+ );
+
+ if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
+ return;
+ }
+
+ if (isset($tokens[$openBracket]['parenthesis_closer']) === false) {
+ return;
+ }
+
+ $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
+
+ $nextSeparator = $openBracket;
+ $find = [
+ T_VARIABLE,
+ T_OPEN_SHORT_ARRAY,
+ ];
+
+ while (($nextSeparator = $phpcsFile->findNext($find, ($nextSeparator + 1), $closeBracket)) !== false) {
+ if (isset($tokens[$nextSeparator]['nested_parenthesis']) === false) {
+ continue;
+ }
+
+ if ($tokens[$nextSeparator]['code'] === T_OPEN_SHORT_ARRAY) {
+ $nextSeparator = $tokens[$nextSeparator]['bracket_closer'];
+ continue;
+ }
+
+ // Make sure the variable belongs directly to this function call
+ // and is not inside a nested function call or array.
+ $brackets = $tokens[$nextSeparator]['nested_parenthesis'];
+ $lastBracket = array_pop($brackets);
+ if ($lastBracket !== $closeBracket) {
+ continue;
+ }
+
+ $tokenBefore = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($nextSeparator - 1),
+ null,
+ true
+ );
+
+ if ($tokens[$tokenBefore]['code'] === T_BITWISE_AND) {
+ if ($phpcsFile->isReference($tokenBefore) === false) {
+ continue;
+ }
+
+ // We also want to ignore references used in assignment
+ // operations passed as function arguments, but isReference()
+ // sees them as valid references (which they are).
+ $tokenBefore = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($tokenBefore - 1),
+ null,
+ true
+ );
+
+ if (isset(Tokens::$assignmentTokens[$tokens[$tokenBefore]['code']]) === true) {
+ continue;
+ }
+
+ // T_BITWISE_AND represents a pass-by-reference.
+ $error = 'Call-time pass-by-reference calls are prohibited';
+ $phpcsFile->addError($error, $tokenBefore, 'NotAllowed');
+ }//end if
+ }//end while
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php
new file mode 100644
index 00000000..ca922381
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php
@@ -0,0 +1,185 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Functions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class FunctionCallArgumentSpacingSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return[
+ T_STRING,
+ T_ISSET,
+ T_UNSET,
+ T_SELF,
+ T_STATIC,
+ T_VARIABLE,
+ T_CLOSE_CURLY_BRACKET,
+ T_CLOSE_PARENTHESIS,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Skip tokens that are the names of functions or classes
+ // within their definitions. For example:
+ // function myFunction...
+ // "myFunction" is T_STRING but we should skip because it is not a
+ // function or method *call*.
+ $functionName = $stackPtr;
+ $ignoreTokens = Tokens::$emptyTokens;
+ $ignoreTokens[] = T_BITWISE_AND;
+ $functionKeyword = $phpcsFile->findPrevious($ignoreTokens, ($stackPtr - 1), null, true);
+ if ($tokens[$functionKeyword]['code'] === T_FUNCTION || $tokens[$functionKeyword]['code'] === T_CLASS) {
+ return;
+ }
+
+ if ($tokens[$stackPtr]['code'] === T_CLOSE_CURLY_BRACKET
+ && isset($tokens[$stackPtr]['scope_condition']) === true
+ ) {
+ // Not a function call.
+ return;
+ }
+
+ // If the next non-whitespace token after the function or method call
+ // is not an opening parenthesis then it can't really be a *call*.
+ $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($functionName + 1), null, true);
+ if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
+ return;
+ }
+
+ if (isset($tokens[$openBracket]['parenthesis_closer']) === false) {
+ return;
+ }
+
+ $this->checkSpacing($phpcsFile, $stackPtr, $openBracket);
+
+ }//end process()
+
+
+ /**
+ * Checks the spacing around commas.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ * @param int $openBracket The position of the opening bracket
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function checkSpacing(File $phpcsFile, $stackPtr, $openBracket)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
+ $nextSeparator = $openBracket;
+
+ $find = [
+ T_COMMA,
+ T_CLOSURE,
+ T_ANON_CLASS,
+ T_OPEN_SHORT_ARRAY,
+ ];
+
+ while (($nextSeparator = $phpcsFile->findNext($find, ($nextSeparator + 1), $closeBracket)) !== false) {
+ if ($tokens[$nextSeparator]['code'] === T_CLOSURE
+ || $tokens[$nextSeparator]['code'] === T_ANON_CLASS
+ ) {
+ // Skip closures.
+ $nextSeparator = $tokens[$nextSeparator]['scope_closer'];
+ continue;
+ } else if ($tokens[$nextSeparator]['code'] === T_OPEN_SHORT_ARRAY) {
+ // Skips arrays using short notation.
+ $nextSeparator = $tokens[$nextSeparator]['bracket_closer'];
+ continue;
+ }
+
+ // Make sure the comma or variable belongs directly to this function call,
+ // and is not inside a nested function call or array.
+ $brackets = $tokens[$nextSeparator]['nested_parenthesis'];
+ $lastBracket = array_pop($brackets);
+ if ($lastBracket !== $closeBracket) {
+ continue;
+ }
+
+ if ($tokens[$nextSeparator]['code'] === T_COMMA) {
+ if ($tokens[($nextSeparator - 1)]['code'] === T_WHITESPACE) {
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextSeparator - 2), null, true);
+ if (isset(Tokens::$heredocTokens[$tokens[$prev]['code']]) === false) {
+ $error = 'Space found before comma in argument list';
+ $fix = $phpcsFile->addFixableError($error, $nextSeparator, 'SpaceBeforeComma');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+
+ if ($tokens[$prev]['line'] !== $tokens[$nextSeparator]['line']) {
+ $phpcsFile->fixer->addContent($prev, ',');
+ $phpcsFile->fixer->replaceToken($nextSeparator, '');
+ } else {
+ $phpcsFile->fixer->replaceToken(($nextSeparator - 1), '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }//end if
+ }//end if
+
+ if ($tokens[($nextSeparator + 1)]['code'] !== T_WHITESPACE) {
+ $error = 'No space found after comma in argument list';
+ $fix = $phpcsFile->addFixableError($error, $nextSeparator, 'NoSpaceAfterComma');
+ if ($fix === true) {
+ $phpcsFile->fixer->addContent($nextSeparator, ' ');
+ }
+ } else {
+ // If there is a newline in the space, then they must be formatting
+ // each argument on a newline, which is valid, so ignore it.
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextSeparator + 1), null, true);
+ if ($tokens[$next]['line'] === $tokens[$nextSeparator]['line']) {
+ $space = $tokens[($nextSeparator + 1)]['length'];
+ if ($space > 1) {
+ $error = 'Expected 1 space after comma in argument list; %s found';
+ $data = [$space];
+ $fix = $phpcsFile->addFixableError($error, $nextSeparator, 'TooMuchSpaceAfterComma', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($nextSeparator + 1), ' ');
+ }
+ }
+ }
+ }//end if
+ }//end if
+ }//end while
+
+ }//end checkSpacing()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php
new file mode 100644
index 00000000..ff19526a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php
@@ -0,0 +1,227 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Functions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class OpeningFunctionBraceBsdAllmanSniff implements Sniff
+{
+
+ /**
+ * Should this sniff check function braces?
+ *
+ * @var boolean
+ */
+ public $checkFunctions = true;
+
+ /**
+ * Should this sniff check closure braces?
+ *
+ * @var boolean
+ */
+ public $checkClosures = false;
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [
+ T_FUNCTION,
+ T_CLOSURE,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if (isset($tokens[$stackPtr]['scope_opener']) === false) {
+ return;
+ }
+
+ if (($tokens[$stackPtr]['code'] === T_FUNCTION
+ && (bool) $this->checkFunctions === false)
+ || ($tokens[$stackPtr]['code'] === T_CLOSURE
+ && (bool) $this->checkClosures === false)
+ ) {
+ return;
+ }
+
+ $openingBrace = $tokens[$stackPtr]['scope_opener'];
+ $closeBracket = $tokens[$stackPtr]['parenthesis_closer'];
+ if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
+ $use = $phpcsFile->findNext(T_USE, ($closeBracket + 1), $tokens[$stackPtr]['scope_opener']);
+ if ($use !== false) {
+ $openBracket = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($use + 1));
+ $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
+ }
+ }
+
+ // Find the end of the function declaration.
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($openingBrace - 1), $closeBracket, true);
+
+ $functionLine = $tokens[$prev]['line'];
+ $braceLine = $tokens[$openingBrace]['line'];
+
+ $lineDifference = ($braceLine - $functionLine);
+
+ $metricType = 'Function';
+ if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
+ $metricType = 'Closure';
+ }
+
+ if ($lineDifference === 0) {
+ $error = 'Opening brace should be on a new line';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceOnSameLine');
+ if ($fix === true) {
+ $hasTrailingAnnotation = false;
+ for ($nextLine = ($openingBrace + 1); $nextLine < $phpcsFile->numTokens; $nextLine++) {
+ if ($tokens[$openingBrace]['line'] !== $tokens[$nextLine]['line']) {
+ break;
+ }
+
+ if (isset(Tokens::$phpcsCommentTokens[$tokens[$nextLine]['code']]) === true) {
+ $hasTrailingAnnotation = true;
+ }
+ }
+
+ $phpcsFile->fixer->beginChangeset();
+ $indent = $phpcsFile->findFirstOnLine([], $openingBrace);
+
+ if ($hasTrailingAnnotation === false || $nextLine === false) {
+ if ($tokens[$indent]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->addContentBefore($openingBrace, $tokens[$indent]['content']);
+ }
+
+ if ($tokens[($openingBrace - 1)]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->replaceToken(($openingBrace - 1), '');
+ }
+
+ $phpcsFile->fixer->addNewlineBefore($openingBrace);
+ } else {
+ $phpcsFile->fixer->replaceToken($openingBrace, '');
+ $phpcsFile->fixer->addNewlineBefore($nextLine);
+ $phpcsFile->fixer->addContentBefore($nextLine, '{');
+
+ if ($tokens[$indent]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->addContentBefore($nextLine, $tokens[$indent]['content']);
+ }
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }//end if
+
+ $phpcsFile->recordMetric($stackPtr, "$metricType opening brace placement", 'same line');
+ } else if ($lineDifference > 1) {
+ $error = 'Opening brace should be on the line after the declaration; found %s blank line(s)';
+ $data = [($lineDifference - 1)];
+
+ $prevNonWs = $phpcsFile->findPrevious(T_WHITESPACE, ($openingBrace - 1), $closeBracket, true);
+ if ($prevNonWs !== $prev) {
+ // There must be a comment between the end of the function declaration and the open brace.
+ // Report, but don't fix.
+ $phpcsFile->addError($error, $openingBrace, 'BraceSpacing', $data);
+ } else {
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceSpacing', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ for ($i = $openingBrace; $i > $prev; $i--) {
+ if ($tokens[$i]['line'] === $tokens[$openingBrace]['line']) {
+ if ($tokens[$i]['column'] === 1) {
+ $phpcsFile->fixer->addNewLineBefore($i);
+ }
+
+ continue;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }
+ }//end if
+ }//end if
+
+ $ignore = Tokens::$phpcsCommentTokens;
+ $ignore[] = T_WHITESPACE;
+ $next = $phpcsFile->findNext($ignore, ($openingBrace + 1), null, true);
+ if ($tokens[$next]['line'] === $tokens[$openingBrace]['line']) {
+ if ($next === $tokens[$stackPtr]['scope_closer']) {
+ // Ignore empty functions.
+ return;
+ }
+
+ $error = 'Opening brace must be the last content on the line';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'ContentAfterBrace');
+ if ($fix === true) {
+ $phpcsFile->fixer->addNewline($openingBrace);
+ }
+ }
+
+ // Only continue checking if the opening brace looks good.
+ if ($lineDifference !== 1) {
+ return;
+ }
+
+ // We need to actually find the first piece of content on this line,
+ // as if this is a method with tokens before it (public, static etc)
+ // or an if with an else before it, then we need to start the scope
+ // checking from there, rather than the current token.
+ $lineStart = $phpcsFile->findFirstOnLine(T_WHITESPACE, $stackPtr, true);
+
+ // The opening brace is on the correct line, now it needs to be
+ // checked to be correctly indented.
+ $startColumn = $tokens[$lineStart]['column'];
+ $braceIndent = $tokens[$openingBrace]['column'];
+
+ if ($braceIndent !== $startColumn) {
+ $expected = ($startColumn - 1);
+ $found = ($braceIndent - 1);
+
+ $error = 'Opening brace indented incorrectly; expected %s spaces, found %s';
+ $data = [
+ $expected,
+ $found,
+ ];
+
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceIndent', $data);
+ if ($fix === true) {
+ $indent = str_repeat(' ', $expected);
+ if ($found === 0) {
+ $phpcsFile->fixer->addContentBefore($openingBrace, $indent);
+ } else {
+ $phpcsFile->fixer->replaceToken(($openingBrace - 1), $indent);
+ }
+ }
+ }//end if
+
+ $phpcsFile->recordMetric($stackPtr, "$metricType opening brace placement", 'new line');
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php
new file mode 100644
index 00000000..62eafc12
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php
@@ -0,0 +1,184 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Functions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class OpeningFunctionBraceKernighanRitchieSniff implements Sniff
+{
+
+ /**
+ * Should this sniff check function braces?
+ *
+ * @var boolean
+ */
+ public $checkFunctions = true;
+
+ /**
+ * Should this sniff check closure braces?
+ *
+ * @var boolean
+ */
+ public $checkClosures = false;
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ return [
+ T_FUNCTION,
+ T_CLOSURE,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if (isset($tokens[$stackPtr]['scope_opener']) === false) {
+ return;
+ }
+
+ if (($tokens[$stackPtr]['code'] === T_FUNCTION
+ && (bool) $this->checkFunctions === false)
+ || ($tokens[$stackPtr]['code'] === T_CLOSURE
+ && (bool) $this->checkClosures === false)
+ ) {
+ return;
+ }
+
+ $openingBrace = $tokens[$stackPtr]['scope_opener'];
+ $closeBracket = $tokens[$stackPtr]['parenthesis_closer'];
+ if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
+ $use = $phpcsFile->findNext(T_USE, ($closeBracket + 1), $tokens[$stackPtr]['scope_opener']);
+ if ($use !== false) {
+ $openBracket = $phpcsFile->findNext(T_OPEN_PARENTHESIS, ($use + 1));
+ $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
+ }
+ }
+
+ // Find the end of the function declaration.
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($openingBrace - 1), $closeBracket, true);
+
+ $functionLine = $tokens[$prev]['line'];
+ $braceLine = $tokens[$openingBrace]['line'];
+
+ $lineDifference = ($braceLine - $functionLine);
+
+ $metricType = 'Function';
+ if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
+ $metricType = 'Closure';
+ }
+
+ if ($lineDifference > 0) {
+ $phpcsFile->recordMetric($stackPtr, "$metricType opening brace placement", 'new line');
+ $error = 'Opening brace should be on the same line as the declaration';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceOnNewLine');
+ if ($fix === true) {
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($openingBrace - 1), $closeBracket, true);
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->addContent($prev, ' {');
+ $phpcsFile->fixer->replaceToken($openingBrace, '');
+ if ($tokens[($openingBrace + 1)]['code'] === T_WHITESPACE
+ && $tokens[($openingBrace + 2)]['line'] > $tokens[$openingBrace]['line']
+ ) {
+ // Brace is followed by a new line, so remove it to ensure we don't
+ // leave behind a blank line at the top of the block.
+ $phpcsFile->fixer->replaceToken(($openingBrace + 1), '');
+
+ if ($tokens[($openingBrace - 1)]['code'] === T_WHITESPACE
+ && $tokens[($openingBrace - 1)]['line'] === $tokens[$openingBrace]['line']
+ && $tokens[($openingBrace - 2)]['line'] < $tokens[$openingBrace]['line']
+ ) {
+ // Brace is preceded by indent, so remove it to ensure we don't
+ // leave behind more indent than is required for the first line.
+ $phpcsFile->fixer->replaceToken(($openingBrace - 1), '');
+ }
+ }
+
+ $phpcsFile->fixer->endChangeset();
+ }//end if
+ } else {
+ $phpcsFile->recordMetric($stackPtr, "$metricType opening brace placement", 'same line');
+ }//end if
+
+ $ignore = Tokens::$phpcsCommentTokens;
+ $ignore[] = T_WHITESPACE;
+ $next = $phpcsFile->findNext($ignore, ($openingBrace + 1), null, true);
+ if ($tokens[$next]['line'] === $tokens[$openingBrace]['line']) {
+ if ($next === $tokens[$stackPtr]['scope_closer']
+ || $tokens[$next]['code'] === T_CLOSE_TAG
+ ) {
+ // Ignore empty functions.
+ return;
+ }
+
+ $error = 'Opening brace must be the last content on the line';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'ContentAfterBrace');
+ if ($fix === true) {
+ $phpcsFile->fixer->addNewline($openingBrace);
+ }
+ }
+
+ // Only continue checking if the opening brace looks good.
+ if ($lineDifference > 0) {
+ return;
+ }
+
+ // We are looking for tabs, even if they have been replaced, because
+ // we enforce a space here.
+ if (isset($tokens[($openingBrace - 1)]['orig_content']) === true) {
+ $spacing = $tokens[($openingBrace - 1)]['orig_content'];
+ } else {
+ $spacing = $tokens[($openingBrace - 1)]['content'];
+ }
+
+ if ($tokens[($openingBrace - 1)]['code'] !== T_WHITESPACE) {
+ $length = 0;
+ } else if ($spacing === "\t") {
+ $length = '\t';
+ } else {
+ $length = strlen($spacing);
+ }
+
+ if ($length !== 1) {
+ $error = 'Expected 1 space before opening brace; found %s';
+ $data = [$length];
+ $fix = $phpcsFile->addFixableError($error, $closeBracket, 'SpaceBeforeBrace', $data);
+ if ($fix === true) {
+ if ($length === 0 || $length === '\t') {
+ $phpcsFile->fixer->addContentBefore($openingBrace, ' ');
+ } else {
+ $phpcsFile->fixer->replaceToken(($openingBrace - 1), ' ');
+ }
+ }
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php
new file mode 100644
index 00000000..9bd0dff3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php
@@ -0,0 +1,117 @@
+
+ * @author Greg Sherwood
+ * @copyright 2007-2014 Mayflower GmbH
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class CyclomaticComplexitySniff implements Sniff
+{
+
+ /**
+ * A complexity higher than this value will throw a warning.
+ *
+ * @var integer
+ */
+ public $complexity = 10;
+
+ /**
+ * A complexity higher than this value will throw an error.
+ *
+ * @var integer
+ */
+ public $absoluteComplexity = 20;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_FUNCTION];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Ignore abstract methods.
+ if (isset($tokens[$stackPtr]['scope_opener']) === false) {
+ return;
+ }
+
+ // Detect start and end of this function definition.
+ $start = $tokens[$stackPtr]['scope_opener'];
+ $end = $tokens[$stackPtr]['scope_closer'];
+
+ // Predicate nodes for PHP.
+ $find = [
+ T_CASE => true,
+ T_DEFAULT => true,
+ T_CATCH => true,
+ T_IF => true,
+ T_FOR => true,
+ T_FOREACH => true,
+ T_WHILE => true,
+ T_ELSEIF => true,
+ T_INLINE_THEN => true,
+ T_COALESCE => true,
+ T_COALESCE_EQUAL => true,
+ T_MATCH_ARROW => true,
+ T_NULLSAFE_OBJECT_OPERATOR => true,
+ ];
+
+ $complexity = 1;
+
+ // Iterate from start to end and count predicate nodes.
+ for ($i = ($start + 1); $i < $end; $i++) {
+ if (isset($find[$tokens[$i]['code']]) === true) {
+ $complexity++;
+ }
+ }
+
+ if ($complexity > $this->absoluteComplexity) {
+ $error = 'Function\'s cyclomatic complexity (%s) exceeds allowed maximum of %s';
+ $data = [
+ $complexity,
+ $this->absoluteComplexity,
+ ];
+ $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data);
+ } else if ($complexity > $this->complexity) {
+ $warning = 'Function\'s cyclomatic complexity (%s) exceeds %s; consider refactoring the function';
+ $data = [
+ $complexity,
+ $this->complexity,
+ ];
+ $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php
new file mode 100644
index 00000000..d001deda
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php
@@ -0,0 +1,100 @@
+
+ * @author Greg Sherwood
+ * @copyright 2007-2014 Mayflower GmbH
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class NestingLevelSniff implements Sniff
+{
+
+ /**
+ * A nesting level higher than this value will throw a warning.
+ *
+ * @var integer
+ */
+ public $nestingLevel = 5;
+
+ /**
+ * A nesting level higher than this value will throw an error.
+ *
+ * @var integer
+ */
+ public $absoluteNestingLevel = 10;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_FUNCTION];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Ignore abstract methods.
+ if (isset($tokens[$stackPtr]['scope_opener']) === false) {
+ return;
+ }
+
+ // Detect start and end of this function definition.
+ $start = $tokens[$stackPtr]['scope_opener'];
+ $end = $tokens[$stackPtr]['scope_closer'];
+
+ $nestingLevel = 0;
+
+ // Find the maximum nesting level of any token in the function.
+ for ($i = ($start + 1); $i < $end; $i++) {
+ $level = $tokens[$i]['level'];
+ if ($nestingLevel < $level) {
+ $nestingLevel = $level;
+ }
+ }
+
+ // We subtract the nesting level of the function itself.
+ $nestingLevel = ($nestingLevel - $tokens[$stackPtr]['level'] - 1);
+
+ if ($nestingLevel > $this->absoluteNestingLevel) {
+ $error = 'Function\'s nesting level (%s) exceeds allowed maximum of %s';
+ $data = [
+ $nestingLevel,
+ $this->absoluteNestingLevel,
+ ];
+ $phpcsFile->addError($error, $stackPtr, 'MaxExceeded', $data);
+ } else if ($nestingLevel > $this->nestingLevel) {
+ $warning = 'Function\'s nesting level (%s) exceeds %s; consider refactoring the function';
+ $data = [
+ $nestingLevel,
+ $this->nestingLevel,
+ ];
+ $phpcsFile->addWarning($warning, $stackPtr, 'TooHigh', $data);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/AbstractClassNamePrefixSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/AbstractClassNamePrefixSniff.php
new file mode 100644
index 00000000..3e3af830
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/AbstractClassNamePrefixSniff.php
@@ -0,0 +1,60 @@
+
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class AbstractClassNamePrefixSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_CLASS];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ if ($phpcsFile->getClassProperties($stackPtr)['is_abstract'] === false) {
+ // This class is not abstract so we don't need to check it.
+ return;
+ }
+
+ $className = $phpcsFile->getDeclarationName($stackPtr);
+ if ($className === null) {
+ // We are not interested in anonymous classes.
+ return;
+ }
+
+ $prefix = substr($className, 0, 8);
+ if (strtolower($prefix) !== 'abstract') {
+ $phpcsFile->addError('Abstract class names must be prefixed with "Abstract"; found "%s"', $stackPtr, 'Missing', [$className]);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
new file mode 100644
index 00000000..b4511203
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
@@ -0,0 +1,223 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\AbstractScopeSniff;
+use PHP_CodeSniffer\Util\Common;
+use PHP_CodeSniffer\Util\Tokens;
+
+class CamelCapsFunctionNameSniff extends AbstractScopeSniff
+{
+
+ /**
+ * A list of all PHP magic methods.
+ *
+ * @var array
+ */
+ protected $magicMethods = [
+ 'construct' => true,
+ 'destruct' => true,
+ 'call' => true,
+ 'callstatic' => true,
+ 'get' => true,
+ 'set' => true,
+ 'isset' => true,
+ 'unset' => true,
+ 'sleep' => true,
+ 'wakeup' => true,
+ 'serialize' => true,
+ 'unserialize' => true,
+ 'tostring' => true,
+ 'invoke' => true,
+ 'set_state' => true,
+ 'clone' => true,
+ 'debuginfo' => true,
+ ];
+
+ /**
+ * A list of all PHP non-magic methods starting with a double underscore.
+ *
+ * These come from PHP modules such as SOAPClient.
+ *
+ * @var array
+ */
+ protected $methodsDoubleUnderscore = [
+ 'dorequest' => true,
+ 'getcookies' => true,
+ 'getfunctions' => true,
+ 'getlastrequest' => true,
+ 'getlastrequestheaders' => true,
+ 'getlastresponse' => true,
+ 'getlastresponseheaders' => true,
+ 'gettypes' => true,
+ 'setcookie' => true,
+ 'setlocation' => true,
+ 'setsoapheaders' => true,
+ 'soapcall' => true,
+ ];
+
+ /**
+ * A list of all PHP magic functions.
+ *
+ * @var array
+ */
+ protected $magicFunctions = ['autoload' => true];
+
+ /**
+ * If TRUE, the string must not have two capital letters next to each other.
+ *
+ * @var boolean
+ */
+ public $strict = true;
+
+
+ /**
+ * Constructs a Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff.
+ */
+ public function __construct()
+ {
+ parent::__construct(Tokens::$ooScopeTokens, [T_FUNCTION], true);
+
+ }//end __construct()
+
+
+ /**
+ * Processes the tokens within the scope.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being processed.
+ * @param int $stackPtr The position where this token was
+ * found.
+ * @param int $currScope The position of the current scope.
+ *
+ * @return void
+ */
+ protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Determine if this is a function which needs to be examined.
+ $conditions = $tokens[$stackPtr]['conditions'];
+ end($conditions);
+ $deepestScope = key($conditions);
+ if ($deepestScope !== $currScope) {
+ return;
+ }
+
+ $methodName = $phpcsFile->getDeclarationName($stackPtr);
+ if ($methodName === null) {
+ // Ignore closures.
+ return;
+ }
+
+ $className = $phpcsFile->getDeclarationName($currScope);
+ if (isset($className) === false) {
+ $className = '[Anonymous Class]';
+ }
+
+ $errorData = [$className.'::'.$methodName];
+
+ $methodNameLc = strtolower($methodName);
+ $classNameLc = strtolower($className);
+
+ // Is this a magic method. i.e., is prefixed with "__" ?
+ if (preg_match('|^__[^_]|', $methodName) !== 0) {
+ $magicPart = substr($methodNameLc, 2);
+ if (isset($this->magicMethods[$magicPart]) === true
+ || isset($this->methodsDoubleUnderscore[$magicPart]) === true
+ ) {
+ return;
+ }
+
+ $error = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
+ $phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
+ }
+
+ // PHP4 constructors are allowed to break our rules.
+ if ($methodNameLc === $classNameLc) {
+ return;
+ }
+
+ // PHP4 destructors are allowed to break our rules.
+ if ($methodNameLc === '_'.$classNameLc) {
+ return;
+ }
+
+ // Ignore first underscore in methods prefixed with "_".
+ $methodName = ltrim($methodName, '_');
+
+ $methodProps = $phpcsFile->getMethodProperties($stackPtr);
+ if (Common::isCamelCaps($methodName, false, true, $this->strict) === false) {
+ if ($methodProps['scope_specified'] === true) {
+ $error = '%s method name "%s" is not in camel caps format';
+ $data = [
+ ucfirst($methodProps['scope']),
+ $errorData[0],
+ ];
+ $phpcsFile->addError($error, $stackPtr, 'ScopeNotCamelCaps', $data);
+ } else {
+ $error = 'Method name "%s" is not in camel caps format';
+ $phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'no');
+ return;
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'yes');
+ }
+
+ }//end processTokenWithinScope()
+
+
+ /**
+ * Processes the tokens outside the scope.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being processed.
+ * @param int $stackPtr The position where this token was
+ * found.
+ *
+ * @return void
+ */
+ protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
+ {
+ $functionName = $phpcsFile->getDeclarationName($stackPtr);
+ if ($functionName === null) {
+ // Ignore closures.
+ return;
+ }
+
+ $errorData = [$functionName];
+
+ // Is this a magic function. i.e., it is prefixed with "__".
+ if (preg_match('|^__[^_]|', $functionName) !== 0) {
+ $magicPart = strtolower(substr($functionName, 2));
+ if (isset($this->magicFunctions[$magicPart]) === true) {
+ return;
+ }
+
+ $error = 'Function name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
+ $phpcsFile->addError($error, $stackPtr, 'FunctionDoubleUnderscore', $errorData);
+ }
+
+ // Ignore first underscore in functions prefixed with "_".
+ $functionName = ltrim($functionName, '_');
+
+ if (Common::isCamelCaps($functionName, false, true, $this->strict) === false) {
+ $error = 'Function name "%s" is not in camel caps format';
+ $phpcsFile->addError($error, $stackPtr, 'NotCamelCaps', $errorData);
+ $phpcsFile->recordMetric($stackPtr, 'CamelCase function name', 'no');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'CamelCase method name', 'yes');
+ }
+
+ }//end processTokenOutsideScope()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php
new file mode 100644
index 00000000..a4196063
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php
@@ -0,0 +1,163 @@
+
+ * @author Leif Wickland
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\AbstractScopeSniff;
+
+class ConstructorNameSniff extends AbstractScopeSniff
+{
+
+ /**
+ * The name of the class we are currently checking.
+ *
+ * @var string
+ */
+ private $currentClass = '';
+
+ /**
+ * A list of functions in the current class.
+ *
+ * @var string[]
+ */
+ private $functionList = [];
+
+
+ /**
+ * Constructs the test with the tokens it wishes to listen for.
+ */
+ public function __construct()
+ {
+ parent::__construct([T_CLASS, T_ANON_CLASS], [T_FUNCTION], true);
+
+ }//end __construct()
+
+
+ /**
+ * Processes this test when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param int $currScope A pointer to the start of the scope.
+ *
+ * @return void
+ */
+ protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Determine if this is a function which needs to be examined.
+ $conditions = $tokens[$stackPtr]['conditions'];
+ end($conditions);
+ $deepestScope = key($conditions);
+ if ($deepestScope !== $currScope) {
+ return;
+ }
+
+ $className = $phpcsFile->getDeclarationName($currScope);
+ if (empty($className) === false) {
+ // Not an anonymous class.
+ $className = strtolower($className);
+ }
+
+ if ($className !== $this->currentClass) {
+ $this->loadFunctionNamesInScope($phpcsFile, $currScope);
+ $this->currentClass = $className;
+ }
+
+ $methodName = strtolower($phpcsFile->getDeclarationName($stackPtr));
+
+ if ($methodName === $className) {
+ if (in_array('__construct', $this->functionList, true) === false) {
+ $error = 'PHP4 style constructors are not allowed; use "__construct()" instead';
+ $phpcsFile->addError($error, $stackPtr, 'OldStyle');
+ }
+ } else if ($methodName !== '__construct') {
+ // Not a constructor.
+ return;
+ }
+
+ // Stop if the constructor doesn't have a body, like when it is abstract.
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
+ return;
+ }
+
+ $parentClassName = strtolower($phpcsFile->findExtendedClassName($currScope));
+ if ($parentClassName === false) {
+ return;
+ }
+
+ $endFunctionIndex = $tokens[$stackPtr]['scope_closer'];
+ $startIndex = $stackPtr;
+ while (($doubleColonIndex = $phpcsFile->findNext(T_DOUBLE_COLON, $startIndex, $endFunctionIndex)) !== false) {
+ if ($tokens[($doubleColonIndex + 1)]['code'] === T_STRING
+ && strtolower($tokens[($doubleColonIndex + 1)]['content']) === $parentClassName
+ ) {
+ $error = 'PHP4 style calls to parent constructors are not allowed; use "parent::__construct()" instead';
+ $phpcsFile->addError($error, ($doubleColonIndex + 1), 'OldStyleCall');
+ }
+
+ $startIndex = ($doubleColonIndex + 1);
+ }
+
+ }//end processTokenWithinScope()
+
+
+ /**
+ * Processes a token that is found within the scope that this test is
+ * listening to.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
+ * @param int $stackPtr The position in the stack where this
+ * token was found.
+ *
+ * @return void
+ */
+ protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
+ {
+
+ }//end processTokenOutsideScope()
+
+
+ /**
+ * Extracts all the function names found in the given scope.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The current file being scanned.
+ * @param int $currScope A pointer to the start of the scope.
+ *
+ * @return void
+ */
+ protected function loadFunctionNamesInScope(File $phpcsFile, $currScope)
+ {
+ $this->functionList = [];
+ $tokens = $phpcsFile->getTokens();
+
+ for ($i = ($tokens[$currScope]['scope_opener'] + 1); $i < $tokens[$currScope]['scope_closer']; $i++) {
+ if ($tokens[$i]['code'] !== T_FUNCTION) {
+ continue;
+ }
+
+ $this->functionList[] = trim(strtolower($phpcsFile->getDeclarationName($i)));
+
+ if (isset($tokens[$i]['scope_closer']) !== false) {
+ // Skip past nested functions and such.
+ $i = $tokens[$i]['scope_closer'];
+ }
+ }
+
+ }//end loadFunctionNamesInScope()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/InterfaceNameSuffixSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/InterfaceNameSuffixSniff.php
new file mode 100644
index 00000000..c5dc34d4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/InterfaceNameSuffixSniff.php
@@ -0,0 +1,54 @@
+
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class InterfaceNameSuffixSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_INTERFACE];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $interfaceName = $phpcsFile->getDeclarationName($stackPtr);
+ if ($interfaceName === null) {
+ return;
+ }
+
+ $suffix = substr($interfaceName, -9);
+ if (strtolower($suffix) !== 'interface') {
+ $phpcsFile->addError('Interface names must be suffixed with "Interface"; found "%s"', $stackPtr, 'Missing', [$interfaceName]);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/TraitNameSuffixSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/TraitNameSuffixSniff.php
new file mode 100644
index 00000000..4e3b211d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/TraitNameSuffixSniff.php
@@ -0,0 +1,54 @@
+
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class TraitNameSuffixSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return [T_TRAIT];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $traitName = $phpcsFile->getDeclarationName($stackPtr);
+ if ($traitName === null) {
+ return;
+ }
+
+ $suffix = substr($traitName, -5);
+ if (strtolower($suffix) !== 'trait') {
+ $phpcsFile->addError('Trait names must be suffixed with "Trait"; found "%s"', $stackPtr, 'Missing', [$traitName]);
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php
new file mode 100644
index 00000000..db50eb56
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php
@@ -0,0 +1,141 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UpperCaseConstantNameSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_STRING,
+ T_CONST,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in the
+ * stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ if ($tokens[$stackPtr]['code'] === T_CONST) {
+ // This is a class constant.
+ $constant = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
+ if ($constant === false) {
+ return;
+ }
+
+ $constName = $tokens[$constant]['content'];
+
+ if (strtoupper($constName) !== $constName) {
+ if (strtolower($constName) === $constName) {
+ $phpcsFile->recordMetric($constant, 'Constant name case', 'lower');
+ } else {
+ $phpcsFile->recordMetric($constant, 'Constant name case', 'mixed');
+ }
+
+ $error = 'Class constants must be uppercase; expected %s but found %s';
+ $data = [
+ strtoupper($constName),
+ $constName,
+ ];
+ $phpcsFile->addError($error, $constant, 'ClassConstantNotUpperCase', $data);
+ } else {
+ $phpcsFile->recordMetric($constant, 'Constant name case', 'upper');
+ }
+
+ return;
+ }//end if
+
+ // Only interested in define statements now.
+ if (strtolower($tokens[$stackPtr]['content']) !== 'define') {
+ return;
+ }
+
+ // Make sure this is not a method call.
+ $prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
+ if ($tokens[$prev]['code'] === T_OBJECT_OPERATOR
+ || $tokens[$prev]['code'] === T_DOUBLE_COLON
+ || $tokens[$prev]['code'] === T_NULLSAFE_OBJECT_OPERATOR
+ ) {
+ return;
+ }
+
+ // If the next non-whitespace token after this token
+ // is not an opening parenthesis then it is not a function call.
+ $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
+ if ($openBracket === false) {
+ return;
+ }
+
+ // The next non-whitespace token must be the constant name.
+ $constPtr = $phpcsFile->findNext(T_WHITESPACE, ($openBracket + 1), null, true);
+ if ($tokens[$constPtr]['code'] !== T_CONSTANT_ENCAPSED_STRING) {
+ return;
+ }
+
+ $constName = $tokens[$constPtr]['content'];
+
+ // Check for constants like self::CONSTANT.
+ $prefix = '';
+ $splitPos = strpos($constName, '::');
+ if ($splitPos !== false) {
+ $prefix = substr($constName, 0, ($splitPos + 2));
+ $constName = substr($constName, ($splitPos + 2));
+ }
+
+ // Strip namespace from constant like /foo/bar/CONSTANT.
+ $splitPos = strrpos($constName, '\\');
+ if ($splitPos !== false) {
+ $prefix = substr($constName, 0, ($splitPos + 1));
+ $constName = substr($constName, ($splitPos + 1));
+ }
+
+ if (strtoupper($constName) !== $constName) {
+ if (strtolower($constName) === $constName) {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'lower');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'mixed');
+ }
+
+ $error = 'Constants must be uppercase; expected %s but found %s';
+ $data = [
+ $prefix.strtoupper($constName),
+ $prefix.$constName,
+ ];
+ $phpcsFile->addError($error, $stackPtr, 'ConstantNotUpperCase', $data);
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'upper');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/BacktickOperatorSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/BacktickOperatorSniff.php
new file mode 100644
index 00000000..d455845b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/BacktickOperatorSniff.php
@@ -0,0 +1,48 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class BacktickOperatorSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_BACKTICK];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $error = 'Use of the backtick operator is forbidden';
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php
new file mode 100644
index 00000000..f52180dd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php
@@ -0,0 +1,86 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class CharacterBeforePHPOpeningTagSniff implements Sniff
+{
+
+ /**
+ * List of supported BOM definitions.
+ *
+ * Use encoding names as keys and hex BOM representations as values.
+ *
+ * @var array
+ */
+ protected $bomDefinitions = [
+ 'UTF-8' => 'efbbbf',
+ 'UTF-16 (BE)' => 'feff',
+ 'UTF-16 (LE)' => 'fffe',
+ ];
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [T_OPEN_TAG];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return int
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $expected = 0;
+ if ($stackPtr > 0) {
+ // Allow a byte-order mark.
+ $tokens = $phpcsFile->getTokens();
+ foreach ($this->bomDefinitions as $bomName => $expectedBomHex) {
+ $bomByteLength = (strlen($expectedBomHex) / 2);
+ $htmlBomHex = bin2hex(substr($tokens[0]['content'], 0, $bomByteLength));
+ if ($htmlBomHex === $expectedBomHex) {
+ $expected++;
+ break;
+ }
+ }
+
+ // Allow a shebang line.
+ if (substr($tokens[0]['content'], 0, 2) === '#!') {
+ $expected++;
+ }
+ }
+
+ if ($stackPtr !== $expected) {
+ $error = 'The opening PHP tag must be the first content in the file';
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+ }
+
+ // Skip the rest of the file so we don't pick up additional
+ // open tags, typically embedded in HTML.
+ return $phpcsFile->numTokens;
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ClosingPHPTagSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ClosingPHPTagSniff.php
new file mode 100644
index 00000000..d03bf8ab
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ClosingPHPTagSniff.php
@@ -0,0 +1,54 @@
+
+ * @copyright 2010-2014 Stefano Kowalke
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP;
+
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class ClosingPHPTagSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this sniff, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $closeTag = $phpcsFile->findNext(T_CLOSE_TAG, $stackPtr);
+ if ($closeTag === false) {
+ $error = 'The PHP open tag does not have a corresponding PHP close tag';
+ $phpcsFile->addError($error, $stackPtr, 'NotFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php
new file mode 100644
index 00000000..42eaa40f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php
@@ -0,0 +1,73 @@
+
+ * @author Greg Sherwood
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP;
+
+class DeprecatedFunctionsSniff extends ForbiddenFunctionsSniff
+{
+
+ /**
+ * A list of forbidden functions with their alternatives.
+ *
+ * The value is NULL if no alternative exists. IE, the
+ * function should just not be used.
+ *
+ * @var array
+ */
+ public $forbiddenFunctions = [];
+
+
+ /**
+ * Constructor.
+ *
+ * Uses the Reflection API to get a list of deprecated functions.
+ */
+ public function __construct()
+ {
+ $functions = get_defined_functions();
+
+ foreach ($functions['internal'] as $functionName) {
+ $function = new \ReflectionFunction($functionName);
+
+ if ($function->isDeprecated() === true) {
+ $this->forbiddenFunctions[$functionName] = null;
+ }
+ }
+
+ }//end __construct()
+
+
+ /**
+ * Generates the error or warning for this sniff.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the forbidden function
+ * in the token array.
+ * @param string $function The name of the forbidden function.
+ * @param string $pattern The pattern used for the match.
+ *
+ * @return void
+ */
+ protected function addError($phpcsFile, $stackPtr, $function, $pattern=null)
+ {
+ $data = [$function];
+ $error = 'Function %s() has been deprecated';
+ $type = 'Deprecated';
+
+ if ($this->error === true) {
+ $phpcsFile->addError($error, $stackPtr, $type, $data);
+ } else {
+ $phpcsFile->addWarning($error, $stackPtr, $type, $data);
+ }
+
+ }//end addError()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php
new file mode 100644
index 00000000..433750ad
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php
@@ -0,0 +1,253 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Sniffs\PHP;
+
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Sniffs\Sniff;
+
+class DisallowAlternativePHPTagsSniff implements Sniff
+{
+
+ /**
+ * Whether ASP tags are enabled or not.
+ *
+ * @var boolean
+ */
+ private $aspTags = false;
+
+ /**
+ * The current PHP version.
+ *
+ * @var integer
+ */
+ private $phpVersion = null;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ if ($this->phpVersion === null) {
+ $this->phpVersion = Config::getConfigData('php_version');
+ if ($this->phpVersion === null) {
+ $this->phpVersion = PHP_VERSION_ID;
+ }
+ }
+
+ if ($this->phpVersion < 70000) {
+ $this->aspTags = (bool) ini_get('asp_tags');
+ }
+
+ return [
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ T_INLINE_HTML,
+ ];
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ $openTag = $tokens[$stackPtr];
+ $content = $openTag['content'];
+
+ if (trim($content) === '') {
+ return;
+ }
+
+ if ($openTag['code'] === T_OPEN_TAG) {
+ if ($content === '<%') {
+ $error = 'ASP style opening tag used; expected "findClosingTag($phpcsFile, $tokens, $stackPtr, '%>');
+ $errorCode = 'ASPOpenTagFound';
+ } else if (strpos($content, '');
+ $errorCode = 'ScriptOpenTagFound';
+ }
+
+ if (isset($error, $closer, $errorCode) === true) {
+ $data = [$content];
+
+ if ($closer === false) {
+ $phpcsFile->addError($error, $stackPtr, $errorCode, $data);
+ } else {
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, $errorCode, $data);
+ if ($fix === true) {
+ $this->addChangeset($phpcsFile, $tokens, $stackPtr, $closer);
+ }
+ }
+ }
+
+ return;
+ }//end if
+
+ if ($openTag['code'] === T_OPEN_TAG_WITH_ECHO && $content === '<%=') {
+ $error = 'ASP style opening tag used with echo; expected "findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ $snippet = $this->getSnippet($tokens[$nextVar]['content']);
+ $data = [
+ $snippet,
+ $content,
+ $snippet,
+ ];
+
+ $closer = $this->findClosingTag($phpcsFile, $tokens, $stackPtr, '%>');
+
+ if ($closer === false) {
+ $phpcsFile->addError($error, $stackPtr, 'ASPShortOpenTagFound', $data);
+ } else {
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'ASPShortOpenTagFound', $data);
+ if ($fix === true) {
+ $this->addChangeset($phpcsFile, $tokens, $stackPtr, $closer, true);
+ }
+ }
+
+ return;
+ }//end if
+
+ // Account for incorrect script open tags.
+ if ($openTag['code'] === T_INLINE_HTML
+ && preg_match('`(
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc.fixed
new file mode 100644
index 00000000..2a695c89
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc.fixed
@@ -0,0 +1,14 @@
+
+
+Some content here.
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc
new file mode 100644
index 00000000..cd5a6620
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc
@@ -0,0 +1,6 @@
+
+<% echo $var; %>
+
Some text <% echo $var; %> and some more text
+<%= $var . ' and some more text to make sure the snippet works'; %>
+
Some text <%= $var %> and some more text
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc.fixed
new file mode 100644
index 00000000..6eafb422
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.2.inc.fixed
@@ -0,0 +1,6 @@
+
+
+
Some text and some more text
+
+
Some text and some more text
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.3.inc
new file mode 100644
index 00000000..ba86345a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.3.inc
@@ -0,0 +1,7 @@
+
+
+<% echo $var; %>
+
Some text <% echo $var; %> and some more text
+<%= $var . ' and some more text to make sure the snippet works'; %>
+
Some text <%= $var %> and some more text
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php
new file mode 100644
index 00000000..953e8ad9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php
@@ -0,0 +1,105 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowAlternativePHPTagsUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Get a list of all test files to check.
+ *
+ * @param string $testFileBase The base path that the unit tests files will have.
+ *
+ * @return string[]
+ */
+ protected function getTestFiles($testFileBase)
+ {
+ $testFiles = [$testFileBase.'1.inc'];
+
+ $aspTags = false;
+ if (PHP_VERSION_ID < 70000) {
+ $aspTags = (bool) ini_get('asp_tags');
+ }
+
+ if ($aspTags === true) {
+ $testFiles[] = $testFileBase.'2.inc';
+ } else {
+ $testFiles[] = $testFileBase.'3.inc';
+ }
+
+ return $testFiles;
+
+ }//end getTestFiles()
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='')
+ {
+ switch ($testFile) {
+ case 'DisallowAlternativePHPTagsUnitTest.1.inc':
+ return [
+ 4 => 1,
+ 7 => 1,
+ 8 => 1,
+ 11 => 1,
+ ];
+ case 'DisallowAlternativePHPTagsUnitTest.2.inc':
+ return [
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 5 => 1,
+ ];
+ default:
+ return [];
+ }//end switch
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getWarningList($testFile='')
+ {
+ if ($testFile === 'DisallowAlternativePHPTagsUnitTest.3.inc') {
+ return [
+ 3 => 1,
+ 4 => 1,
+ 5 => 1,
+ 6 => 1,
+ ];
+ }
+
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.inc
new file mode 100644
index 00000000..974e45c0
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.inc
@@ -0,0 +1,16 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php
new file mode 100644
index 00000000..7ece5512
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowRequestSuperglobalUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ protected function getErrorList()
+ {
+ return [
+ 2 => 1,
+ 12 => 1,
+ 13 => 1,
+ ];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ protected function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc
new file mode 100644
index 00000000..040e62dc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc
@@ -0,0 +1,11 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc.fixed
new file mode 100644
index 00000000..1ea281a4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc.fixed
@@ -0,0 +1,11 @@
+
+
+Some content here.
+
+
+Some content Some more content
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc
new file mode 100644
index 00000000..85617ded
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc
@@ -0,0 +1,8 @@
+
+ echo $var; ?>
+Some content echo $var ?> Some more content
+
+echo $var;
+?>
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc.fixed
new file mode 100644
index 00000000..afe5d8f2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.2.inc.fixed
@@ -0,0 +1,8 @@
+
+
+Some content Some more content
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.3.inc
new file mode 100644
index 00000000..9b7ccd6d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.3.inc
@@ -0,0 +1,16 @@
+// Test warning for when short_open_tag is off.
+
+Some content echo $var; ?> Some more content
+
+// Test multi-line.
+Some content
+echo $var;
+?> Some more content
+
+// Make sure skipping works.
+Some content
+echo '';
+?> Some more content
+
+// Only recognize closing tag after opener.
+Some?> content
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php
new file mode 100644
index 00000000..b79572ce
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php
@@ -0,0 +1,103 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowShortOpenTagUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Get a list of all test files to check.
+ *
+ * @param string $testFileBase The base path that the unit tests files will have.
+ *
+ * @return string[]
+ */
+ protected function getTestFiles($testFileBase)
+ {
+ $testFiles = [$testFileBase.'1.inc'];
+
+ $option = (bool) ini_get('short_open_tag');
+ if ($option === true) {
+ $testFiles[] = $testFileBase.'2.inc';
+ } else {
+ $testFiles[] = $testFileBase.'3.inc';
+ }
+
+ return $testFiles;
+
+ }//end getTestFiles()
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='')
+ {
+ switch ($testFile) {
+ case 'DisallowShortOpenTagUnitTest.1.inc':
+ return [
+ 5 => 1,
+ 6 => 1,
+ 7 => 1,
+ 10 => 1,
+ ];
+ case 'DisallowShortOpenTagUnitTest.2.inc':
+ return [
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ ];
+ default:
+ return [];
+ }//end switch
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getWarningList($testFile='')
+ {
+ switch ($testFile) {
+ case 'DisallowShortOpenTagUnitTest.1.inc':
+ return [];
+ case 'DisallowShortOpenTagUnitTest.3.inc':
+ return [
+ 3 => 1,
+ 6 => 1,
+ 11 => 1,
+ ];
+ default:
+ return [];
+ }//end switch
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DiscourageGotoUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DiscourageGotoUnitTest.inc
new file mode 100644
index 00000000..f564215b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DiscourageGotoUnitTest.inc
@@ -0,0 +1,18 @@
+
+ * @copyright 2006-2017 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DiscourageGotoUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [
+ 3 => 1,
+ 6 => 1,
+ 11 => 1,
+ 16 => 1,
+ ];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.inc
new file mode 100644
index 00000000..b30f0dde
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.inc
@@ -0,0 +1,57 @@
+sizeof($array);
+$size = $class->count($array);
+$class->delete($filepath);
+$class->unset($filepath);
+
+function delete() {}
+function unset() {}
+function sizeof() {}
+function count() {}
+
+trait DelProvider {
+ public function delete() {
+ //irrelevant
+ }
+}
+
+class LeftSideTest {
+ use DelProvider {
+ delete as protected unsetter;
+ }
+}
+
+class RightSideTest {
+ use DelProvider {
+ delete as delete;
+ }
+}
+
+class RightSideVisTest {
+ use DelProvider {
+ delete as protected delete;
+ DelProvider::delete insteadof delete;
+ }
+}
+
+namespace Something\sizeof;
+$var = new Sizeof();
+class SizeOf implements Something {}
+
+function mymodule_form_callback(SizeOf $sizeof) {
+}
+
+$size = $class?->sizeof($array);
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php
new file mode 100644
index 00000000..760e8078
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php
@@ -0,0 +1,54 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ForbiddenFunctionsUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ $errors = [
+ 2 => 1,
+ 4 => 1,
+ 6 => 1,
+ ];
+
+ return $errors;
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
new file mode 100644
index 00000000..0307a055
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
@@ -0,0 +1,100 @@
+NULL = 7;
+
+use Zend\Log\Writer\NULL as NullWriter;
+new \Zend\Log\Writer\NULL();
+
+namespace False;
+
+class True extends Null implements False {}
+
+use True\Something;
+use Something\True;
+class MyClass
+{
+ public function myFunction()
+ {
+ $var = array('foo' => new True());
+ }
+}
+
+$x = $f?FALSE:true;
+$x = $f? FALSE:true;
+
+class MyClass
+{
+ // Spice things up a little.
+ const TRUE = false;
+}
+
+var_dump(MyClass::TRUE);
+
+function tRUE() {}
+
+$input->getFilterChain()->attachByName('Null', ['type' => Null::TYPE_STRING]);
+
+// Issue #3332 - ignore type declarations, but not default values.
+class TypedThings {
+ const MYCONST = FALSE;
+
+ public int|FALSE $int = FALSE;
+ public Type|NULL $int = new MyObj(NULL);
+
+ private function typed(int|FALSE $param = NULL, Type|NULL $obj = new MyObj(FALSE)) : string|FALSE|NULL
+ {
+ if (TRUE === FALSE) {
+ return NULL;
+ }
+ }
+}
+
+$cl = function (int|FALSE $param = NULL, Type|NULL $obj = new MyObj(FALSE)) : string|FALSE|NULL {};
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc.fixed
new file mode 100644
index 00000000..3a6b094c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc.fixed
@@ -0,0 +1,100 @@
+NULL = 7;
+
+use Zend\Log\Writer\NULL as NullWriter;
+new \Zend\Log\Writer\NULL();
+
+namespace False;
+
+class True extends Null implements False {}
+
+use True\Something;
+use Something\True;
+class MyClass
+{
+ public function myFunction()
+ {
+ $var = array('foo' => new True());
+ }
+}
+
+$x = $f?false:true;
+$x = $f? false:true;
+
+class MyClass
+{
+ // Spice things up a little.
+ const TRUE = false;
+}
+
+var_dump(MyClass::TRUE);
+
+function tRUE() {}
+
+$input->getFilterChain()->attachByName('Null', ['type' => Null::TYPE_STRING]);
+
+// Issue #3332 - ignore type declarations, but not default values.
+class TypedThings {
+ const MYCONST = false;
+
+ public int|FALSE $int = false;
+ public Type|NULL $int = new MyObj(null);
+
+ private function typed(int|FALSE $param = null, Type|NULL $obj = new MyObj(false)) : string|FALSE|NULL
+ {
+ if (true === false) {
+ return null;
+ }
+ }
+}
+
+$cl = function (int|FALSE $param = null, Type|NULL $obj = new MyObj(false)) : string|FALSE|NULL {};
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js
new file mode 100644
index 00000000..87cfb820
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js
@@ -0,0 +1,14 @@
+if (variable === true) { }
+if (variable === TRUE) { }
+if (variable === True) { }
+variable = True;
+
+if (variable === false) { }
+if (variable === FALSE) { }
+if (variable === False) { }
+variable = false;
+
+if (variable === null) { }
+if (variable === NULL) { }
+if (variable === Null) { }
+variable = NULL;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js.fixed
new file mode 100644
index 00000000..7dbf3adf
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js.fixed
@@ -0,0 +1,14 @@
+if (variable === true) { }
+if (variable === true) { }
+if (variable === true) { }
+variable = true;
+
+if (variable === false) { }
+if (variable === false) { }
+if (variable === false) { }
+variable = false;
+
+if (variable === null) { }
+if (variable === null) { }
+if (variable === null) { }
+variable = null;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php
new file mode 100644
index 00000000..2fb2d6f6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php
@@ -0,0 +1,91 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LowerCaseConstantUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'LowerCaseConstantUnitTest.inc':
+ return [
+ 7 => 1,
+ 10 => 1,
+ 15 => 1,
+ 16 => 1,
+ 23 => 1,
+ 26 => 1,
+ 31 => 1,
+ 32 => 1,
+ 39 => 1,
+ 42 => 1,
+ 47 => 1,
+ 48 => 1,
+ 70 => 1,
+ 71 => 1,
+ 87 => 1,
+ 89 => 1,
+ 90 => 1,
+ 92 => 2,
+ 94 => 2,
+ 95 => 1,
+ 100 => 2,
+ ];
+ break;
+ case 'LowerCaseConstantUnitTest.js':
+ return [
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ 8 => 1,
+ 12 => 1,
+ 13 => 1,
+ 14 => 1,
+ ];
+ break;
+ default:
+ return [];
+ break;
+ }//end switch
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc
new file mode 100644
index 00000000..37579d32
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc
@@ -0,0 +1,48 @@
+ $x;
+$r = Match ($x) {
+ 1 => 1,
+ 2 => 2,
+ DEFAULT, => 3,
+};
+
+class Reading {
+ Public READOnly int $var;
+}
+
+EnuM ENUM: string
+{
+ Case HEARTS;
+}
+
+__HALT_COMPILER(); // An exception due to phar support.
+function
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed
new file mode 100644
index 00000000..7063327a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed
@@ -0,0 +1,48 @@
+ $x;
+$r = match ($x) {
+ 1 => 1,
+ 2 => 2,
+ default, => 3,
+};
+
+class Reading {
+ public readonly int $var;
+}
+
+enum ENUM: string
+{
+ case HEARTS;
+}
+
+__HALT_COMPILER(); // An exception due to phar support.
+function
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php
new file mode 100644
index 00000000..6d08e127
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php
@@ -0,0 +1,66 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LowerCaseKeywordUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [
+ 10 => 3,
+ 11 => 4,
+ 12 => 1,
+ 13 => 3,
+ 14 => 7,
+ 15 => 1,
+ 19 => 1,
+ 20 => 1,
+ 21 => 1,
+ 25 => 1,
+ 28 => 1,
+ 31 => 1,
+ 32 => 1,
+ 35 => 1,
+ 39 => 2,
+ 42 => 1,
+ 44 => 1,
+ ];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc
new file mode 100644
index 00000000..ac2a1f9e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.inc
@@ -0,0 +1,91 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LowerCaseTypeUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [
+ 14 => 1,
+ 15 => 1,
+ 16 => 1,
+ 17 => 1,
+ 18 => 1,
+ 21 => 4,
+ 22 => 3,
+ 23 => 3,
+ 25 => 1,
+ 26 => 2,
+ 27 => 2,
+ 32 => 4,
+ 36 => 1,
+ 37 => 1,
+ 38 => 1,
+ 39 => 1,
+ 43 => 2,
+ 44 => 1,
+ 46 => 1,
+ 49 => 1,
+ 51 => 2,
+ 53 => 1,
+ 55 => 2,
+ 60 => 1,
+ 61 => 1,
+ 62 => 1,
+ 63 => 1,
+ 64 => 1,
+ 65 => 1,
+ 66 => 1,
+ 67 => 1,
+ 68 => 1,
+ 69 => 1,
+ 71 => 3,
+ 72 => 2,
+ 73 => 3,
+ 74 => 3,
+ 78 => 3,
+ 82 => 2,
+ 85 => 1,
+ ];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc
new file mode 100644
index 00000000..72bffe2c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc
@@ -0,0 +1,10 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class NoSilencedErrorsUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [
+ 5 => 1,
+ 10 => 1,
+ ];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.1.inc
new file mode 100644
index 00000000..387cec24
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/RequireStrictTypesUnitTest.1.inc
@@ -0,0 +1,8 @@
+
+ * @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class RequireStrictTypesUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='')
+ {
+ switch ($testFile) {
+ case 'RequireStrictTypesUnitTest.1.inc':
+ return [];
+ break;
+ }
+
+ return [1 => 1];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.inc
new file mode 100644
index 00000000..f0f350f3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.inc
@@ -0,0 +1,5 @@
+php_sapi_name() === true) {}
+if ($object?->php_sapi_name() === true) {}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.php
new file mode 100644
index 00000000..08c0ccdc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.php
@@ -0,0 +1,48 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SAPIUsageUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [2 => 1];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.1.inc
new file mode 100644
index 00000000..4f0d9d84
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.1.inc
@@ -0,0 +1,4 @@
+
+
text
+= if($x) { $y = 'text'; } ?>
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php
new file mode 100644
index 00000000..98d205ce
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php
@@ -0,0 +1,59 @@
+
+ * @author Blaine Schmeisser
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SyntaxUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='')
+ {
+ switch ($testFile) {
+ case 'SyntaxUnitTest.1.inc':
+ case 'SyntaxUnitTest.2.inc':
+ return [3 => 1];
+ break;
+ default:
+ return [];
+ break;
+ }
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
new file mode 100644
index 00000000..30c6d298
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
@@ -0,0 +1,98 @@
+null = 7;
+
+use Zend\Log\Writer\Null as NullWriter;
+new \Zend\Log\Writer\Null();
+
+namespace False;
+
+class True extends Null implements False {}
+
+use True\Something;
+use Something\True;
+class MyClass
+{
+ public function myFunction()
+ {
+ $var = array('foo' => new True());
+ }
+}
+
+$x = $f?false:TRUE;
+$x = $f? false:TRUE;
+
+class MyClass
+{
+ // Spice things up a little.
+ const true = FALSE;
+}
+
+var_dump(MyClass::true);
+
+function true() {}
+
+// Issue #3332 - ignore type declarations, but not default values.
+class TypedThings {
+ const MYCONST = false;
+
+ public int|false $int = false;
+ public Type|null $int = new MyObj(null);
+
+ private function typed(int|false $param = null, Type|null $obj = new MyObj(false)) : string|false|null
+ {
+ if (true === false) {
+ return null;
+ }
+ }
+}
+
+$cl = function (int|false $param = null, Type|null $obj = new MyObj(false)) : string|false|null {};
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed
new file mode 100644
index 00000000..7705198c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed
@@ -0,0 +1,98 @@
+null = 7;
+
+use Zend\Log\Writer\Null as NullWriter;
+new \Zend\Log\Writer\Null();
+
+namespace False;
+
+class True extends Null implements False {}
+
+use True\Something;
+use Something\True;
+class MyClass
+{
+ public function myFunction()
+ {
+ $var = array('foo' => new True());
+ }
+}
+
+$x = $f?FALSE:TRUE;
+$x = $f? FALSE:TRUE;
+
+class MyClass
+{
+ // Spice things up a little.
+ const true = FALSE;
+}
+
+var_dump(MyClass::true);
+
+function true() {}
+
+// Issue #3332 - ignore type declarations, but not default values.
+class TypedThings {
+ const MYCONST = FALSE;
+
+ public int|false $int = FALSE;
+ public Type|null $int = new MyObj(NULL);
+
+ private function typed(int|false $param = NULL, Type|null $obj = new MyObj(FALSE)) : string|false|null
+ {
+ if (TRUE === FALSE) {
+ return NULL;
+ }
+ }
+}
+
+$cl = function (int|false $param = NULL, Type|null $obj = new MyObj(FALSE)) : string|false|null {};
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php
new file mode 100644
index 00000000..30e57763
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php
@@ -0,0 +1,70 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UpperCaseConstantUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [
+ 7 => 1,
+ 10 => 1,
+ 15 => 1,
+ 16 => 1,
+ 23 => 1,
+ 26 => 1,
+ 31 => 1,
+ 32 => 1,
+ 39 => 1,
+ 42 => 1,
+ 47 => 1,
+ 48 => 1,
+ 70 => 1,
+ 71 => 1,
+ 85 => 1,
+ 87 => 1,
+ 88 => 1,
+ 90 => 2,
+ 92 => 2,
+ 93 => 1,
+ 98 => 2,
+ ];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.inc
new file mode 100644
index 00000000..43c05a11
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.inc
@@ -0,0 +1,21 @@
+';
+$code = '<'.'?php ';
+
+$string = 'This is a really long string. '
+ . 'It is being used for errors. '
+ . 'The message is not translated.';
+?>
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.js
new file mode 100644
index 00000000..6be79008
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.js
@@ -0,0 +1,15 @@
+var x = 'My ' + 'string';
+var x = 'My ' + 1234;
+var x = 'My ' + y + ' test';
+
+this.errors['test'] = x;
+this.errors['test' + 10] = x;
+this.errors['test' + y] = x;
+this.errors['test' + 'blah'] = x;
+this.errors[y] = x;
+this.errors[y + z] = x;
+this.errors[y + z + 'My' + 'String'] = x;
+
+var long = 'This is a really long string. '
+ + 'It is being used for errors. '
+ + 'The message is not translated.';
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php
new file mode 100644
index 00000000..6a928482
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php
@@ -0,0 +1,73 @@
+
+ * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Strings;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UnnecessaryStringConcatUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='UnnecessaryStringConcatUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'UnnecessaryStringConcatUnitTest.inc':
+ return [
+ 2 => 1,
+ 6 => 1,
+ 9 => 1,
+ 12 => 1,
+ 19 => 1,
+ 20 => 1,
+ ];
+ break;
+ case 'UnnecessaryStringConcatUnitTest.js':
+ return [
+ 1 => 1,
+ 8 => 1,
+ 11 => 1,
+ 14 => 1,
+ 15 => 1,
+ ];
+ break;
+ default:
+ return [];
+ break;
+ }//end switch
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.css
new file mode 100644
index 00000000..de84a948
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.css
@@ -0,0 +1,35 @@
+/*
+ * This is a CSS comment.
+<<<<<<< HEAD
+ * This is a merge conflict...
+=======
+ * which should be detected.
+>>>>>>> ref/heads/feature-branch
+ */
+
+.SettingsTabPaneWidgetType-tab-mid {
+ background: transparent url(tab_inact_mid.png) repeat-x;
+<<<<<<< HEAD
+ line-height: -25px;
+=======
+ line-height: -20px;
+>>>>>>> ref/heads/feature-branch
+ cursor: pointer;
+ -moz-user-select: none;
+}
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries, subsequent boundaries will still
+ * be detected correctly.
+ */
+
+/*
+ * This is a CSS comment.
+<<<<<<< HEAD
+ * This is a merge conflict...
+=======
+ * which should be detected.
+>>>>>>> ref/heads/feature-branch
+ */
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.inc
new file mode 100644
index 00000000..470c3b8f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.1.inc
@@ -0,0 +1,61 @@
+> -1);
+var_dump(
+1
+<<
+-1
+);
+
+$string =
+<< 'a'
+<<<<<<< HEAD
+ 'b' => 'b'
+=======
+ 'c' => 'c'
+>>>>>>> master
+ );
+ }
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries - i.e. after the first merge conflict
+ * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
+ * merge conflict boundaries will still be detected correctly.
+ */
+
+/*
+ * Testing detecting subsequent merge conflicts.
+ *
+<<<<<<< HEAD
+ * @var string $bar
+ */
+public function foo($bar){ }
+
+/**
+============
+The above is not the boundary, the below is.
+=======
+ * @var string $bar
+>>>>>>> f19f8a5... Commit message
+*/
+
+// Test that stray boundaries, i.e. an opener without closer and such, are detected.
+<<<<<<< HEAD
+$a = 1;
+=======
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.css
new file mode 100644
index 00000000..6caa78d0
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.css
@@ -0,0 +1,32 @@
+/*
+ * This is a CSS comment.
+<<<<<<< HEAD
+ * This is a merge conflict started in a comment, ending in a CSS block.
+ */
+.SettingsTabPaneWidgetType-tab-mid {
+ background: transparent url(tab_inact_mid.png) repeat-x;
+=======
+ * which should be detected.
+ **/
+.SettingsTabPaneWidgetType-tab-start {
+ line-height: -25px;
+>>>>>>> ref/heads/feature-branch
+ cursor: pointer;
+ -moz-user-select: none;
+}
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries, subsequent boundaries will still
+ * be detected correctly.
+ */
+
+/*
+ * This is a CSS comment.
+<<<<<<< HEAD
+ * This is a merge conflict...
+=======
+ * which should be detected.
+>>>>>>> ref/heads/feature-branch
+ */
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.inc
new file mode 100644
index 00000000..809b17d6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.2.inc
@@ -0,0 +1,31 @@
+>>>>>> master
+ */
+
+/*
+ * Testing detecting merge conflicts using different comment styles.
+ *
+<<<<<<< HEAD
+ * @var string $bar
+ */
+public function foo($bar){ }
+
+/*
+=======
+ * @var string $bar
+>>>>>>> master
+*/
+
+// Comment
+<<<<<<< HEAD
+// Second comment line. NOTE: The above opener breaks the tokenizer.
+=======
+// New second comment line
+>>>>>>> master
+// Third comment line
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.3.inc
new file mode 100644
index 00000000..ce709412
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.3.inc
@@ -0,0 +1,43 @@
+
+
+<<<<<<< HEAD
+
Testing a merge conflict.
+=======
+
Another text string.
+>>>>>>> ref/heads/feature-branch
+
+
+
+
+<<<<<<< HEAD
+
+=======
+
+>>>>>>> ref/heads/feature-branch
+
+
+>>>>>> master
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries - i.e. after the first merge conflict
+ * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
+ * merge conflict boundaries will still be detected correctly.
+ */
+?>
+
+
+<<<<<<< HEAD
+
Testing a merge conflict.
+=======
+
Another text string.
+>>>>>>> ref/heads/feature-branch
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.4.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.4.inc
new file mode 100644
index 00000000..99c0b997
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.4.inc
@@ -0,0 +1,71 @@
+>>>>>> ref/heads/other-branchname
+And now they are.
+EOD;
+
+// Heredoc with a merge conflict starter, the closer is outside the heredoc.
+$string =
+<<>>>>>> ref/heads/other-branchname
+
+// Merge conflict starter outside with a closer inside of the heredoc.
+// This breaks the tokenizer.
+<<<<<<< HEAD
+$string =
+<<>>>>>> ref/heads/other-branchname
+EOD;
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries - i.e. after the first merge conflict
+ * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
+ * merge conflict boundaries will still be detected correctly.
+ */
+
+$string =
+<<>>>>>> ref/heads/other-branchname
+And now they are.
+EOD;
+
+$string =
+<<>>>>>> ref/heads/other-branchname
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.5.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.5.inc
new file mode 100644
index 00000000..7d55f6df
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.5.inc
@@ -0,0 +1,34 @@
+>>>>>> ref/heads/other-branchname
+And now they are.
+EOD;
+
+// Break the tokenizer.
+<<<<<<< HEAD
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries - i.e. after the first merge conflict
+ * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
+ * merge conflict boundaries will still be detected correctly.
+ */
+
+$string =
+<<<'EOD'
+can be problematic.
+<<<<<<< HEAD
+were previously not detected.
+=======
+should also be detected.
+>>>>>>> ref/heads/other-branchname
+And now they are.
+EOD;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.6.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.6.inc
new file mode 100644
index 00000000..aaea3245
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.6.inc
@@ -0,0 +1,34 @@
+>>>>>> ref/heads/other-branchname
+ And now they are.
+ EOD;
+
+// Break the tokenizer.
+>>>>>>> master
+
+/*
+ * The above tests are based on "normal" tokens.
+ * The below test checks that once the tokenizer breaks down because of
+ * unexpected merge conflict boundaries - i.e. after the first merge conflict
+ * opener in non-comment, non-heredoc/nowdoc, non-inline HTML code -, subsequent
+ * merge conflict boundaries will still be detected correctly.
+ */
+
+$string =
+ <<<"EOD"
+ Merge conflicts in PHP 7.3 indented heredocs
+<<<<<<< HEAD
+ can be problematic.
+=======
+ should also be detected.
+>>>>>>> ref/heads/other-branchname
+ And now they are.
+ EOD;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc
new file mode 100644
index 00000000..85cae1fd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc
@@ -0,0 +1,19 @@
+
+
+<<<<<<< HEAD
+
Testing a merge conflict.
+=======
+
Another text string.
+>>>>>>> ref/heads/feature-branch
+
+
+
+
+<<<<<<< HEAD
+
= 'Testing a merge conflict.'; ?>
+=======
+
= 'Another text string.'; ?>
+>>>>>>> ref/heads/feature-branch
+
+
+= $text; ?>
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.js
new file mode 100644
index 00000000..cd7bc760
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.js
@@ -0,0 +1,33 @@
+
+result = x?y:z;
+result = x ? y : z;
+
+<<<<<<< HEAD
+if (something === true
+=======
+if (something === false
+>>>>>>> develop
+ ^ somethingElse === true
+) {
+<<<<<<< HEAD
+ return true;
+=======
+ return false;
+>>>>>>> develop
+}
+
+y = 1
+ + 2
+ - 3;
+
+/*
+<<<<<<< HEAD
+ * @var string $bar
+ */
+if (something === true
+
+/**
+=======
+ * @var string $foo
+>>>>>>> master
+ */
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php
new file mode 100644
index 00000000..50986f48
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php
@@ -0,0 +1,170 @@
+
+ * @copyright 2017 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\VersionControl;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class GitMergeConflictUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='GitMergeConflictUnitTest.1.inc')
+ {
+ switch ($testFile) {
+ case 'GitMergeConflictUnitTest.1.inc':
+ return [
+ 26 => 1,
+ 28 => 1,
+ 30 => 1,
+ 45 => 1,
+ 53 => 1,
+ 55 => 1,
+ 59 => 1,
+ 61 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.2.inc':
+ return [
+ 4 => 1,
+ 6 => 1,
+ 8 => 1,
+ 14 => 1,
+ 20 => 1,
+ 22 => 1,
+ 26 => 1,
+ 28 => 1,
+ 30 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.3.inc':
+ return [
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ 12 => 1,
+ 14 => 1,
+ 16 => 1,
+ 22 => 1,
+ 24 => 1,
+ 26 => 1,
+ 38 => 1,
+ 40 => 1,
+ 42 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.4.inc':
+ return [
+ 6 => 1,
+ 8 => 1,
+ 10 => 1,
+ 18 => 1,
+ 22 => 1,
+ 25 => 1,
+ 29 => 1,
+ 34 => 1,
+ 39 => 1,
+ 53 => 1,
+ 55 => 1,
+ 57 => 1,
+ 64 => 1,
+ 68 => 1,
+ 71 => 1,
+ ];
+ case 'GitMergeConflictUnitTest.5.inc':
+ case 'GitMergeConflictUnitTest.6.inc':
+ return [
+ 6 => 1,
+ 8 => 1,
+ 10 => 1,
+ 15 => 1,
+ 28 => 1,
+ 30 => 1,
+ 32 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.7.inc':
+ return [
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ 12 => 1,
+ 14 => 1,
+ 16 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.1.css':
+ return [
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ 12 => 1,
+ 14 => 1,
+ 16 => 1,
+ 30 => 1,
+ 32 => 1,
+ 34 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.2.css':
+ return [
+ 3 => 1,
+ 8 => 1,
+ 13 => 1,
+ 27 => 1,
+ 29 => 1,
+ 31 => 1,
+ ];
+
+ case 'GitMergeConflictUnitTest.js':
+ return [
+ 5 => 1,
+ 7 => 1,
+ 9 => 1,
+ 12 => 1,
+ 14 => 1,
+ 16 => 1,
+ 24 => 1,
+ 30 => 1,
+ 32 => 1,
+ ];
+
+ default:
+ return [];
+ }//end switch
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/SubversionPropertiesUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/SubversionPropertiesUnitTest.inc
new file mode 100644
index 00000000..e4110dee
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/VersionControl/SubversionPropertiesUnitTest.inc
@@ -0,0 +1,3 @@
+
+ * @copyright 2019 Juliette Reinders Folmer. All rights reserved.
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\VersionControl;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SubversionPropertiesUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Should this test be skipped for some reason.
+ *
+ * @return void
+ */
+ protected function shouldSkipTest()
+ {
+ // This sniff cannot be tested as no SVN version control directory is available.
+ return true;
+
+ }//end shouldSkipTest()
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc
new file mode 100644
index 00000000..bad3998f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc
@@ -0,0 +1,165 @@
+{$var}( $foo,$bar );
+
+$bar(function( $a, $b ) {
+ return function( $c, $d ) use ( $a, $b ) {
+ echo $a, $b, $c, $d;
+ };
+})( 'a','b' )( 'c','d' );
+
+$closure( $foo,$bar );
+$var = $closure() + $closure( $foo,$bar ) + self::$closure( $foo,$bar );
+
+class Test {
+ public static function baz( $foo, $bar ) {
+ $a = new self( $foo,$bar );
+ $b = new static( $foo,$bar );
+ }
+}
+
+/*
+ * Test warning for empty parentheses.
+ */
+$a = 4 + (); // Warning.
+$a = 4 + ( ); // Warning.
+$a = 4 + (/* Not empty */);
+
+/*
+ * Test the actual sniff.
+ */
+if ((null !== $extra) && ($row->extra !== $extra)) {}
+
+if (( null !== $extra ) && ( $row->extra !== $extra )) {} // Bad x 4.
+
+if (( null !== $extra // Bad x 1.
+ && is_int($extra))
+ && ( $row->extra !== $extra // Bad x 1.
+ || $something ) // Bad x 1.
+) {}
+
+if (( null !== $extra ) // Bad x 2.
+ && ( $row->extra !== $extra ) // Bad x 2.
+) {}
+
+$a = (null !== $extra);
+$a = ( null !== $extra ); // Bad x 2.
+
+$sx = $vert ? ($w - 1) : 0;
+
+$this->is_overloaded = ( ( ini_get("mbstring.func_overload") & 2 ) != 0 ) && function_exists('mb_substr'); // Bad x 4.
+
+$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
+
+if ( $success && ('nothumb' == $target || 'all' == $target) ) {}
+
+$directory = ('/' == $file[ strlen($file)-1 ]);
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1
+if ((null !== $extra) && ($row->extra !== $extra)) {} // Bad x 4.
+
+if (( null !== $extra ) && ( $row->extra !== $extra )) {}
+
+if (( null !== $extra // Bad x 1.
+ && is_int($extra)) // Bad x 1.
+ && ( $row->extra !== $extra
+ || $something ) // Bad x 1.
+) {}
+
+if ((null !== $extra) // Bad x 2.
+ && ($row->extra !== $extra) // Bad x 2.
+) {}
+
+$a = (null !== $extra); // Bad x 2.
+$a = ( null !== $extra );
+
+$sx = $vert ? ($w - 1) : 0; // Bad x 2.
+
+$this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); // Bad x 4.
+
+$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 ); // Bad x 4.
+
+if ( $success && ('nothumb' == $target || 'all' == $target) ) {} // Bad x 2.
+
+$directory = ('/' == $file[ strlen($file)-1 ]); // Bad x 2.
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0
+
+/*
+ * Test handling of ignoreNewlines.
+ */
+if (
+ (
+ null !== $extra
+ ) && (
+ $row->extra !== $extra
+ )
+) {} // Bad x 4, 1 x line 123, 2 x line 125, 1 x line 127.
+
+
+$a = (
+ null !== $extra
+); // Bad x 2, 1 x line 131, 1 x line 133.
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1
+if (
+ (
+ null !== $extra
+ ) && (
+ $row->extra !== $extra
+ )
+) {} // Bad x 4, 1 x line 137, 2 x line 139, 1 x line 141.
+
+$a = (
+ null !== $extra
+); // Bad x 2, 1 x line 144, 1 x line 146.
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines true
+if (
+ (
+ null !== $extra
+ ) && (
+ $row->extra !== $extra
+ )
+) {}
+
+$a = (
+ null !== $extra
+);
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines false
+
+if (true) {} ( 1+2) === 3 ? $a = 1 : $a = 2;
+class A {} ( 1+2) === 3 ? $a = 1 : $a = 2;
+function foo() {} ( 1+2) === 3 ? $a = 1 : $a = 2;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed
new file mode 100644
index 00000000..08fcd624
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.inc.fixed
@@ -0,0 +1,153 @@
+{$var}( $foo,$bar );
+
+$bar(function( $a, $b ) {
+ return function( $c, $d ) use ( $a, $b ) {
+ echo $a, $b, $c, $d;
+ };
+})( 'a','b' )( 'c','d' );
+
+$closure( $foo,$bar );
+$var = $closure() + $closure( $foo,$bar ) + self::$closure( $foo,$bar );
+
+class Test {
+ public static function baz( $foo, $bar ) {
+ $a = new self( $foo,$bar );
+ $b = new static( $foo,$bar );
+ }
+}
+
+/*
+ * Test warning for empty parentheses.
+ */
+$a = 4 + (); // Warning.
+$a = 4 + ( ); // Warning.
+$a = 4 + (/* Not empty */);
+
+/*
+ * Test the actual sniff.
+ */
+if ((null !== $extra) && ($row->extra !== $extra)) {}
+
+if ((null !== $extra) && ($row->extra !== $extra)) {} // Bad x 4.
+
+if ((null !== $extra // Bad x 1.
+ && is_int($extra))
+ && ($row->extra !== $extra // Bad x 1.
+ || $something) // Bad x 1.
+) {}
+
+if ((null !== $extra) // Bad x 2.
+ && ($row->extra !== $extra) // Bad x 2.
+) {}
+
+$a = (null !== $extra);
+$a = (null !== $extra); // Bad x 2.
+
+$sx = $vert ? ($w - 1) : 0;
+
+$this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); // Bad x 4.
+
+$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
+
+if ( $success && ('nothumb' == $target || 'all' == $target) ) {}
+
+$directory = ('/' == $file[ strlen($file)-1 ]);
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1
+if (( null !== $extra ) && ( $row->extra !== $extra )) {} // Bad x 4.
+
+if (( null !== $extra ) && ( $row->extra !== $extra )) {}
+
+if (( null !== $extra // Bad x 1.
+ && is_int($extra) ) // Bad x 1.
+ && ( $row->extra !== $extra
+ || $something ) // Bad x 1.
+) {}
+
+if (( null !== $extra ) // Bad x 2.
+ && ( $row->extra !== $extra ) // Bad x 2.
+) {}
+
+$a = ( null !== $extra ); // Bad x 2.
+$a = ( null !== $extra );
+
+$sx = $vert ? ( $w - 1 ) : 0; // Bad x 2.
+
+$this->is_overloaded = ( ( ini_get("mbstring.func_overload") & 2 ) != 0 ) && function_exists('mb_substr'); // Bad x 4.
+
+$image->flip( ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 ); // Bad x 4.
+
+if ( $success && ( 'nothumb' == $target || 'all' == $target ) ) {} // Bad x 2.
+
+$directory = ( '/' == $file[ strlen($file)-1 ] ); // Bad x 2.
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0
+
+/*
+ * Test handling of ignoreNewlines.
+ */
+if (
+ (null !== $extra) && ($row->extra !== $extra)
+) {} // Bad x 4, 1 x line 123, 2 x line 125, 1 x line 127.
+
+
+$a = (null !== $extra); // Bad x 2, 1 x line 131, 1 x line 133.
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 1
+if (
+ ( null !== $extra ) && ( $row->extra !== $extra )
+) {} // Bad x 4, 1 x line 137, 2 x line 139, 1 x line 141.
+
+$a = ( null !== $extra ); // Bad x 2, 1 x line 144, 1 x line 146.
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing spacing 0
+
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines true
+if (
+ (
+ null !== $extra
+ ) && (
+ $row->extra !== $extra
+ )
+) {}
+
+$a = (
+ null !== $extra
+);
+// phpcs:set Generic.WhiteSpace.ArbitraryParenthesesSpacing ignoreNewlines false
+
+if (true) {} (1+2) === 3 ? $a = 1 : $a = 2;
+class A {} (1+2) === 3 ? $a = 1 : $a = 2;
+function foo() {} (1+2) === 3 ? $a = 1 : $a = 2;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php
new file mode 100644
index 00000000..0f70e287
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php
@@ -0,0 +1,85 @@
+
+ * @copyright 2006-2017 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\WhiteSpace;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ArbitraryParenthesesSpacingUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Returns the lines where errors should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of errors that should occur on that line.
+ *
+ * @return array
+ */
+ public function getErrorList()
+ {
+ return [
+ 64 => 4,
+ 66 => 1,
+ 68 => 1,
+ 69 => 1,
+ 72 => 2,
+ 73 => 2,
+ 77 => 2,
+ 81 => 4,
+ 90 => 4,
+ 94 => 1,
+ 95 => 1,
+ 97 => 1,
+ 100 => 2,
+ 101 => 2,
+ 104 => 2,
+ 107 => 2,
+ 109 => 4,
+ 111 => 4,
+ 113 => 2,
+ 115 => 2,
+ 123 => 1,
+ 125 => 2,
+ 127 => 1,
+ 131 => 1,
+ 133 => 1,
+ 137 => 1,
+ 139 => 2,
+ 141 => 1,
+ 144 => 1,
+ 146 => 1,
+ 163 => 1,
+ 164 => 1,
+ 165 => 1,
+ ];
+
+ }//end getErrorList()
+
+
+ /**
+ * Returns the lines where warnings should occur.
+ *
+ * The key of the array should represent the line number and the value
+ * should represent the number of warnings that should occur on that line.
+ *
+ * @return array
+ */
+ public function getWarningList()
+ {
+ return [
+ 55 => 1,
+ 56 => 1,
+ ];
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.1.inc
new file mode 100644
index 00000000..1826b585
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.1.inc
@@ -0,0 +1,118 @@
+";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// [space][space][space][tab]return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// Doc comments are indent with tabs and one space
+//[tab]/**
+//[tab][space]*
+ /**
+ * CVS revision for HTTP headers.
+ *
+ * @var string
+ * @access private
+ */
+ /**
+ *
+ */
+
+$str = 'hello
+ there';
+
+/**
+ * This PHP DocBlock should be fine, even though there is a single space at the beginning.
+ *
+ * @var int $x
+ */
+$x = 1;
+
+?>
+
+
+ Foo
+
+
+
+
+
+
+
+
+
+
+
+";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// [space][space][space][tab]return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// Doc comments are indent with tabs and one space
+//[tab]/**
+//[tab][space]*
+ /**
+ * CVS revision for HTTP headers.
+ *
+ * @var string
+ * @access private
+ */
+ /**
+ *
+ */
+
+$str = 'hello
+ there';
+
+/**
+ * This PHP DocBlock should be fine, even though there is a single space at the beginning.
+ *
+ * @var int $x
+ */
+$x = 1;
+
+?>
+
+
+ Foo
+
+
+
+
+
+
+
+
+
+
+
+";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// [space][space][space][tab]return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// Doc comments are indent with tabs and one space
+//[tab]/**
+//[tab][space]*
+ /**
+ * CVS revision for HTTP headers.
+ *
+ * @var string
+ * @access private
+ */
+ /**
+ *
+ */
+
+$str = 'hello
+ there';
+
+/**
+ * This PHP DocBlock should be fine, even though there is a single space at the beginning.
+ *
+ * @var int $x
+ */
+$x = 1;
+
+?>
+
+
+ Foo
+
+
+
+
+
+
+
+
+
+
+
+";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// [space][space][space][tab]return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+ return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
+// Doc comments are indent with tabs and one space
+//[tab]/**
+//[tab][space]*
+ /**
+ * CVS revision for HTTP headers.
+ *
+ * @var string
+ * @access private
+ */
+ /**
+ *
+ */
+
+$str = 'hello
+ there';
+
+/**
+ * This PHP DocBlock should be fine, even though there is a single space at the beginning.
+ *
+ * @var int $x
+ */
+$x = 1;
+
+?>
+
+
+ Foo
+
+
+