From: Steve Sutton
Date: Tue, 24 Oct 2017 16:16:43 +0000 (-0400)
Subject: google calendar fixes
X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FGoogleCalendar;p=WP-Plugins%2Fglm-member-db-events.git
google calendar fixes
---
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..e08be44
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,43 @@
+{
+ "name": "johngrogg/ics-parser",
+ "description": "ICS Parser",
+ "homepage": "https://github.com/u01jmg3/ics-parser",
+ "keywords": [
+ "icalendar",
+ "ics",
+ "ics-parser",
+ "ical",
+ "ical-parser",
+ "ifb"
+ ],
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Jonathan Goode",
+ "role": "Developer/Owner"
+ },
+ {
+ "name": "John Grogg",
+ "email": "john.grogg@gmail.com",
+ "role": "Developer/Prior Owner"
+ },
+ {
+ "name": "Martin Thoma",
+ "email": "info@martin-thoma.de",
+ "role": "Original Developer"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0",
+ "nesbot/carbon": "~1.18"
+ },
+ "require-dev": {
+ "squizlabs/php_codesniffer": "^3.0"
+ },
+ "autoload": {
+ "psr-0": {
+ "ICal": "src/"
+ }
+ }
+}
\ No newline at end of file
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..99e0d5b
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,250 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "This file is @generated automatically"
+ ],
+ "hash": "097319ee817f0c85fb442f1a87d6712a",
+ "content-hash": "f1ba5c00fd5ec3e2250ea13c0833d82b",
+ "packages": [
+ {
+ "name": "nesbot/carbon",
+ "version": "1.22.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/briannesbitt/Carbon.git",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/translation": "~2.6 || ~3.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "~2",
+ "phpunit/phpunit": "~4.0 || ~5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.23-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Carbon\\": "src/Carbon/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Brian Nesbitt",
+ "email": "brian@nesbot.com",
+ "homepage": "http://nesbot.com"
+ }
+ ],
+ "description": "A simple API extension for DateTime.",
+ "homepage": "http://carbon.nesbot.com",
+ "keywords": [
+ "date",
+ "datetime",
+ "time"
+ ],
+ "time": "2017-01-16 07:55:07"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2017-10-11 12:05:26"
+ },
+ {
+ "name": "symfony/translation",
+ "version": "v3.3.10",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/translation.git",
+ "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
+ "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.5.9|>=7.0.8",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "conflict": {
+ "symfony/config": "<2.8",
+ "symfony/yaml": "<3.3"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/intl": "^2.8.18|^3.2.5",
+ "symfony/yaml": "~3.3"
+ },
+ "suggest": {
+ "psr/log": "To use logging capability in translator",
+ "symfony/config": "",
+ "symfony/yaml": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Translation\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Translation Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-10-02 06:42:24"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d667e245d5dcd4d7bf80f26f2c947d476b66213e",
+ "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.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": "http://www.squizlabs.com/php-codesniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "time": "2017-10-16 22:40:25"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.3.0"
+ },
+ "platform-dev": []
+}
diff --git a/models/front/events/icalFeedImport.php b/models/front/events/icalFeedImport.php
index d9b832a..775a9dc 100644
--- a/models/front/events/icalFeedImport.php
+++ b/models/front/events/icalFeedImport.php
@@ -1,4 +1,6 @@
$_REQUEST: ' . print_r( $_REQUEST, true ) . '';
if ( $id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) ) {
echo $this->importIcalFeed( $id );
}
@@ -80,8 +86,8 @@ class GlmMembersFront_events_icalFeedImport
public function importIcalFeed( $feed_id )
{
$start_timer = time();
- $debug = false;
- $clear_data = false;
+ $debug = true;
+ $clear_data = true;
$number_events = 0;
if ( $clear_data ) {
$this->clearData();
@@ -115,38 +121,81 @@ class GlmMembersFront_events_icalFeedImport
// Get the feed data
$filename = $this->fetchIcalFile( $feed_url );
- require GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/classes/icalReader.php';
- $ical = new ical($filename);
- $events = $ical->events();
+ // require GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/classes/icalReader.php';
+ // Setup new ical parser
+ try {
+ // require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/vendor/autoload.php';
+ $ical = new ICal($filename, array(
+ 'defaultSpan' => 2, // Default value
+ 'defaultTimeZone' => 'UTC',
+ 'defaultWeekStart' => 'SU', // Default value
+ 'skipRecurrence' => false, // Default value
+ 'useTimeZoneWithRRules' => false, // Default value
+ ));
+ } catch (\Exception $e) {
+ die($e);
+ }
+ // $ical = new ical($filename);
+ $events = $ical->eventsFromRange( date( 'Y-m-d' ) );
+ // $events = $ical->events();
if ( $debug ) {
- $out .= '$events: ' . print_r( $events, true ) . '
';
+ // $out .= '$events: ' . print_r( $events, true ) . '
';
}
+ // echo '$events: ' . print_r( $events, true ) . '
';
+ // exit;
+
$origTimeZone = date_default_timezone_get();
$wpTimeZone = get_option('timezone_string');
date_default_timezone_set( $wpTimeZone );
if ( $events ) {
- foreach ( $events as $event ) {
+ foreach ( $events as $eventObj ) {
+ $event = (array)$eventObj;
+ $event_id = 0;
+ // Get the starting and ending first to see if we want to
+ // import this event
+ // check format of the dtstart and add time part if needed
+ if ( strlen( $event['dtstart'] ) == 8 ) {
+ $event['dtstart'] .= 'T000000Z';
+ }
+ if ( strlen( $event['dtend'] ) == 8 ) {
+ $event['dtend'] .= 'T000000Z';
+ }
+ $starting = $ical->iCalDateToUnixTimestamp( $event['dtstart'] );
+ // Need to check the dtend to see if they are non-inclusive
+ // They'll have VALUE=DATE:YYYMMDD format
+ if ( isset( $event['dtend'] ) && preg_match( '%VALUE=DATE:(\d{4})(\d{2})(\d{2})%', $event['dtend'], $dParts ) ) {
+ $ending = mktime( 0, 0, 0, $dParts[2], ((int)$dParts[3] - 1), $dParts[1] );
+ } else if ( $event['dtend'] ) {
+ $ending = $ical->iCalDateToUnixTimestamp( $event['dtend'] );
+ } else {
+ $ending = $starting;
+ }
+ // If the ending date is in past then skip it
+ if ( mktime( 0, 0, 1, date('n'), date('j'), date('Y') ) > $ending ) {
+ continue;
+ }
+
if ( $debug ) {
$out .= '$event: ' . print_r( $event, true ) . '
';
}
$contact = array();
$image = '';
- $event['DESCRIPTION'] = str_replace( '\n', "
", $event['DESCRIPTION'] );
- $event['DESCRIPTION'] = str_replace( '\,', ",", $event['DESCRIPTION'] );
- $event['DESCRIPTION'] = str_replace( 'ENCODING=QUOTED-PRINTABLE:', "", $event['DESCRIPTION'] );
- $event['DESCRIPTION'] = str_replace( '=0D=0A', "", $event['DESCRIPTION'] );
- $event['SUMMARY'] = str_replace( 'ENCODING=QUOTED-PRINTABLE:', "", $event['SUMMARY'] );
- $event['SUMMARY'] = str_replace( '\,', ",", $event['SUMMARY'] );
- $intro = substr( strip_tags( $event['DESCRIPTION'] ), 0 ,150);
- if ( isset( $event['CONTACT'] ) ) {
+ $event['description'] = str_replace( '\n', "
", $event['description'] );
+ $event['description'] = str_replace( '\,', ",", $event['description'] );
+ $event['description'] = str_replace( 'ENCODING=QUOTED-PRINTABLE:', "", $event['description'] );
+ $event['description'] = str_replace( '=0D=0A', "", $event['description'] );
+ $event['summary'] = str_replace( 'ENCODING=QUOTED-PRINTABLE:', "", $event['summary'] );
+ $event['summary'] = str_replace( '\,', ",", $event['summary'] );
+ $intro = substr( strip_tags( $event['description'] ), 0 ,150);
+ if ( isset( $event['contact'] ) ) {
// Remove the backslashes
- $eventContact = str_replace( '\\', '', $event['CONTACT'] );
+ $eventContact = str_replace( '\\', '', $event['contact'] );
if ( $debug ) {
$out .= '$eventContact: ' . print_r( $eventContact, true ) . '
';
}
- // Check if the event CONTACT has semi colons in it.
- // If it does then the CONTACT string hold the contact email phone and name.
+ // Check if the event contact has semi colons in it.
+ // If it does then the contact string hold the contact email phone and name.
if ( strpos( $eventContact, ';' ) !== false ) {
$contact_data = explode( ';', $eventContact );
if ( $debug ) {
@@ -182,13 +231,16 @@ class GlmMembersFront_events_icalFeedImport
"SELECT id
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events
WHERE ical_uid = %s",
- $event['UID']
+ $event['uid']
)
);
+ if ( $event_id ) {
+ continue;
+ }
$old_image = '';
- if ( isset( $event['ATTACH'] ) ) {
+ if ( isset( $event['attach'] ) ) {
// See if we already have this image.
- $img_url = preg_replace( '%FMTTYPE=image/(jpeg|gif|png)[:]|FILENAME=[^:]*[:]%', '', $event['ATTACH'] );
+ $img_url = preg_replace( '%FMTTYPE=image/(jpeg|gif|png)[:]|FILENAME=[^:]*[:]%', '', $event['attach'] );
if ( $img_url && !preg_match( '%drive.google.com%', $img_url ) ) {
if ( $event_id ) {
$old_image = $this->wpdb->get_var(
@@ -207,18 +259,21 @@ class GlmMembersFront_events_icalFeedImport
}
}
}
+ $created_timestamp = isset( $event['created'] )
+ ? $ical->iCalDateToUnixTimestamp( $event['created'] )
+ : time();
$event_data = array(
'status' => $this->config['status_numb']['Active'],
'ref_type' => 10,
- 'created' => ( isset( $event['CREATED'] ) ? $ical->iCalDateToUnixTimestamp( $event['CREATED'] ) : time() ),
- 'updated' => ( isset( $event['CREATED'] ) ? $ical->iCalDateToUnixTimestamp( $event['CREATED'] ) : time() ),
+ 'created' => date('Y-m-d H:i:s', $created_timestamp),
+ 'updated' => date('Y-m-d H:i:s', $created_timestamp),
'approved' => null,
- 'ical_uid' => $event['UID'],
- 'name' => $event['SUMMARY'],
+ 'ical_uid' => $event['uid'],
+ 'name' => $event['summary'],
'intro' => $intro,
- 'descr' => $event['DESCRIPTION'],
+ 'descr' => $event['description'],
'image' => $image,
- 'url' => ( isset( $event['URL'] ) ? $event['URL']: '' ),
+ 'url' => ( isset( $event['url'] ) ? $event['url']: '' ),
'contact_email' => $contact['email'],
'contact_name' => $contact['name'],
'contact_phone' => $contact['phone'],
@@ -275,8 +330,8 @@ class GlmMembersFront_events_icalFeedImport
// Categories
$category_data = null;
$categoryId = null;
- if ( isset( $event['CATEGORIES'] ) ) {
- $category_data = explode( ',', $event['CATEGORIES'] );
+ if ( isset( $event['categories'] ) ) {
+ $category_data = explode( ',', $event['categories'] );
foreach ( $category_data as $category ) {
$categoryId = $this->getCategoryId( $category );
if ( $categoryId ) {
@@ -293,8 +348,8 @@ class GlmMembersFront_events_icalFeedImport
}
}
// Location Data
- if ( isset( $event['LOCATION'] ) ) {
- $location_data = explode( ',', str_replace( '\\', '', $event['LOCATION'] ) );
+ if ( isset( $event['location'] ) ) {
+ $location_data = explode( ',', str_replace( '\\', '', $event['location'] ) );
// Place will be before the first dash
$placeParts = explode( ' - ', $location_data[0] );
$place = ( isset( $placeParts[0] ) ? $placeParts[0]: '');
@@ -313,8 +368,8 @@ class GlmMembersFront_events_icalFeedImport
$location_format = array(
'%d', '%s', '%s', '%d', '%s', '%s'
);
- if ( isset( $event['GEO'] ) ) {
- $geo_data = explode( ';', $event['GEO'] );
+ if ( isset( $event['geo'] ) ) {
+ $geo_data = explode( ';', $event['geo'] );
$location['lat'] = $geo_data[0];
$location['lon'] = $geo_data[1];
$location_format[] = '%s';
@@ -358,16 +413,6 @@ class GlmMembersFront_events_icalFeedImport
$month_of_year = 4095;
$week_of_month = 63;
- $starting = $ical->iCalDateToUnixTimestamp( $event['DTSTART'] );
- // Need to check the DTEND to see if they are non-inclusive
- // They'll have VALUE=DATE:YYYMMDD format
- if ( isset( $event['DTEND'] ) && preg_match( '%VALUE=DATE:(\d{4})(\d{2})(\d{2})%', $event['DTEND'], $dParts ) ) {
- $ending = mktime( 0, 0, 0, $dParts[2], ((int)$dParts[3] - 1), $dParts[1] );
- } else if ( $event['DTEND'] ) {
- $ending = $ical->iCalDateToUnixTimestamp( $event['DTEND'] );
- } else {
- $ending = $starting;
- }
$from_date = date( 'Y-m-d', $starting );
$to_date = date( 'Y-m-d', $ending );
@@ -375,9 +420,9 @@ class GlmMembersFront_events_icalFeedImport
$etime = date( 'H:i', $ending );
$freq = $byday = $until = '';
- if ( isset( $event['RRULE'] ) ) {
+ if ( isset( $event['rrule'] ) ) {
$recurring_event = 1;
- $rrule_data = explode( ';', $event['RRULE'] );
+ $rrule_data = explode( ';', $event['rrule'] );
if ( $rrule_data ) {
foreach ( $rrule_data as $rule ) {
if ( preg_match( '%FREQ=(.*)%', $rule, $matches ) ) {
@@ -399,7 +444,7 @@ class GlmMembersFront_events_icalFeedImport
foreach ( $days as $day ) {
if ( preg_match( '%([0-9]*)?([A-Z]{2})%', $day, $d_matches ) ) {
if ( $d_matches[1] ) {
- $week_of_month = pow( 2, (int)$d_matches[1] );
+ $week_of_month = pow( 2, ((int)$d_matches[1] - 1) );
}
switch ( $d_matches[2] ) {
case "SU":
@@ -435,7 +480,7 @@ class GlmMembersFront_events_icalFeedImport
}
}
}
- if ( isset( $event['RDATE'] ) && preg_match( '%VALUE=DATE:(.*)%', $event['RDATE'], $matches ) ) {
+ if ( isset( $event['rdate'] ) && preg_match( '%VALUE=DATE:(.*)%', $event['rdate'], $matches ) ) {
$rDates = explode( ',', $matches[1] );
foreach ( $rDates as $key => &$rDate ) {
if ( preg_match( '%([0-9]{4})([0-9]{2})([0-9]{2})%', $rDate, $rDateMatches ) ) {
@@ -490,22 +535,22 @@ class GlmMembersFront_events_icalFeedImport
GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences',
$recur_data,
array(
- '%d',
- '%s',
- '%s',
- '%s',
- '%s',
- '%s',
- '%s',
- '%d',
- '%d',
- '%d',
- '%d',
- '%d',
- '%d',
- '%d',
- '%d',
- '%s'
+ '%d', // event_id
+ '%s', // name
+ '%s', // start_time
+ '%s', // end_time
+ '%s', // start_time_only
+ '%s', // from_date
+ '%s', // to_date
+ '%d', // all_day
+ '%d', // recurring_event
+ '%d', // month_of_year
+ '%d', // week_of_month
+ '%d', // day_of_week
+ '%d', // day_of_month
+ '%d', // by_day_of_month
+ '%d', // last_day_of_month
+ '%s' // serialized_times
)
);
$recurr_id = $this->wpdb->insert_id;
diff --git a/src/ICal/Event.php b/src/ICal/Event.php
new file mode 100644
index 0000000..cb68bf3
--- /dev/null
+++ b/src/ICal/Event.php
@@ -0,0 +1,202 @@
+%s: %s
';
+
+ /**
+ * http://www.kanzaki.com/docs/ical/summary.html
+ *
+ * @var $summary
+ */
+ public $summary;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/dtstart.html
+ *
+ * @var $dtstart
+ */
+ public $dtstart;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/dtend.html
+ *
+ * @var $dtend
+ */
+ public $dtend;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/duration.html
+ *
+ * @var $duration
+ */
+ public $duration;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/dtstamp.html
+ *
+ * @var $dtstamp
+ */
+ public $dtstamp;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/uid.html
+ *
+ * @var $uid
+ */
+ public $uid;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/created.html
+ *
+ * @var $created
+ */
+ public $created;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/lastModified.html
+ *
+ * @var $lastmodified
+ */
+ public $lastmodified;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/description.html
+ *
+ * @var $description
+ */
+ public $description;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/location.html
+ *
+ * @var $location
+ */
+ public $location;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/sequence.html
+ *
+ * @var $sequence
+ */
+ public $sequence;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/status.html
+ *
+ * @var $status
+ */
+ public $status;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/transp.html
+ *
+ * @var $transp
+ */
+ public $transp;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/organizer.html
+ *
+ * @var $organizer
+ */
+ public $organizer;
+
+ /**
+ * http://www.kanzaki.com/docs/ical/attendee.html
+ *
+ * @var $attendee
+ */
+ public $attendee;
+
+ /**
+ * Creates the Event object
+ *
+ * @param array $data
+ * @return void
+ */
+ public function __construct(array $data = array())
+ {
+ if (!empty($data)) {
+ foreach ($data as $key => $value) {
+ $variable = self::snakeCase($key);
+ $this->{$variable} = self::prepareData($value);
+ }
+ }
+ }
+
+ /**
+ * Prepares the data for output
+ *
+ * @param mixed $value
+ * @return mixed
+ */
+ protected function prepareData($value)
+ {
+ if (is_string($value)) {
+ return stripslashes(trim(str_replace('\n', "\n", $value)));
+ } elseif (is_array($value)) {
+ return array_map('self::prepareData', $value);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Returns Event data excluding anything blank
+ * within an HTML template
+ *
+ * @param string $html HTML template to use
+ * @return string
+ */
+ public function printData($html = self::HTML_TEMPLATE)
+ {
+ $data = array(
+ 'SUMMARY' => $this->summary,
+ 'DTSTART' => $this->dtstart,
+ 'DTEND' => $this->dtend,
+ 'DTSTART_TZ' => $this->dtstart_tz,
+ 'DTEND_TZ' => $this->dtend_tz,
+ 'DURATION' => $this->duration,
+ 'DTSTAMP' => $this->dtstamp,
+ 'UID' => $this->uid,
+ 'CREATED' => $this->created,
+ 'LAST-MODIFIED' => $this->lastmodified,
+ 'DESCRIPTION' => $this->description,
+ 'LOCATION' => $this->location,
+ 'SEQUENCE' => $this->sequence,
+ 'STATUS' => $this->status,
+ 'TRANSP' => $this->transp,
+ 'ORGANISER' => $this->organizer,
+ 'ATTENDEE(S)' => $this->attendee,
+ );
+
+ $data = array_filter($data); // Remove any blank values
+ $output = '';
+
+ foreach ($data as $key => $value) {
+ $output .= sprintf($html, $key, $value);
+ }
+
+ return $output;
+ }
+
+ /**
+ * Converts the given input to snake_case
+ *
+ * @param string $input
+ * @param string $glue
+ * @param string $separator
+ * @return string
+ */
+ protected static function snakeCase($input, $glue = '_', $separator = '-')
+ {
+ $input = preg_split('/(?<=[a-z])(?=[A-Z])/x', $input);
+ $input = join($input, $glue);
+ $input = str_replace($separator, $glue, $input);
+
+ return strtolower($input);
+ }
+}
\ No newline at end of file
diff --git a/src/ICal/ICal.php b/src/ICal/ICal.php
new file mode 100644
index 0000000..035842e
--- /dev/null
+++ b/src/ICal/ICal.php
@@ -0,0 +1,2216 @@
+, John Grogg , Martin Thoma
+ * @license https://opensource.org/licenses/mit-license.php MIT License
+ * @version 2.1.1
+ */
+
+namespace ICal;
+
+use Carbon\Carbon;
+
+class ICal
+{
+ const DATE_TIME_FORMAT = 'Ymd\THis';
+ const DATE_TIME_FORMAT_PRETTY = 'F Y H:i:s';
+ const ICAL_DATE_TIME_TEMPLATE = 'TZID=%s:';
+ const RECURRENCE_EVENT = 'Generated recurrence event';
+ const SECONDS_IN_A_WEEK = 604800;
+ const TIME_FORMAT = 'His';
+ const TIME_ZONE_UTC = 'UTC';
+ const UNIX_FORMAT = 'U';
+ const UNIX_MIN_YEAR = 1970;
+
+ /**
+ * Tracks the number of alarms in the current iCal feed
+ *
+ * @var integer
+ */
+ public $alarmCount = 0;
+
+ /**
+ * Tracks the number of events in the current iCal feed
+ *
+ * @var integer
+ */
+ public $eventCount = 0;
+
+ /**
+ * Tracks the free/busy count in the current iCal feed
+ *
+ * @var integer
+ */
+ public $freeBusyCount = 0;
+
+ /**
+ * Tracks the number of todos in the current iCal feed
+ *
+ * @var integer
+ */
+ public $todoCount = 0;
+
+ /**
+ * The value in years to use for indefinite, recurring events
+ *
+ * @var integer
+ */
+ public $defaultSpan = 2;
+
+ /**
+ * Enables customisation of the default time zone
+ *
+ * @var string
+ */
+ public $defaultTimeZone;
+
+ /**
+ * The two letter representation of the first day of the week
+ *
+ * @var string
+ */
+ public $defaultWeekStart = 'MO';
+
+ /**
+ * Toggles whether to skip the parsing of recurrence rules
+ *
+ * @var boolean
+ */
+ public $skipRecurrence = false;
+
+ /**
+ * Toggles whether to use time zone info when parsing recurrence rules
+ *
+ * @var boolean
+ */
+ public $useTimeZoneWithRRules = false;
+
+ /**
+ * The parsed calendar
+ *
+ * @var array
+ */
+ public $cal = array();
+
+ /**
+ * Tracks the VFREEBUSY component
+ *
+ * @var integer
+ */
+ protected $freeBusyIndex = 0;
+
+ /**
+ * Variable to track the previous keyword
+ *
+ * @var string
+ */
+ protected $lastKeyword;
+
+ /**
+ * Cache valid time zones to avoid unnecessary lookups
+ *
+ * @var array
+ */
+ protected $validTimeZones = array();
+
+ /**
+ * Event recurrence instances that have been altered
+ *
+ * @var array
+ */
+ protected $alteredRecurrenceInstances = array();
+
+ /**
+ * An associative array containing ordinal data
+ *
+ * @var array
+ */
+ protected $dayOrdinals = array(
+ 1 => 'first',
+ 2 => 'second',
+ 3 => 'third',
+ 4 => 'fourth',
+ 5 => 'fifth',
+ );
+
+ /**
+ * An associative array containing weekday conversion data
+ *
+ * @var array
+ */
+ protected $weekdays = array(
+ 'SU' => 'sunday',
+ 'MO' => 'monday',
+ 'TU' => 'tuesday',
+ 'WE' => 'wednesday',
+ 'TH' => 'thursday',
+ 'FR' => 'friday',
+ 'SA' => 'saturday',
+ );
+
+ /**
+ * An associative array containing week conversion data
+ * (UK = SU, Europe = MO)
+ *
+ * @var array
+ */
+ protected $weeks = array(
+ 'SA' => array('SA', 'SU', 'MO', 'TU', 'WE', 'TH', 'FR'),
+ 'SU' => array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'),
+ 'MO' => array('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'),
+ );
+
+ /**
+ * An associative array containing month names
+ *
+ * @var array
+ */
+ protected $monthNames = array(
+ 1 => 'January',
+ 2 => 'February',
+ 3 => 'March',
+ 4 => 'April',
+ 5 => 'May',
+ 6 => 'June',
+ 7 => 'July',
+ 8 => 'August',
+ 9 => 'September',
+ 10 => 'October',
+ 11 => 'November',
+ 12 => 'December',
+ );
+
+ /**
+ * An associative array containing frequency conversion terms
+ *
+ * @var array
+ */
+ protected $frequencyConversion = array(
+ 'DAILY' => 'day',
+ 'WEEKLY' => 'week',
+ 'MONTHLY' => 'month',
+ 'YEARLY' => 'year',
+ );
+
+ /**
+ * Define which variables can be configured
+ *
+ * @var array
+ */
+ private static $configurableOptions = array(
+ 'defaultSpan',
+ 'defaultTimeZone',
+ 'defaultWeekStart',
+ 'skipRecurrence',
+ 'useTimeZoneWithRRules',
+ );
+
+ /**
+ * Creates the ICal object
+ *
+ * @param mixed $files The path or URL to each ICS file to parse
+ * or iCal content provided as an array
+ * @param array $options Default options to be used by the parser
+ * @return void
+ */
+ public function __construct($files = false, array $options = array())
+ {
+ ini_set('auto_detect_line_endings', '1');
+
+ foreach ($options as $option => $value) {
+ if (in_array($option, self::$configurableOptions)) {
+ $this->{$option} = $value;
+ }
+ }
+
+ // Fallback to use the system default time zone
+ if (!isset($this->defaultTimeZone) || !$this->isValidTimeZoneId($this->defaultTimeZone)) {
+ $this->defaultTimeZone = date_default_timezone_get();
+ }
+
+ if ($files !== false) {
+ $files = is_array($files) ? $files : array($files);
+
+ foreach ($files as $file) {
+ if ($this->isFileOrUrl($file)) {
+ $lines = $this->fileOrUrl($file);
+ } else {
+ $lines = is_array($file) ? $file : array($file);
+ }
+
+ $this->initLines($lines);
+ }
+ }
+ }
+
+ /**
+ * Initialises lines from a string
+ *
+ * @param string $string The contents of the ICS file to initialise
+ * @return ICal
+ */
+ public function initString($string)
+ {
+ if (empty($this->cal)) {
+ $lines = explode(PHP_EOL, $string);
+
+ $this->initLines($lines);
+ } else {
+ trigger_error('ICal::initString: Calendar already initialised in constructor', E_USER_NOTICE);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Initialises lines from a file
+ *
+ * @param string $file The file path or URL of the ICS to use
+ * @return ICal
+ */
+ public function initFile($file)
+ {
+ if (empty($this->cal)) {
+ $lines = $this->fileOrUrl($file);
+
+ $this->initLines($lines);
+ } else {
+ trigger_error('ICal::initFile: Calendar already initialised in constructor', E_USER_NOTICE);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Initialises lines from a URL
+ *
+ * @param string $url The url of the ICS file to download and initialise from
+ * @return ICal
+ */
+ public function initUrl($url)
+ {
+ $this->initFile($url);
+
+ return $this;
+ }
+
+ /**
+ * Initialises the parser using an array
+ * containing each line of iCal content
+ *
+ * @param array $lines The lines to initialise
+ * @return void
+ */
+ protected function initLines(array $lines)
+ {
+ $lines = $this->unfold($lines);
+
+ if (stristr($lines[0], 'BEGIN:VCALENDAR') !== false) {
+ $component = '';
+ foreach ($lines as $line) {
+ $line = rtrim($line); // Trim trailing whitespace
+ $line = $this->removeUnprintableChars($line);
+ $line = $this->cleanData($line);
+ $add = $this->keyValueFromString($line);
+
+ $keyword = $add[0];
+ $values = $add[1]; // May be an array containing multiple values
+
+ if (!is_array($values)) {
+ if (!empty($values)) {
+ $values = array($values); // Make an array as not already
+ $blankArray = array(); // Empty placeholder array
+ array_push($values, $blankArray);
+ } else {
+ $values = array(); // Use blank array to ignore this line
+ }
+ } elseif (empty($values[0])) {
+ $values = array(); // Use blank array to ignore this line
+ }
+
+ // Reverse so that our array of properties is processed first
+ $values = array_reverse($values);
+
+ foreach ($values as $value) {
+ switch ($line) {
+ // http://www.kanzaki.com/docs/ical/vtodo.html
+ case 'BEGIN:VTODO':
+ if (!is_array($value)) {
+ $this->todoCount++;
+ }
+ $component = 'VTODO';
+ break;
+
+ // http://www.kanzaki.com/docs/ical/vevent.html
+ case 'BEGIN:VEVENT':
+ if (!is_array($value)) {
+ $this->eventCount++;
+ }
+ $component = 'VEVENT';
+ break;
+
+ // http://www.kanzaki.com/docs/ical/vfreebusy.html
+ case 'BEGIN:VFREEBUSY':
+ if (!is_array($value)) {
+ $this->freeBusyIndex++;
+ }
+ $component = 'VFREEBUSY';
+ break;
+
+ case 'BEGIN:VALARM':
+ if (!is_array($value)) {
+ $this->alarmCount++;
+ }
+ $component = 'VALARM';
+ break;
+
+ case 'END:VALARM':
+ $component = 'VEVENT';
+ break;
+
+ case 'BEGIN:DAYLIGHT':
+ case 'BEGIN:STANDARD':
+ case 'BEGIN:VCALENDAR':
+ case 'BEGIN:VTIMEZONE':
+ $component = $value;
+ break;
+
+ case 'END:DAYLIGHT':
+ case 'END:STANDARD':
+ case 'END:VCALENDAR':
+ case 'END:VEVENT':
+ case 'END:VFREEBUSY':
+ case 'END:VTIMEZONE':
+ case 'END:VTODO':
+ $component = 'VCALENDAR';
+ break;
+
+ default:
+ $this->addCalendarComponentWithKeyAndValue($component, $keyword, $value);
+ break;
+ }
+ }
+ }
+
+ $this->processEvents();
+
+ if (!$this->skipRecurrence) {
+ $this->processRecurrences();
+ }
+
+ $this->processDateConversions();
+ }
+ }
+
+ /**
+ * Unfolds an iCal file in preparation for parsing
+ * (https://icalendar.org/iCalendar-RFC-5545/3-1-content-lines.html)
+ *
+ * @param array $lines The contents of the iCal string to unfold
+ * @return string
+ */
+ protected function unfold(array $lines)
+ {
+ $string = implode(PHP_EOL, $lines);
+ $string = preg_replace('/' . PHP_EOL . '[ \t]/', '', $string);
+ $lines = explode(PHP_EOL, $string);
+
+ return $lines;
+ }
+
+ /**
+ * Add one key and value pair to the `$this->cal` array
+ *
+ * @param string $component This could be VTODO, VEVENT, VCALENDAR, ...
+ * @param string|boolean $keyword The keyword, for example DTSTART
+ * @param string $value The value, for example 20110105T090000Z
+ * @return void
+ */
+ protected function addCalendarComponentWithKeyAndValue($component, $keyword, $value)
+ {
+ if ($keyword == false) {
+ $keyword = $this->lastKeyword;
+ }
+
+ switch ($component) {
+ case 'VALARM':
+ $key1 = 'VEVENT';
+ $key2 = ($this->eventCount - 1);
+ $key3 = $component;
+
+ if (!isset($this->cal[$key1][$key2][$key3]["{$keyword}_array"])) {
+ $this->cal[$key1][$key2][$key3]["{$keyword}_array"] = array();
+ }
+
+ if (is_array($value)) {
+ // Add array of properties to the end
+ array_push($this->cal[$key1][$key2][$key3]["{$keyword}_array"], $value);
+ } else {
+ if (!isset($this->cal[$key1][$key2][$key3][$keyword])) {
+ $this->cal[$key1][$key2][$key3][$keyword] = $value;
+ }
+
+ if ($this->cal[$key1][$key2][$key3][$keyword] !== $value) {
+ $this->cal[$key1][$key2][$key3][$keyword] .= ',' . $value;
+ }
+ }
+ break;
+
+ case 'VEVENT':
+ $key1 = $component;
+ $key2 = ($this->eventCount - 1);
+
+ if (!isset($this->cal[$key1][$key2]["{$keyword}_array"])) {
+ $this->cal[$key1][$key2]["{$keyword}_array"] = array();
+ }
+
+ if (is_array($value)) {
+ // Add array of properties to the end
+ array_push($this->cal[$key1][$key2]["{$keyword}_array"], $value);
+ } else {
+ if (!isset($this->cal[$key1][$key2][$keyword])) {
+ $this->cal[$key1][$key2][$keyword] = $value;
+ }
+
+ if ($keyword === 'EXDATE') {
+ if (trim($value) === $value) {
+ $array = array_filter(explode(',', $value));
+ $this->cal[$key1][$key2]["{$keyword}_array"][] = $array;
+ } else {
+ $value = explode(',', implode(',', $this->cal[$key1][$key2]["{$keyword}_array"][1]) . trim($value));
+ $this->cal[$key1][$key2]["{$keyword}_array"][1] = $value;
+ }
+ } else {
+ $this->cal[$key1][$key2]["{$keyword}_array"][] = $value;
+
+ if ($keyword === 'DURATION') {
+ $duration = new \DateInterval($value);
+ array_push($this->cal[$key1][$key2]["{$keyword}_array"], $duration);
+ }
+ }
+
+ if ($this->cal[$key1][$key2][$keyword] !== $value) {
+ $this->cal[$key1][$key2][$keyword] .= ',' . $value;
+ }
+ }
+ break;
+
+ case 'VFREEBUSY':
+ $key1 = $component;
+ $key2 = ($this->freeBusyIndex - 1);
+ $key3 = $keyword;
+
+ if ($keyword === 'FREEBUSY') {
+ if (is_array($value)) {
+ $this->cal[$key1][$key2][$key3][][] = $value;
+ } else {
+ $this->freeBusyCount++;
+
+ end($this->cal[$key1][$key2][$key3]);
+ $key = key($this->cal[$key1][$key2][$key3]);
+
+ $value = explode('/', $value);
+ $this->cal[$key1][$key2][$key3][$key][] = $value;
+ }
+ } else {
+ $this->cal[$key1][$key2][$key3][] = $value;
+ }
+ break;
+
+ case 'VTODO':
+ $this->cal[$component][$this->todoCount - 1][$keyword] = $value;
+ break;
+
+ default:
+ $this->cal[$component][$keyword] = $value;
+ break;
+ }
+
+ $this->lastKeyword = $keyword;
+ }
+
+ /**
+ * Gets the key value pair from an iCal string
+ *
+ * @param string $text
+ * @return array
+ */
+ protected function keyValueFromString($text)
+ {
+ $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
+
+ $colon = strpos($text, ':');
+ $quote = strpos($text, '"');
+ if ($colon === false) {
+ $matches = array();
+ } elseif ($quote === false || $colon < $quote) {
+ list($before, $after) = explode(':', $text, 2);
+ $matches = array($text, $before, $after);
+ } else {
+ list($before, $text) = explode('"', $text, 2);
+ $text = '"' . $text;
+ $matches = str_getcsv($text, ':');
+ $combinedValue = '';
+
+ foreach ($matches as $key => $match) {
+ if ($key === 0) {
+ if (!empty($before)) {
+ $matches[$key] = $before . '"' . $matches[$key] . '"';
+ }
+ } else {
+ if ($key > 1) {
+ $combinedValue .= ':';
+ }
+
+ $combinedValue .= $matches[$key];
+ }
+ }
+ $matches = array_slice($matches, 0, 2);
+ $matches[1] = $combinedValue;
+ array_unshift($matches, $before . $text);
+ }
+
+ if (count($matches) === 0) {
+ return false;
+ }
+
+ if (preg_match('/^([A-Z-]+)([;][\w\W]*)?$/', $matches[1])) {
+ $matches = array_splice($matches, 1, 2); // Remove first match and re-align ordering
+
+ // Process properties
+ if (preg_match('/([A-Z-]+)[;]([\w\W]*)/', $matches[0], $properties)) {
+ // Remove first match
+ array_shift($properties);
+ // Fix to ignore everything in keyword after a ; (e.g. Language, TZID, etc.)
+ $matches[0] = $properties[0];
+ array_shift($properties); // Repeat removing first match
+
+ $formatted = array();
+ foreach ($properties as $property) {
+ // Match semicolon separator outside of quoted substrings
+ preg_match_all('~[^' . PHP_EOL . '";]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '";]*)*~', $property, $attributes);
+ // Remove multi-dimensional array and use the first key
+ $attributes = (sizeof($attributes) === 0) ? array($property) : reset($attributes);
+
+ if (is_array($attributes)) {
+ foreach ($attributes as $attribute) {
+ // Match equals sign separator outside of quoted substrings
+ preg_match_all(
+ '~[^' . PHP_EOL . '"=]+(?:"[^"\\\]*(?:\\\.[^"\\\]*)*"[^' . PHP_EOL . '"=]*)*~',
+ $attribute,
+ $values
+ );
+ // Remove multi-dimensional array and use the first key
+ $value = (sizeof($values) === 0) ? null : reset($values);
+
+ if (is_array($value) && isset($value[1])) {
+ // Remove double quotes from beginning and end only
+ $formatted[$value[0]] = trim($value[1], '"');
+ }
+ }
+ }
+ }
+
+ // Assign the keyword property information
+ $properties[0] = $formatted;
+
+ // Add match to beginning of array
+ array_unshift($properties, $matches[1]);
+ $matches[1] = $properties;
+ }
+
+ return $matches;
+ } else {
+ return false; // Ignore this match
+ }
+ }
+
+ /**
+ * Returns a `DateTime` object from an iCal date time format
+ *
+ * @param string $icalDate A Date in the format YYYYMMDD[T]HHMMSS[Z],
+ * YYYYMMDD[T]HHMMSS or
+ * TZID={Time Zone}:YYYYMMDD[T]HHMMSS
+ * @param boolean $forceTimeZone Whether to force the time zone; the event's or the default
+ * @param boolean $forceUtc Whether to force the time zone as UTC
+ * @return DateTime
+ */
+ public function iCalDateToDateTime($icalDate, $forceTimeZone = false, $forceUtc = false)
+ {
+ /**
+ * iCal times may be in 3 formats, (http://www.kanzaki.com/docs/ical/dateTime.html)
+ *
+ * UTC: Has a trailing 'Z'
+ * Floating: No time zone reference specified, no trailing 'Z', use local time
+ * TZID: Set time zone as specified
+ *
+ * Use DateTime class objects to get around limitations with `mktime` and `gmmktime`.
+ * Must have a local time zone set to process floating times.
+ */
+ $pattern = '/\AT?Z?I?D?=?(.*):?'; // [1]: Time zone
+ $pattern .= '([0-9]{4})'; // [2]: YYYY
+ $pattern .= '([0-9]{2})'; // [3]: MM
+ $pattern .= '([0-9]{2})'; // [4]: DD
+ $pattern .= 'T?'; // Time delimiter
+ $pattern .= '([0-9]{0,2})'; // [5]: HH
+ $pattern .= '([0-9]{0,2})'; // [6]: MM
+ $pattern .= '([0-9]{0,2})'; // [7]: SS
+ $pattern .= '(Z?)/'; // [8]: UTC flag
+
+ preg_match($pattern, $icalDate, $date);
+
+ if (empty($date)) {
+ // Default to the initial
+ $dateTime = $icalDate;
+ } else {
+ // A Unix timestamp cannot represent a date prior to 1 Jan 1970
+ $year = $date[2];
+ $isUtc = false;
+
+ if ($year <= self::UNIX_MIN_YEAR) {
+ $eventTimeZone = ltrim(strstr($icalDate, ':', true), 'TZID=');
+
+ if (empty($eventTimeZone)) {
+ $dateTime = new \DateTime($icalDate, new \DateTimeZone($this->defaultTimeZone));
+ } else {
+ $icalDate = ltrim(strstr($icalDate, ':'), ':');
+ $dateTime = new \DateTime($icalDate, new \DateTimeZone($eventTimeZone));
+ }
+ } else {
+ if ($forceTimeZone) {
+ // TZID={Time Zone}:
+ if (isset($date[1])) {
+ $eventTimeZone = rtrim($date[1], ':');
+ }
+
+ if ($date[8] === 'Z') {
+ $isUtc = true;
+ $dateTime = new \DateTime('now', new \DateTimeZone(self::TIME_ZONE_UTC));
+ } elseif (isset($eventTimeZone) && $this->isValidTimeZoneId($eventTimeZone)) {
+ $dateTime = new \DateTime('now', new \DateTimeZone($eventTimeZone));
+ } else {
+ $dateTime = new \DateTime('now', new \DateTimeZone($this->defaultTimeZone));
+ }
+ } else {
+ if ($forceUtc) {
+ $dateTime = new \DateTime('now', new \DateTimeZone(self::TIME_ZONE_UTC));
+ } else {
+ $dateTime = new \DateTime('now');
+ }
+ }
+
+ $dateTime->setDate((int) $date[2], (int) $date[3], (int) $date[4]);
+ $dateTime->setTime((int) $date[5], (int) $date[6], (int) $date[7]);
+ }
+
+ if ($forceTimeZone && $isUtc) {
+ $dateTime->setTimezone(new \DateTimeZone($this->defaultTimeZone));
+ } elseif ($forceUtc) {
+ $dateTime->setTimezone(new \DateTimeZone(self::TIME_ZONE_UTC));
+ }
+ }
+
+ return $dateTime;
+ }
+
+ /**
+ * Returns a Unix timestamp from an iCal date time format
+ *
+ * @param string $icalDate A Date in the format YYYYMMDD[T]HHMMSS[Z],
+ * YYYYMMDD[T]HHMMSS or
+ * TZID={Time Zone}:YYYYMMDD[T]HHMMSS
+ * @param boolean $forceTimeZone Whether to force the time zone; the event's or the default
+ * @param boolean $forceUtc Whether to force the time zone as UTC
+ * @return integer
+ */
+ public function iCalDateToUnixTimestamp($icalDate, $forceTimeZone = false, $forceUtc = false)
+ {
+ $dateTime = $this->iCalDateToDateTime($icalDate, $forceTimeZone, $forceUtc);
+ $offset = 0;
+
+ if ($forceTimeZone) {
+ $offset = $dateTime->getOffset();
+ }
+
+ return $dateTime->getTimestamp() + $offset;
+ }
+
+ /**
+ * Returns a date adapted to the calendar time zone depending on the event `TZID`
+ *
+ * @param array $event An event
+ * @param string $key An event property (`DTSTART` or `DTEND`)
+ * @param string $format The date format to apply
+ * @return string|boolean
+ */
+ public function iCalDateWithTimeZone(array $event, $key, $format = self::DATE_TIME_FORMAT)
+ {
+ if (!isset($event[$key . '_array']) || !isset($event[$key])) {
+ return false;
+ }
+
+ $dateArray = $event[$key . '_array'];
+ $date = $event[$key];
+
+ if ($key === 'DURATION') {
+ $duration = end($dateArray);
+ $dateTime = $this->parseDuration($event['DTSTART'], $duration, null);
+ } else {
+ $dateTime = new \DateTime($dateArray[1], new \DateTimeZone(self::TIME_ZONE_UTC));
+ $dateTime->setTimezone(new \DateTimeZone($this->calendarTimeZone()));
+ }
+
+ // Force time zone
+ if (isset($dateArray[0]['TZID'])) {
+ if ($this->isValidTimeZoneId($dateArray[0]['TZID'])) {
+ $dateTime->setTimezone(new \DateTimeZone($dateArray[0]['TZID']));
+ } else {
+ $dateTime->setTimezone(new \DateTimeZone($this->defaultTimeZone));
+ }
+ }
+
+ if (is_null($format)) {
+ $output = $dateTime;
+ } else {
+ if ($format === self::UNIX_FORMAT) {
+ $output = $dateTime->getTimestamp();
+ } else {
+ $output = $dateTime->format($format);
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Performs admin tasks on all events as read from the iCal file.
+ * Adds a Unix timestamp to all `{DTSTART|DTEND|RECURRENCE-ID}_array` arrays
+ * Tracks modified recurrence instances
+ *
+ * @return boolean|void
+ */
+ protected function processEvents()
+ {
+ $events = (isset($this->cal['VEVENT'])) ? $this->cal['VEVENT'] : array();
+
+ if (empty($events)) {
+ return false;
+ }
+
+ foreach ($events as $key => $anEvent) {
+ foreach (array('DTSTART', 'DTEND', 'RECURRENCE-ID') as $type) {
+ if (isset($anEvent[$type])) {
+ $date = $anEvent[$type . '_array'][1];
+ if (isset($anEvent[$type . '_array'][0]['TZID'])) {
+ $date = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent[$type . '_array'][0]['TZID']) . $date;
+ }
+ $anEvent[$type . '_array'][2] = $this->iCalDateToUnixTimestamp($date);
+ $anEvent[$type . '_array'][3] = $date;
+ }
+ }
+
+ if (isset($anEvent['RECURRENCE-ID'])) {
+ $uid = $anEvent['UID'];
+ if (!isset($this->alteredRecurrenceInstances[$uid])) {
+ $this->alteredRecurrenceInstances[$uid] = array();
+ }
+ $recurrenceDateUtc = $this->iCalDateToUnixTimestamp($anEvent['RECURRENCE-ID_array'][3], true, true);
+ $this->alteredRecurrenceInstances[$uid][$key] = $recurrenceDateUtc;
+ }
+
+ $events[$key] = $anEvent;
+ }
+
+ $eventKeysToRemove = array();
+ foreach ($events as $key => $event) {
+ $checks[] = !isset($event['RECURRENCE-ID']);
+ $checks[] = isset($event['UID']);
+ $checks[] = isset($this->alteredRecurrenceInstances[$event['UID']]);
+
+ if ((bool) array_product($checks)) {
+ $eventDtstartUnix = $this->iCalDateToUnixTimestamp($event['DTSTART_array'][3], true, true);
+
+ if (false !== $alteredEventKey = array_search($eventDtstartUnix, $this->alteredRecurrenceInstances[$event['UID']])) {
+ $events[$key] = array_replace_recursive($events[$key], $events[$alteredEventKey]);
+ $eventKeysToRemove[] = $alteredEventKey;
+ }
+ }
+ unset($checks);
+ }
+ $events = array_diff_key($events, array_flip($eventKeysToRemove));
+
+ $this->cal['VEVENT'] = $events;
+ }
+
+ /**
+ * Processes recurrence rules
+ *
+ * @return boolean|void
+ */
+ protected function processRecurrences()
+ {
+ $events = (isset($this->cal['VEVENT'])) ? $this->cal['VEVENT'] : array();
+
+ $recurrenceEvents = array();
+ $allRecurrenceEvents = array();
+
+ if (empty($events)) {
+ return false;
+ }
+
+ foreach ($events as $anEvent) {
+ if (isset($anEvent['RRULE']) && $anEvent['RRULE'] !== '') {
+ // Tag as generated by a recurrence rule
+ $anEvent['RRULE_array'][2] = self::RECURRENCE_EVENT;
+
+ $isAllDayEvent = (strlen($anEvent['DTSTART_array'][1]) === 8) ? true : false;
+
+ $initialStart = new \DateTime($anEvent['DTSTART_array'][1]);
+ $initialStartOffset = $initialStart->getOffset();
+ $initialStartTimeZoneName = $initialStart->getTimezone()->getName();
+
+ if (isset($anEvent['DTEND'])) {
+ $initialEnd = new \DateTime($anEvent['DTEND_array'][1]);
+ $initialEndOffset = $initialEnd->getOffset();
+ $initialEndTimeZoneName = $initialEnd->getTimezone()->getName();
+ } else {
+ $initialEndTimeZoneName = $initialStartTimeZoneName;
+ }
+
+ // Recurring event, parse RRULE and add appropriate duplicate events
+ $rrules = array();
+ $rruleStrings = explode(';', $anEvent['RRULE']);
+ foreach ($rruleStrings as $s) {
+ list($k, $v) = explode('=', $s);
+ $rrules[$k] = $v;
+ }
+ // Get frequency
+ $frequency = $rrules['FREQ'];
+ // Get Start timestamp
+ $startTimestamp = $initialStart->getTimestamp();
+ if (isset($anEvent['DTEND'])) {
+ $endTimestamp = $initialEnd->getTimestamp();
+ } elseif (isset($anEvent['DURATION'])) {
+ $duration = end($anEvent['DURATION_array']);
+ $endTimestamp = $this->parseDuration($anEvent['DTSTART'], $duration);
+ } else {
+ $endTimestamp = $anEvent['DTSTART_array'][2];
+ }
+ $eventTimestampOffset = $endTimestamp - $startTimestamp;
+ // Get Interval
+ $interval = (isset($rrules['INTERVAL']) && $rrules['INTERVAL'] !== '') ? $rrules['INTERVAL'] : 1;
+
+ $dayNumber = null;
+ $weekday = null;
+
+ if (in_array($frequency, array('MONTHLY', 'YEARLY')) && isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
+ // Deal with BYDAY
+ $byDay = $rrules['BYDAY'];
+ $dayNumber = intval($byDay);
+
+ if (empty($dayNumber)) { // Returns 0 when no number defined in BYDAY
+ if (!isset($rrules['BYSETPOS'])) {
+ $dayNumber = 1; // Set first as default
+ } elseif (is_numeric($rrules['BYSETPOS'])) {
+ $dayNumber = $rrules['BYSETPOS'];
+ }
+ }
+
+ $weekday = substr($byDay, -2);
+ }
+
+ $untilDefault = date_create('now');
+ $untilDefault->modify($this->defaultSpan . ' year');
+ $untilDefault->setTime(23, 59, 59); // End of the day
+
+ // Compute EXDATEs
+ $exdates = $this->parseExdates($anEvent);
+
+ if (isset($rrules['UNTIL'])) {
+ // Get Until
+ $until = strtotime($rrules['UNTIL']);
+ } elseif (isset($rrules['COUNT'])) {
+ $countOrig = (is_numeric($rrules['COUNT']) && $rrules['COUNT'] > 1) ? $rrules['COUNT'] : 0;
+
+ // Increment count by the number of excluded dates
+ $countOrig += sizeof($exdates);
+
+ // Remove one to exclude the occurrence that initialises the rule
+ $count = ($countOrig - 1);
+
+ if ($interval >= 2) {
+ $count += ($count > 0) ? ($count * $interval) : 0;
+ }
+
+ $countNb = 1;
+ $offset = "+{$count} " . $this->frequencyConversion[$frequency];
+ $until = strtotime($offset, $startTimestamp);
+
+ if (in_array($frequency, array('MONTHLY', 'YEARLY'))
+ && isset($rrules['BYDAY']) && $rrules['BYDAY'] !== ''
+ ) {
+ $dtstart = date_create($anEvent['DTSTART']);
+
+ if (!$dtstart) {
+ continue;
+ }
+
+ for ($i = 1; $i <= $count; $i++) {
+ $dtstartClone = clone $dtstart;
+ $dtstartClone->modify('next ' . $this->frequencyConversion[$frequency]);
+ $offset = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $dtstartClone)} {$this->weekdays[$weekday]} of " . $dtstartClone->format('F Y H:i:01');
+ $dtstart->modify($offset);
+ }
+
+ // Jumping X months forwards doesn't mean
+ // the end date will fall on the same day defined in BYDAY
+ // Use the largest of these to ensure we are going far enough
+ // in the future to capture our final end day
+ $until = max($until, $dtstart->format(self::UNIX_FORMAT));
+ }
+
+ unset($offset);
+ } else {
+ $until = $untilDefault->getTimestamp();
+ }
+
+ $until = intval($until);
+
+ // Decide how often to add events and do so
+ switch ($frequency) {
+ case 'DAILY':
+ // Simply add a new event each interval of days until UNTIL is reached
+ $offset = "+{$interval} day";
+ $recurringTimestamp = strtotime($offset, $startTimestamp);
+
+ while ($recurringTimestamp <= $until) {
+ $dayRecurringTimestamp = $recurringTimestamp;
+
+ // Adjust time zone from initial event
+ $dayRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $dayRecurringTimestamp);
+ $recurringTimeZone->setTimezone($initialStart->getTimezone());
+ $dayRecurringOffset = $recurringTimeZone->getOffset();
+ $dayRecurringTimestamp += $dayRecurringOffset;
+ }
+
+ // Add event
+ $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $dayRecurringTimestamp) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $dayRecurringTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $dayRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $dayRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break;
+ }
+ }
+ }
+
+ // Move forwards
+ $recurringTimestamp = strtotime($offset, $recurringTimestamp);
+ }
+
+ $recurrenceEvents = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
+ $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
+ $recurrenceEvents = array(); // Reset
+
+ break;
+
+ case 'WEEKLY':
+ // Create offset
+ $offset = "+{$interval} week";
+
+ $wkst = (isset($rrules['WKST']) && in_array($rrules['WKST'], array('SA', 'SU', 'MO'))) ? $rrules['WKST'] : $this->defaultWeekStart;
+ $aWeek = $this->weeks[$wkst];
+ $days = array('SA' => 'Saturday', 'SU' => 'Sunday', 'MO' => 'Monday');
+
+ // Build list of days of week to add events
+ $weekdays = $aWeek;
+
+ if (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
+ $byDays = explode(',', $rrules['BYDAY']);
+ } else {
+ // A textual representation of a day, two letters (e.g. SU)
+ $byDays = array(mb_substr(strtoupper($initialStart->format('D')), 0, 2));
+ }
+
+ // Get timestamp of first day of start week
+ $weekRecurringTimestamp = (strcasecmp($initialStart->format('l'), $this->weekdays[$wkst]) === 0)
+ ? $startTimestamp
+ : strtotime("last {$days[$wkst]} " . $initialStart->format('H:i:s'), $startTimestamp);
+
+ // Step through weeks
+ while ($weekRecurringTimestamp <= $until) {
+ $dayRecurringTimestamp = $weekRecurringTimestamp;
+
+ // Adjust time zone from initial event
+ $dayRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $dayRecurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $dayRecurringTimestamp);
+ $dayRecurringTimeZone->setTimezone($initialStart->getTimezone());
+ $dayRecurringOffset = $dayRecurringTimeZone->getOffset();
+ $dayRecurringTimestamp += $dayRecurringOffset;
+ }
+
+ foreach ($weekdays as $day) {
+ // Check if day should be added
+ if (in_array($day, $byDays) && $dayRecurringTimestamp > $startTimestamp
+ && $dayRecurringTimestamp <= $until
+ ) {
+ // Add event
+ $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $dayRecurringTimestamp) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $dayRecurringTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $dayRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $dayRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break 2;
+ }
+ }
+ }
+ }
+
+ // Move forwards a day
+ $dayRecurringTimestamp = strtotime('+1 day', $dayRecurringTimestamp);
+ }
+
+ // Move forwards $interval weeks
+ $weekRecurringTimestamp = strtotime($offset, $weekRecurringTimestamp);
+ }
+
+ $recurrenceEvents = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
+ $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
+ $recurrenceEvents = array(); // Reset
+
+ break;
+
+ case 'MONTHLY':
+ // Create offset
+ $recurringTimestamp = $startTimestamp;
+ $offset = "+{$interval} month";
+
+ if (isset($rrules['BYMONTHDAY']) && $rrules['BYMONTHDAY'] !== '') {
+ // Deal with BYMONTHDAY
+ $monthdays = explode(',', $rrules['BYMONTHDAY']);
+
+ while ($recurringTimestamp <= $until) {
+ foreach ($monthdays as $key => $monthday) {
+ if ($key === 0) {
+ // Ensure original event conforms to monthday rule
+ $anEvent['DTSTART'] = gmdate(
+ 'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
+ strtotime($anEvent['DTSTART'])
+ ) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+
+ $anEvent['DTEND'] = gmdate(
+ 'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
+ isset($anEvent['DURATION'])
+ ? $this->parseDuration($anEvent['DTSTART'], end($anEvent['DURATION_array']))
+ : strtotime($anEvent['DTEND'])
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $this->iCalDateToUnixTimestamp($anEvent['DTSTART']);
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+ $anEvent['DTEND_array'][2] = $this->iCalDateToUnixTimestamp($anEvent['DTEND']);
+
+ // Ensure recurring timestamp confirms to BYMONTHDAY rule
+ $monthRecurringTimestamp = $this->iCalDateToUnixTimestamp(
+ gmdate(
+ 'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
+ $recurringTimestamp
+ ) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '')
+ );
+ }
+
+ // Adjust time zone from initial event
+ $monthRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $monthRecurringTimestamp);
+ $recurringTimeZone->setTimezone($initialStart->getTimezone());
+ $monthRecurringOffset = $recurringTimeZone->getOffset();
+ $monthRecurringTimestamp += $monthRecurringOffset;
+ }
+
+ // Add event
+ $anEvent['DTSTART'] = date(
+ 'Ym' . sprintf('%02d', $monthday) . '\T' . self::TIME_FORMAT,
+ $monthRecurringTimestamp
+ ) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $monthRecurringTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $monthRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $monthRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break 2;
+ }
+ }
+ }
+ }
+
+ // Move forwards
+ $recurringTimestamp = strtotime($offset, $recurringTimestamp);
+ }
+ } elseif (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
+ while ($recurringTimestamp <= $until) {
+ $monthRecurringTimestamp = $recurringTimestamp;
+
+ // Adjust time zone from initial event
+ $monthRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $monthRecurringTimestamp);
+ $recurringTimeZone->setTimezone($initialStart->getTimezone());
+ $monthRecurringOffset = $recurringTimeZone->getOffset();
+ $monthRecurringTimestamp += $monthRecurringOffset;
+ }
+
+ $eventStartDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $monthRecurringTimestamp)} {$this->weekdays[$weekday]} of "
+ . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
+ $eventStartTimestamp = strtotime($eventStartDesc);
+
+ if (intval($rrules['BYDAY']) === 0) {
+ $lastDayDesc = "last {$this->weekdays[$weekday]} of "
+ . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
+ } else {
+ $lastDayDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $monthRecurringTimestamp)} {$this->weekdays[$weekday]} of "
+ . date(self::DATE_TIME_FORMAT_PRETTY, $monthRecurringTimestamp);
+ }
+ $lastDayTimestamp = strtotime($lastDayDesc);
+
+ do {
+ // Prevent 5th day of a month from showing up on the next month
+ // If BYDAY and the event falls outside the current month, skip the event
+
+ $compareCurrentMonth = date('F', $monthRecurringTimestamp);
+ $compareEventMonth = date('F', $eventStartTimestamp);
+
+ if ($compareCurrentMonth !== $compareEventMonth) {
+ $monthRecurringTimestamp = strtotime($offset, $monthRecurringTimestamp);
+ continue;
+ }
+
+ if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp < $until) {
+ $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $monthRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $monthRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break 2;
+ }
+ }
+ }
+ }
+
+ if (isset($rrules['BYSETPOS'])) {
+ // BYSETPOS is defined so skip
+ // looping through each week
+ $lastDayTimestamp = $eventStartTimestamp;
+ }
+
+ $eventStartTimestamp += self::SECONDS_IN_A_WEEK;
+ } while ($eventStartTimestamp <= $lastDayTimestamp);
+
+ // Move forwards
+ $recurringTimestamp = strtotime($offset, $recurringTimestamp);
+ }
+ }
+
+ $recurrenceEvents = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
+ $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
+ $recurrenceEvents = array(); // Reset
+
+ break;
+
+ case 'YEARLY':
+ // Create offset
+ $recurringTimestamp = $startTimestamp;
+ $offset = "+{$interval} year";
+
+ // Deal with BYMONTH
+ if (isset($rrules['BYMONTH']) && $rrules['BYMONTH'] !== '') {
+ $bymonths = explode(',', $rrules['BYMONTH']);
+ }
+
+ // Check if BYDAY rule exists
+ if (isset($rrules['BYDAY']) && $rrules['BYDAY'] !== '') {
+ while ($recurringTimestamp <= $until) {
+ $yearRecurringTimestamp = $recurringTimestamp;
+
+ // Adjust time zone from initial event
+ $yearRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $yearRecurringTimestamp);
+ $recurringTimeZone->setTimezone($initialStart->getTimezone());
+ $yearRecurringOffset = $recurringTimeZone->getOffset();
+ $yearRecurringTimestamp += $yearRecurringOffset;
+ }
+
+ foreach ($bymonths as $bymonth) {
+ $eventStartDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $yearRecurringTimestamp)} {$this->weekdays[$weekday]}"
+ . " of {$this->monthNames[$bymonth]} "
+ . gmdate('Y H:i:s', $yearRecurringTimestamp);
+ $eventStartTimestamp = strtotime($eventStartDesc);
+
+ if (intval($rrules['BYDAY']) === 0) {
+ $lastDayDesc = "last {$this->weekdays[$weekday]}"
+ . " of {$this->monthNames[$bymonth]} "
+ . gmdate('Y H:i:s', $yearRecurringTimestamp);
+ } else {
+ $lastDayDesc = "{$this->convertDayOrdinalToPositive($dayNumber, $weekday, $yearRecurringTimestamp)} {$this->weekdays[$weekday]}"
+ . " of {$this->monthNames[$bymonth]} "
+ . gmdate('Y H:i:s', $yearRecurringTimestamp);
+ }
+ $lastDayTimestamp = strtotime($lastDayDesc);
+
+ do {
+ if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp < $until) {
+ $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $yearRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $yearRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break 3;
+ }
+ }
+ }
+ }
+
+ $eventStartTimestamp += self::SECONDS_IN_A_WEEK;
+ } while ($eventStartTimestamp <= $lastDayTimestamp);
+ }
+
+ // Move forwards
+ $recurringTimestamp = strtotime($offset, $recurringTimestamp);
+ }
+ } else {
+ $day = $initialStart->format('d');
+
+ // Step through years
+ while ($recurringTimestamp <= $until) {
+ $yearRecurringTimestamp = $recurringTimestamp;
+
+ // Adjust time zone from initial event
+ $yearRecurringOffset = 0;
+ if ($this->useTimeZoneWithRRules) {
+ $recurringTimeZone = \DateTime::createFromFormat(self::UNIX_FORMAT, $yearRecurringTimestamp);
+ $recurringTimeZone->setTimezone($initialStart->getTimezone());
+ $yearRecurringOffset = $recurringTimeZone->getOffset();
+ $yearRecurringTimestamp += $yearRecurringOffset;
+ }
+
+ $eventStartDescs = array();
+ if (isset($rrules['BYMONTH']) && $rrules['BYMONTH'] !== '') {
+ foreach ($bymonths as $bymonth) {
+ array_push($eventStartDescs, "$day {$this->monthNames[$bymonth]} " . gmdate('Y H:i:s', $yearRecurringTimestamp));
+ }
+ } else {
+ array_push($eventStartDescs, $day . gmdate(self::DATE_TIME_FORMAT_PRETTY, $yearRecurringTimestamp));
+ }
+
+ foreach ($eventStartDescs as $eventStartDesc) {
+ $eventStartTimestamp = strtotime($eventStartDesc);
+
+ if ($eventStartTimestamp > $startTimestamp && $eventStartTimestamp < $until) {
+ $anEvent['DTSTART'] = date(self::DATE_TIME_FORMAT, $eventStartTimestamp) . ($isAllDayEvent || ($initialStartTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTSTART_array'][1] = $anEvent['DTSTART'];
+ $anEvent['DTSTART_array'][2] = $eventStartTimestamp;
+ $anEvent['DTEND_array'] = $anEvent['DTSTART_array'];
+ $anEvent['DTEND_array'][2] += $eventTimestampOffset;
+ $anEvent['DTEND'] = date(
+ self::DATE_TIME_FORMAT,
+ $anEvent['DTEND_array'][2]
+ ) . ($isAllDayEvent || ($initialEndTimeZoneName === 'Z') ? 'Z' : '');
+ $anEvent['DTEND_array'][1] = $anEvent['DTEND'];
+
+ // Exclusions
+ $isExcluded = array_filter($exdates, function ($exdate) use ($anEvent, $yearRecurringOffset) {
+ return self::isExdateMatch($exdate, $anEvent, $yearRecurringOffset);
+ });
+
+ if (isset($anEvent['UID'])) {
+ $searchDate = $anEvent['DTSTART'];
+ if (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $searchDate = sprintf(self::ICAL_DATE_TIME_TEMPLATE, $anEvent['DTSTART_array'][0]['TZID']) . $searchDate;
+ }
+
+ if (isset($this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $searchDateUtc = $this->iCalDateToUnixTimestamp($searchDate, true, true);
+ if (in_array($searchDateUtc, $this->alteredRecurrenceInstances[$anEvent['UID']])) {
+ $isExcluded = true;
+ }
+ }
+ }
+
+ if (!$isExcluded) {
+ $anEvent = $this->processEventIcalDateTime($anEvent);
+ $recurrenceEvents[] = $anEvent;
+ $this->eventCount++;
+
+ // If RRULE[COUNT] is reached then break
+ if (isset($rrules['COUNT'])) {
+ $countNb++;
+
+ if ($countNb >= $countOrig) {
+ break 2;
+ }
+ }
+ }
+ }
+ }
+
+ // Move forwards
+ $recurringTimestamp = strtotime($offset, $recurringTimestamp);
+ }
+ }
+
+ $recurrenceEvents = $this->trimToRecurrenceCount($rrules, $recurrenceEvents);
+ $allRecurrenceEvents = array_merge($allRecurrenceEvents, $recurrenceEvents);
+ $recurrenceEvents = array(); // Reset
+
+ break;
+ }
+ }
+ }
+
+ $events = array_merge($events, $allRecurrenceEvents);
+
+ $this->cal['VEVENT'] = $events;
+ }
+
+ /**
+ * Processes date conversions using the time zone
+ *
+ * Add keys `DTSTART_tz` and `DTEND_tz` to each Event
+ * These keys contain dates adapted to the calendar
+ * time zone depending on the event `TZID`.
+ *
+ * @return boolean|void
+ */
+ protected function processDateConversions()
+ {
+ $events = (isset($this->cal['VEVENT'])) ? $this->cal['VEVENT'] : array();
+
+ if (empty($events)) {
+ return false;
+ }
+
+ foreach ($events as $key => $anEvent) {
+ if (!$this->isValidDate($anEvent['DTSTART'])) {
+ unset($events[$key]);
+ $this->eventCount--;
+
+ continue;
+ }
+
+ if ($this->useTimeZoneWithRRules && isset($anEvent['RRULE_array'][2]) && $anEvent['RRULE_array'][2] === self::RECURRENCE_EVENT) {
+ $events[$key]['DTSTART_tz'] = $anEvent['DTSTART'];
+ $events[$key]['DTEND_tz'] = $anEvent['DTEND'];
+ } else {
+ $events[$key]['DTSTART_tz'] = $this->iCalDateWithTimeZone($anEvent, 'DTSTART');
+
+ if ($this->iCalDateWithTimeZone($anEvent, 'DTEND')) {
+ $events[$key]['DTEND_tz'] = $this->iCalDateWithTimeZone($anEvent, 'DTEND');
+ } elseif ($this->iCalDateWithTimeZone($anEvent, 'DURATION')) {
+ $events[$key]['DTEND_tz'] = $this->iCalDateWithTimeZone($anEvent, 'DURATION');
+ }
+ }
+ }
+
+ $this->cal['VEVENT'] = $events;
+ }
+
+ /**
+ * Extends the `{DTSTART|DTEND|RECURRENCE-ID}_array`
+ * array to include an iCal date time for each event
+ * (`TZID=Timezone:YYYYMMDD[T]HHMMSS`)
+ *
+ * @param array $event
+ * @param integer $index
+ * @return array
+ */
+ protected function processEventIcalDateTime(array $event, $index = 3)
+ {
+ $calendarTimeZone = $this->calendarTimeZone(true);
+
+ foreach (array('DTSTART', 'DTEND', 'RECURRENCE-ID') as $type) {
+ if (isset($event["{$type}_array"])) {
+ $timeZone = (isset($event["{$type}_array"][0]['TZID'])) ? $event["{$type}_array"][0]['TZID'] : $calendarTimeZone;
+ $event["{$type}_array"][$index] = ((is_null($timeZone)) ? '' : sprintf(self::ICAL_DATE_TIME_TEMPLATE, $timeZone)) . $event["{$type}_array"][1];
+ }
+ }
+
+ return $event;
+ }
+
+ /**
+ * Returns an array of Events.
+ * Every event is a class with the event
+ * details being properties within it.
+ *
+ * @return array
+ */
+ public function events()
+ {
+ $array = $this->cal;
+ $array = isset($array['VEVENT']) ? $array['VEVENT'] : array();
+ $events = array();
+
+ if (!empty($array)) {
+ foreach ($array as $event) {
+ $events[] = new Event($event);
+ }
+ }
+
+ return $events;
+ }
+
+ /**
+ * Returns the calendar name
+ *
+ * @return string
+ */
+ public function calendarName()
+ {
+ return isset($this->cal['VCALENDAR']['X-WR-CALNAME']) ? $this->cal['VCALENDAR']['X-WR-CALNAME'] : '';
+ }
+
+ /**
+ * Returns the calendar description
+ *
+ * @return string
+ */
+ public function calendarDescription()
+ {
+ return isset($this->cal['VCALENDAR']['X-WR-CALDESC']) ? $this->cal['VCALENDAR']['X-WR-CALDESC'] : '';
+ }
+
+ /**
+ * Returns the calendar time zone
+ *
+ * @param boolean $ignoreUtc
+ * @return string
+ */
+ public function calendarTimeZone($ignoreUtc = false)
+ {
+ if (isset($this->cal['VCALENDAR']['X-WR-TIMEZONE'])) {
+ $timeZone = $this->cal['VCALENDAR']['X-WR-TIMEZONE'];
+ } elseif (isset($this->cal['VTIMEZONE']['TZID'])) {
+ $timeZone = $this->cal['VTIMEZONE']['TZID'];
+ } else {
+ $timeZone = $this->defaultTimeZone;
+ }
+
+ // Use default time zone if the calendar's is invalid
+ if (!$this->isValidTimeZoneId($timeZone)) {
+ $timeZone = $this->defaultTimeZone;
+ }
+
+ if ($ignoreUtc && strtoupper($timeZone) === self::TIME_ZONE_UTC) {
+ return null;
+ }
+
+ return $timeZone;
+ }
+
+ /**
+ * Returns an array of arrays with all free/busy events.
+ * Every event is an associative array and each property
+ * is an element it.
+ *
+ * @return array
+ */
+ public function freeBusyEvents()
+ {
+ $array = $this->cal;
+
+ return isset($array['VFREEBUSY']) ? $array['VFREEBUSY'] : '';
+ }
+
+ /**
+ * Returns a boolean value whether the
+ * current calendar has events or not
+ *
+ * @return boolean
+ */
+ public function hasEvents()
+ {
+ return (count($this->events()) > 0) ?: false;
+ }
+
+ /**
+ * Returns a sorted array of the events in a given range,
+ * or an empty array if no events exist in the range.
+ *
+ * Events will be returned if the start or end date is contained within the
+ * range (inclusive), or if the event starts before and end after the range.
+ *
+ * If a start date is not specified or of a valid format, then the start
+ * of the range will default to the current time and date of the server.
+ *
+ * If an end date is not specified or of a valid format, then the end of
+ * the range will default to the current time and date of the server,
+ * plus 20 years.
+ *
+ * Note that this function makes use of Unix timestamps. This might be a
+ * problem for events on, during, or after 29 Jan 2038.
+ * See https://en.wikipedia.org/wiki/Unix_time#Representing_the_number
+ *
+ * @param string $rangeStart Start date of the search range.
+ * @param string $rangeEnd End date of the search range.
+ * @return array
+ * @throws Exception
+ */
+ public function eventsFromRange($rangeStart = false, $rangeEnd = false)
+ {
+ // Sort events before processing range
+ $events = $this->sortEventsWithOrder($this->events(), SORT_ASC);
+
+ if (empty($events)) {
+ return array();
+ }
+
+ $extendedEvents = array();
+
+ if ($rangeStart) {
+ try {
+ $rangeStart = new \DateTime($rangeStart, new \DateTimeZone($this->defaultTimeZone));
+ } catch (\Exception $e) {
+ error_log("ICal::eventsFromRange: Invalid date passed ({$rangeStart})");
+ $rangeStart = false;
+ }
+ } else {
+ $rangeStart = new \DateTime('now', new \DateTimeZone($this->defaultTimeZone));
+ }
+
+ if ($rangeEnd) {
+ try {
+ $rangeEnd = new \DateTime($rangeEnd, new \DateTimeZone($this->defaultTimeZone));
+ } catch (\Exception $e) {
+ error_log("ICal::eventsFromRange: Invalid date passed ({$rangeEnd})");
+ $rangeEnd = false;
+ }
+ } else {
+ $rangeEnd = new \DateTime('now', new \DateTimeZone($this->defaultTimeZone));
+ $rangeEnd->modify('+20 years');
+ }
+
+ // If start and end are identical and are dates with no times...
+ if ($rangeEnd->format('His') == 0 && $rangeStart->getTimestamp() == $rangeEnd->getTimestamp()) {
+ $rangeEnd->modify('+1 day');
+ }
+
+ $rangeStart = $rangeStart->getTimestamp();
+ $rangeEnd = $rangeEnd->getTimestamp();
+
+ foreach ($events as $anEvent) {
+ $eventStart = $anEvent->dtstart_array[2];
+ $eventEnd = (isset($anEvent->dtend_array[2])) ? $anEvent->dtend_array[2] : null;
+
+ if (($eventStart >= $rangeStart && $eventStart < $rangeEnd) // Event start date contained in the range
+ || ($eventEnd !== null
+ && (
+ ($eventEnd > $rangeStart && $eventEnd <= $rangeEnd) // Event end date contained in the range
+ || ($eventStart < $rangeStart && $eventEnd > $rangeEnd) // Event starts before and finishes after range
+ )
+ )
+ ) {
+ $extendedEvents[] = $anEvent;
+ }
+ }
+
+ if (empty($extendedEvents)) {
+ return array();
+ }
+
+ return $extendedEvents;
+ }
+
+ /**
+ * Returns a sorted array of the events following a given string,
+ * or `false` if no events exist in the range.
+ *
+ * @param string $interval
+ * @return array
+ */
+ public function eventsFromInterval($interval)
+ {
+ $rangeStart = new \DateTime('now', new \DateTimeZone($this->defaultTimeZone));
+ $rangeEnd = new \DateTime('now', new \DateTimeZone($this->defaultTimeZone));
+
+ $dateInterval = \DateInterval::createFromDateString($interval);
+ $rangeEnd->add($dateInterval);
+
+ return $this->eventsFromRange($rangeStart->format('Y-m-d'), $rangeEnd->format('Y-m-d'));
+ }
+
+ /**
+ * Sorts events based on a given sort order
+ *
+ * @param array $events An array of Events
+ * @param integer $sortOrder Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
+ * @return array
+ */
+ public function sortEventsWithOrder(array $events, $sortOrder = SORT_ASC)
+ {
+ $extendedEvents = array();
+ $timestamp = array();
+
+ foreach ($events as $key => $anEvent) {
+ $extendedEvents[] = $anEvent;
+ $timestamp[$key] = $anEvent->dtstart_array[2];
+ }
+
+ array_multisort($timestamp, $sortOrder, $extendedEvents);
+
+ return $extendedEvents;
+ }
+
+ /**
+ * Checks if a time zone is valid
+ *
+ * @param string $timeZone
+ * @return boolean
+ */
+ protected function isValidTimeZoneId($timeZone)
+ {
+ if (in_array($timeZone, $this->validTimeZones)) {
+ return true;
+ }
+ $valid = array();
+ $tza = timezone_abbreviations_list();
+
+ foreach ($tza as $zone) {
+ foreach ($zone as $item) {
+ $valid[$item['timezone_id']] = true;
+ }
+ }
+
+ unset($valid['']);
+
+ if (isset($valid[$timeZone]) || in_array($timeZone, timezone_identifiers_list(\DateTimeZone::ALL_WITH_BC))) {
+ $this->validTimeZones[] = $timeZone;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Parses a duration and applies it to a date
+ *
+ * @param string $date A date to add a duration to
+ * @param string $duration A duration to parse
+ * @param string $format The format to apply to the DateTime object
+ * @return integer|DateTime
+ */
+ protected function parseDuration($date, $duration, $format = self::UNIX_FORMAT)
+ {
+ $dateTime = date_create($date);
+ $dateTime->modify($duration->y . ' year');
+ $dateTime->modify($duration->m . ' month');
+ $dateTime->modify($duration->d . ' day');
+ $dateTime->modify($duration->h . ' hour');
+ $dateTime->modify($duration->i . ' minute');
+ $dateTime->modify($duration->s . ' second');
+
+ if (is_null($format)) {
+ $output = $dateTime;
+ } else {
+ if ($format === self::UNIX_FORMAT) {
+ $output = $dateTime->getTimestamp();
+ } else {
+ $output = $dateTime->format($format);
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Gets the number of days between a start and end date
+ *
+ * @param integer $days
+ * @param integer $start
+ * @param integer $end
+ * @return integer
+ */
+ protected function numberOfDays($days, $start, $end)
+ {
+ $w = array(date('w', $start), date('w', $end));
+ $oneWeek = self::SECONDS_IN_A_WEEK;
+ $x = floor(($end - $start) / $oneWeek);
+ $sum = 0;
+
+ for ($day = 0; $day < 7; ++$day) {
+ if ($days & pow(2, $day)) {
+ $sum += $x + (($w[0] > $w[1]) ? $w[0] <= $day || $day <= $w[1] : $w[0] <= $day && $day <= $w[1]);
+ }
+ }
+
+ return $sum;
+ }
+
+ /**
+ * Converts a negative day ordinal to
+ * its equivalent positive form
+ *
+ * @param integer $dayNumber
+ * @param integer $weekday
+ * @param integer $timestamp
+ * @return string
+ */
+ protected function convertDayOrdinalToPositive($dayNumber, $weekday, $timestamp)
+ {
+ $dayNumber = empty($dayNumber) ? 1 : $dayNumber; // Returns 0 when no number defined in BYDAY
+
+ $dayOrdinals = $this->dayOrdinals;
+
+ // We only care about negative BYDAY values
+ if ($dayNumber >= 1) {
+ return $dayOrdinals[$dayNumber];
+ }
+
+ $timestamp = (is_object($timestamp)) ? $timestamp : \DateTime::createFromFormat(self::UNIX_FORMAT, $timestamp);
+ $start = strtotime('first day of ' . $timestamp->format(self::DATE_TIME_FORMAT_PRETTY));
+ $end = strtotime('last day of ' . $timestamp->format(self::DATE_TIME_FORMAT_PRETTY));
+
+ // Used with pow(2, X) so pow(2, 4) is THURSDAY
+ $weekdays = array_flip(array_keys($this->weekdays));
+
+ $numberOfDays = $this->numberOfDays(pow(2, $weekdays[$weekday]), $start, $end);
+
+ // Create subset
+ $dayOrdinals = array_slice($dayOrdinals, 0, $numberOfDays, true);
+
+ // Reverse only the values
+ $dayOrdinals = array_combine(array_keys($dayOrdinals), array_reverse(array_values($dayOrdinals)));
+
+ return $dayOrdinals[$dayNumber * -1];
+ }
+
+ /**
+ * Removes unprintable ASCII and UTF-8 characters
+ *
+ * @param string $data
+ * @return string
+ */
+ protected function removeUnprintableChars($data)
+ {
+ return preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $data);
+ }
+
+ /**
+ * Provides a polyfill for PHP 7.2's `mb_chr()`, which is a multibyte safe version of `chr()`.
+ * Multibyte safe.
+ *
+ * @param integer $code
+ * @return string
+ */
+ protected function mb_chr($code)
+ {
+ if (function_exists('mb_chr')) {
+ return mb_chr($code);
+ } else {
+ if (0x80 > $code %= 0x200000) {
+ $s = chr($code);
+ } elseif (0x800 > $code) {
+ $s = chr(0xc0 | $code >> 6) . chr(0x80 | $code & 0x3f);
+ } elseif (0x10000 > $code) {
+ $s = chr(0xe0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f);
+ } else {
+ $s = chr(0xf0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3f) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f);
+ }
+
+ return $s;
+ }
+ }
+
+ /**
+ * Replaces all occurrences of a search string with a given replacement string.
+ * Multibyte safe.
+ *
+ * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
+ * @param string|array $replace The replacement value that replaces found search values. An array may be used to designate multiple replacements.
+ * @param string|array $subject The string or array being searched and replaced on, otherwise known as the haystack.
+ * If subject is an array, then the search and replace is performed with every entry of subject, and the return value is an array as well.
+ * @param integer $count If passed, this will be set to the number of replacements performed.
+ * @return array|string
+ */
+ protected function mb_str_replace($search, $replace, $subject, &$count = 0)
+ {
+ if (!is_array($subject)) {
+ // Normalize `$search` and `$replace` so they are both arrays of the same length
+ $searches = is_array($search) ? array_values($search) : array($search);
+ $replacements = is_array($replace) ? array_values($replace) : array($replace);
+ $replacements = array_pad($replacements, count($searches), '');
+
+ foreach ($searches as $key => $search) {
+ $parts = mb_split(preg_quote($search), $subject);
+ $count += count($parts) - 1;
+ $subject = implode($replacements[$key], $parts);
+ }
+ } else {
+ // Call `mb_str_replace` for each subject in array, recursively
+ foreach ($subject as $key => $value) {
+ $subject[$key] = $this->mb_str_replace($search, $replace, $value, $count);
+ }
+ }
+
+ return $subject;
+ }
+
+ /**
+ * Replaces curly quotes and other special characters
+ * with their standard equivalents
+ *
+ * @param string $data
+ * @return string
+ */
+ protected function cleanData($data)
+ {
+ $replacementChars = array(
+ "\xe2\x80\x98" => "'", // â
+ "\xe2\x80\x99" => "'", // â
+ "\xe2\x80\x9a" => "'", // â
+ "\xe2\x80\x9b" => "'", // â
+ "\xe2\x80\x9c" => '"', // â
+ "\xe2\x80\x9d" => '"', // â
+ "\xe2\x80\x9e" => '"', // â
+ "\xe2\x80\x9f" => '"', // â
+ "\xe2\x80\x93" => '-', // â
+ "\xe2\x80\x94" => '--', // â
+ "\xe2\x80\xa6" => '...', // â¦
+ "\xc2\xa0" => ' ',
+ );
+ // Replace UTF-8 characters
+ $cleanedData = strtr($data, $replacementChars);
+
+ // Replace Windows-1252 equivalents
+ $charsToReplace = array_map(function ($code) {
+ return $this->mb_chr($code);
+ }, array(133, 145, 146, 147, 148, 150, 151, 194));
+ $cleanedData = $this->mb_str_replace($charsToReplace, $replacementChars, $cleanedData);
+
+ return $cleanedData;
+ }
+
+ /**
+ * Parses a list of excluded dates
+ * to be applied to an Event
+ *
+ * @param array $event
+ * @return array
+ */
+ public function parseExdates(array $event)
+ {
+ if (empty($event['EXDATE_array'])) {
+ return array();
+ } else {
+ $exdates = $event['EXDATE_array'];
+ }
+
+ $output = array();
+ $currentTimeZone = $this->defaultTimeZone;
+
+ foreach ($exdates as $subArray) {
+ end($subArray);
+ $finalKey = key($subArray);
+
+ foreach ($subArray as $key => $value) {
+ if ($key === 'TZID') {
+ $currentTimeZone = $subArray[$key];
+ } elseif (is_numeric($key)) {
+ $icalDate = $subArray[$key];
+
+ if (substr($icalDate, -1) === 'Z') {
+ $currentTimeZone = self::TIME_ZONE_UTC;
+ }
+
+ $output[] = new Carbon($icalDate, $currentTimeZone);
+
+ if ($key === $finalKey) {
+ // Reset to default
+ $currentTimeZone = $this->defaultTimeZone;
+ }
+ }
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Checks if a date string is a valid date
+ *
+ * @param string $value
+ * @return boolean
+ * @throws Exception
+ */
+ public function isValidDate($value)
+ {
+ if (!$value) {
+ return false;
+ }
+
+ try {
+ new \DateTime($value);
+
+ return true;
+ } catch (\Exception $e) {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if a filename exists as a file or URL
+ *
+ * @param string $filename
+ * @return boolean
+ */
+ protected function isFileOrUrl($filename)
+ {
+ return (file_exists($filename) || filter_var($filename, FILTER_VALIDATE_URL)) ?: false;
+ }
+
+ /**
+ * Reads an entire file or URL into an array
+ *
+ * @param string $filename
+ * @return array
+ * @throws Exception
+ */
+ protected function fileOrUrl($filename)
+ {
+ if (!$lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)) {
+ throw new \Exception("The file path or URL '{$filename}' does not exist.");
+ }
+
+ return $lines;
+ }
+
+ /**
+ * Ensures the recurrence count is enforced against generated recurrence events.
+ *
+ * @param array $rrules
+ * @param array $recurrenceEvents
+ * @return array
+ */
+ protected function trimToRecurrenceCount(array $rrules, array $recurrenceEvents)
+ {
+ if (isset($rrules['COUNT'])) {
+ $recurrenceCount = (intval($rrules['COUNT']) - 1);
+ $surplusCount = (sizeof($recurrenceEvents) - $recurrenceCount);
+
+ if ($surplusCount > 0) {
+ $recurrenceEvents = array_slice($recurrenceEvents, 0, $recurrenceCount);
+ $this->eventCount -= $surplusCount;
+ }
+ }
+
+ return $recurrenceEvents;
+ }
+
+ /**
+ * Checks if an excluded date matches a given date by reconciling time zones.
+ *
+ * @param integer $exdate
+ * @param array $anEvent
+ * @param integer $recurringOffset
+ * @return boolean
+ */
+ protected function isExdateMatch($exdate, array $anEvent, $recurringOffset)
+ {
+ $searchDate = $anEvent['DTSTART'];
+
+ if (substr($searchDate, -1) === 'Z') {
+ $timeZone = self::TIME_ZONE_UTC;
+ } elseif (isset($anEvent['DTSTART_array'][0]['TZID'])) {
+ $timeZone = $anEvent['DTSTART_array'][0]['TZID'];
+ } else {
+ $timeZone = $this->defaultTimeZone;
+ }
+
+ $a = new Carbon($searchDate, $timeZone);
+ $b = $exdate->addSeconds($recurringOffset);
+
+ return $a->eq($b);
+ }
+}
\ No newline at end of file
diff --git a/vendor/autoload.php b/vendor/autoload.php
new file mode 100644
index 0000000..4cf514d
--- /dev/null
+++ b/vendor/autoload.php
@@ -0,0 +1,7 @@
+
+ * Jordi Boggiano
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Composer\Autoload;
+
+/**
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
+ *
+ * $loader = new \Composer\Autoload\ClassLoader();
+ *
+ * // register classes with namespaces
+ * $loader->add('Symfony\Component', __DIR__.'/component');
+ * $loader->add('Symfony', __DIR__.'/framework');
+ *
+ * // activate the autoloader
+ * $loader->register();
+ *
+ * // to enable searching the include path (eg. for PEAR packages)
+ * $loader->setUseIncludePath(true);
+ *
+ * In this example, if you try to use a class in the Symfony\Component
+ * namespace or one of its children (Symfony\Component\Console for instance),
+ * the autoloader will first look for the class under the component/
+ * directory, and it will then fallback to the framework/ directory if not
+ * found before giving up.
+ *
+ * This class is loosely based on the Symfony UniversalClassLoader.
+ *
+ * @author Fabien Potencier
+ * @author Jordi Boggiano
+ * @see http://www.php-fig.org/psr/psr-0/
+ * @see http://www.php-fig.org/psr/psr-4/
+ */
+class ClassLoader
+{
+ // PSR-4
+ private $prefixLengthsPsr4 = array();
+ private $prefixDirsPsr4 = array();
+ private $fallbackDirsPsr4 = array();
+
+ // PSR-0
+ private $prefixesPsr0 = array();
+ private $fallbackDirsPsr0 = array();
+
+ private $useIncludePath = false;
+ private $classMap = array();
+
+ private $classMapAuthoritative = false;
+
+ public function getPrefixes()
+ {
+ if (!empty($this->prefixesPsr0)) {
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
+ }
+
+ return array();
+ }
+
+ public function getPrefixesPsr4()
+ {
+ return $this->prefixDirsPsr4;
+ }
+
+ public function getFallbackDirs()
+ {
+ return $this->fallbackDirsPsr0;
+ }
+
+ public function getFallbackDirsPsr4()
+ {
+ return $this->fallbackDirsPsr4;
+ }
+
+ public function getClassMap()
+ {
+ return $this->classMap;
+ }
+
+ /**
+ * @param array $classMap Class to filename map
+ */
+ public function addClassMap(array $classMap)
+ {
+ if ($this->classMap) {
+ $this->classMap = array_merge($this->classMap, $classMap);
+ } else {
+ $this->classMap = $classMap;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix, either
+ * appending or prepending to the ones previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 root directories
+ * @param bool $prepend Whether to prepend the directories
+ */
+ public function add($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ if ($prepend) {
+ $this->fallbackDirsPsr0 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr0
+ );
+ } else {
+ $this->fallbackDirsPsr0 = array_merge(
+ $this->fallbackDirsPsr0,
+ (array) $paths
+ );
+ }
+
+ return;
+ }
+
+ $first = $prefix[0];
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
+
+ return;
+ }
+ if ($prepend) {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixesPsr0[$first][$prefix]
+ );
+ } else {
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
+ $this->prefixesPsr0[$first][$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace, either
+ * appending or prepending to the ones previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ * @param bool $prepend Whether to prepend the directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function addPsr4($prefix, $paths, $prepend = false)
+ {
+ if (!$prefix) {
+ // Register directories for the root namespace.
+ if ($prepend) {
+ $this->fallbackDirsPsr4 = array_merge(
+ (array) $paths,
+ $this->fallbackDirsPsr4
+ );
+ } else {
+ $this->fallbackDirsPsr4 = array_merge(
+ $this->fallbackDirsPsr4,
+ (array) $paths
+ );
+ }
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
+ // Register directories for a new namespace.
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ } elseif ($prepend) {
+ // Prepend directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ (array) $paths,
+ $this->prefixDirsPsr4[$prefix]
+ );
+ } else {
+ // Append directories for an already registered namespace.
+ $this->prefixDirsPsr4[$prefix] = array_merge(
+ $this->prefixDirsPsr4[$prefix],
+ (array) $paths
+ );
+ }
+ }
+
+ /**
+ * Registers a set of PSR-0 directories for a given prefix,
+ * replacing any others previously set for this prefix.
+ *
+ * @param string $prefix The prefix
+ * @param array|string $paths The PSR-0 base directories
+ */
+ public function set($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr0 = (array) $paths;
+ } else {
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Registers a set of PSR-4 directories for a given namespace,
+ * replacing any others previously set for this namespace.
+ *
+ * @param string $prefix The prefix/namespace, with trailing '\\'
+ * @param array|string $paths The PSR-4 base directories
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function setPsr4($prefix, $paths)
+ {
+ if (!$prefix) {
+ $this->fallbackDirsPsr4 = (array) $paths;
+ } else {
+ $length = strlen($prefix);
+ if ('\\' !== $prefix[$length - 1]) {
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
+ }
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
+ }
+ }
+
+ /**
+ * Turns on searching the include path for class files.
+ *
+ * @param bool $useIncludePath
+ */
+ public function setUseIncludePath($useIncludePath)
+ {
+ $this->useIncludePath = $useIncludePath;
+ }
+
+ /**
+ * Can be used to check if the autoloader uses the include path to check
+ * for classes.
+ *
+ * @return bool
+ */
+ public function getUseIncludePath()
+ {
+ return $this->useIncludePath;
+ }
+
+ /**
+ * Turns off searching the prefix and fallback directories for classes
+ * that have not been registered with the class map.
+ *
+ * @param bool $classMapAuthoritative
+ */
+ public function setClassMapAuthoritative($classMapAuthoritative)
+ {
+ $this->classMapAuthoritative = $classMapAuthoritative;
+ }
+
+ /**
+ * Should class lookup fail if not found in the current class map?
+ *
+ * @return bool
+ */
+ public function isClassMapAuthoritative()
+ {
+ return $this->classMapAuthoritative;
+ }
+
+ /**
+ * Registers this instance as an autoloader.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not
+ */
+ public function register($prepend = false)
+ {
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
+ }
+
+ /**
+ * Unregisters this instance as an autoloader.
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $class The name of the class
+ * @return bool|null True if loaded, null otherwise
+ */
+ public function loadClass($class)
+ {
+ if ($file = $this->findFile($class)) {
+ includeFile($file);
+
+ return true;
+ }
+ }
+
+ /**
+ * Finds the path to the file where the class is defined.
+ *
+ * @param string $class The name of the class
+ *
+ * @return string|false The path if found, false otherwise
+ */
+ public function findFile($class)
+ {
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
+ if ('\\' == $class[0]) {
+ $class = substr($class, 1);
+ }
+
+ // class map lookup
+ if (isset($this->classMap[$class])) {
+ return $this->classMap[$class];
+ }
+ if ($this->classMapAuthoritative) {
+ return false;
+ }
+
+ $file = $this->findFileWithExtension($class, '.php');
+
+ // Search for Hack files if we are running on HHVM
+ if ($file === null && defined('HHVM_VERSION')) {
+ $file = $this->findFileWithExtension($class, '.hh');
+ }
+
+ if ($file === null) {
+ // Remember that this class does not exist.
+ return $this->classMap[$class] = false;
+ }
+
+ return $file;
+ }
+
+ private function findFileWithExtension($class, $ext)
+ {
+ // PSR-4 lookup
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
+
+ $first = $class[0];
+ if (isset($this->prefixLengthsPsr4[$first])) {
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-4 fallback dirs
+ foreach ($this->fallbackDirsPsr4 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 lookup
+ if (false !== $pos = strrpos($class, '\\')) {
+ // namespaced class name
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
+ } else {
+ // PEAR-like class name
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
+ }
+
+ if (isset($this->prefixesPsr0[$first])) {
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
+ if (0 === strpos($class, $prefix)) {
+ foreach ($dirs as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+ }
+ }
+ }
+
+ // PSR-0 fallback dirs
+ foreach ($this->fallbackDirsPsr0 as $dir) {
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
+ return $file;
+ }
+ }
+
+ // PSR-0 include paths.
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
+ return $file;
+ }
+ }
+}
+
+/**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ */
+function includeFile($file)
+{
+ include $file;
+}
diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE
new file mode 100644
index 0000000..c8d57af
--- /dev/null
+++ b/vendor/composer/LICENSE
@@ -0,0 +1,21 @@
+
+Copyright (c) 2015 Nils Adermann, Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
new file mode 100644
index 0000000..7a91153
--- /dev/null
+++ b/vendor/composer/autoload_classmap.php
@@ -0,0 +1,9 @@
+ $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
+);
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
new file mode 100644
index 0000000..8a78e71
--- /dev/null
+++ b/vendor/composer/autoload_namespaces.php
@@ -0,0 +1,10 @@
+ array($baseDir . '/src'),
+);
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
new file mode 100644
index 0000000..498ba34
--- /dev/null
+++ b/vendor/composer/autoload_psr4.php
@@ -0,0 +1,12 @@
+ array($vendorDir . '/symfony/polyfill-mbstring'),
+ 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
+ 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
+);
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
new file mode 100644
index 0000000..3a4f32b
--- /dev/null
+++ b/vendor/composer/autoload_real.php
@@ -0,0 +1,59 @@
+ $path) {
+ $loader->set($namespace, $path);
+ }
+
+ $map = require __DIR__ . '/autoload_psr4.php';
+ foreach ($map as $namespace => $path) {
+ $loader->setPsr4($namespace, $path);
+ }
+
+ $classMap = require __DIR__ . '/autoload_classmap.php';
+ if ($classMap) {
+ $loader->addClassMap($classMap);
+ }
+
+ $loader->register(true);
+
+ $includeFiles = require __DIR__ . '/autoload_files.php';
+ foreach ($includeFiles as $fileIdentifier => $file) {
+ composerRequire6eb1bc205140b4de7b5f98e4a67572a4($fileIdentifier, $file);
+ }
+
+ return $loader;
+ }
+}
+
+function composerRequire6eb1bc205140b4de7b5f98e4a67572a4($fileIdentifier, $file)
+{
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
+ require $file;
+
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+ }
+}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
new file mode 100644
index 0000000..aac5bf1
--- /dev/null
+++ b/vendor/composer/installed.json
@@ -0,0 +1,238 @@
+[
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.6.0",
+ "version_normalized": "1.6.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
+ "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "time": "2017-10-11 12:05:26",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ]
+ },
+ {
+ "name": "symfony/translation",
+ "version": "v3.3.10",
+ "version_normalized": "3.3.10.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/translation.git",
+ "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
+ "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.5.9|>=7.0.8",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "conflict": {
+ "symfony/config": "<2.8",
+ "symfony/yaml": "<3.3"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/intl": "^2.8.18|^3.2.5",
+ "symfony/yaml": "~3.3"
+ },
+ "suggest": {
+ "psr/log": "To use logging capability in translator",
+ "symfony/config": "",
+ "symfony/yaml": ""
+ },
+ "time": "2017-10-02 06:42:24",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.3-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Translation\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Translation Component",
+ "homepage": "https://symfony.com"
+ },
+ {
+ "name": "nesbot/carbon",
+ "version": "1.22.1",
+ "version_normalized": "1.22.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/briannesbitt/Carbon.git",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/translation": "~2.6 || ~3.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "~2",
+ "phpunit/phpunit": "~4.0 || ~5.0"
+ },
+ "time": "2017-01-16 07:55:07",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.23-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Carbon\\": "src/Carbon/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Brian Nesbitt",
+ "email": "brian@nesbot.com",
+ "homepage": "http://nesbot.com"
+ }
+ ],
+ "description": "A simple API extension for DateTime.",
+ "homepage": "http://carbon.nesbot.com",
+ "keywords": [
+ "date",
+ "datetime",
+ "time"
+ ]
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "3.1.1",
+ "version_normalized": "3.1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d667e245d5dcd4d7bf80f26f2c947d476b66213e",
+ "reference": "d667e245d5dcd4d7bf80f26f2c947d476b66213e",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
+ },
+ "time": "2017-10-16 22:40:25",
+ "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": "http://www.squizlabs.com/php-codesniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ]
+ }
+]
diff --git a/vendor/nesbot/carbon/.php_cs.dist b/vendor/nesbot/carbon/.php_cs.dist
new file mode 100644
index 0000000..ff8b56f
--- /dev/null
+++ b/vendor/nesbot/carbon/.php_cs.dist
@@ -0,0 +1,57 @@
+ true,
+ 'array_syntax' => [
+ 'syntax' => 'long',
+ ],
+ 'binary_operator_spaces' => [
+ 'align_double_arrow' => false,
+ 'align_equals' => false,
+ ],
+ 'blank_line_before_return' => true,
+ 'cast_spaces' => true,
+ 'concat_space' => [
+ 'spacing' => 'none',
+ ],
+ 'ereg_to_preg' => true,
+ 'method_separation' => true,
+ 'no_blank_lines_after_phpdoc' => true,
+ 'no_extra_consecutive_blank_lines' => true,
+ 'no_short_bool_cast' => true,
+ 'no_unneeded_control_parentheses' => true,
+ 'no_unused_imports' => true,
+ 'no_whitespace_in_blank_line' => true,
+ 'ordered_imports' => true,
+ 'phpdoc_align' => true,
+ 'phpdoc_indent' => true,
+ 'phpdoc_inline_tag' => true,
+ 'phpdoc_no_access' => true,
+ 'phpdoc_no_alias_tag' => [
+ 'type' => 'var',
+ ],
+ 'phpdoc_no_package' => true,
+ 'phpdoc_order' => true,
+ 'phpdoc_scalar' => true,
+ 'phpdoc_separation' => true,
+ 'phpdoc_to_comment' => true,
+ 'phpdoc_trim' => true,
+ 'phpdoc_types' => true,
+ 'phpdoc_var_without_name' => true,
+ 'self_accessor' => true,
+ 'single_quote' => true,
+ 'space_after_semicolon' => true,
+ 'standardize_not_equals' => true,
+ 'ternary_operator_spaces' => true,
+ 'trailing_comma_in_multiline_array' => true,
+ 'trim_array_spaces' => true,
+ 'unary_operator_spaces' => true,
+];
+
+return Config::create()->setRules($rules)
+ ->setFinder(Finder::create()->in(__DIR__))
+ ->setUsingCache(true)
+ ->setRiskyAllowed(true);
\ No newline at end of file
diff --git a/vendor/nesbot/carbon/LICENSE b/vendor/nesbot/carbon/LICENSE
new file mode 100644
index 0000000..6de45eb
--- /dev/null
+++ b/vendor/nesbot/carbon/LICENSE
@@ -0,0 +1,19 @@
+Copyright (C) Brian Nesbitt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/nesbot/carbon/composer.json b/vendor/nesbot/carbon/composer.json
new file mode 100644
index 0000000..63d576d
--- /dev/null
+++ b/vendor/nesbot/carbon/composer.json
@@ -0,0 +1,54 @@
+{
+ "name": "nesbot/carbon",
+ "type": "library",
+ "description": "A simple API extension for DateTime.",
+ "keywords": [
+ "date",
+ "time",
+ "DateTime"
+ ],
+ "homepage": "http://carbon.nesbot.com",
+ "support": {
+ "issues": "https://github.com/briannesbitt/Carbon/issues",
+ "source": "https://github.com/briannesbitt/Carbon"
+ },
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Brian Nesbitt",
+ "email": "brian@nesbot.com",
+ "homepage": "http://nesbot.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/translation": "~2.6 || ~3.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "~2",
+ "phpunit/phpunit": "~4.0 || ~5.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Carbon\\": "src/Carbon/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\": "tests/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.23-dev"
+ }
+ },
+ "config": {
+ "sort-packages": true
+ },
+ "scripts": {
+ "test": "./vendor/bin/phpunit; ./vendor/bin/php-cs-fixer fix -v --diff --dry-run;",
+ "phpunit": "./vendor/bin/phpunit;",
+ "phpcs": "./vendor/bin/php-cs-fixer fix -v --diff --dry-run;"
+ }
+}
diff --git a/vendor/nesbot/carbon/readme.md b/vendor/nesbot/carbon/readme.md
new file mode 100644
index 0000000..57836c3
--- /dev/null
+++ b/vendor/nesbot/carbon/readme.md
@@ -0,0 +1,92 @@
+# Carbon
+
+[](https://packagist.org/packages/nesbot/carbon)
+[](https://packagist.org/packages/nesbot/carbon)
+[](https://travis-ci.org/briannesbitt/Carbon)
+[](https://styleci.io/repos/5724990)
+[](https://codecov.io/github/briannesbitt/Carbon?branch=master)
+[](https://php-eye.com/package/nesbot/carbon)
+
+A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com)
+
+```php
+use Carbon\Carbon;
+
+printf("Right now is %s", Carbon::now()->toDateTimeString());
+printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString()
+$tomorrow = Carbon::now()->addDay();
+$lastWeek = Carbon::now()->subWeek();
+$nextSummerOlympics = Carbon::createFromDate(2012)->addYears(4);
+
+$officialDate = Carbon::now()->toRfc2822String();
+
+$howOldAmI = Carbon::createFromDate(1975, 5, 21)->age;
+
+$noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London');
+
+$worldWillEnd = Carbon::createFromDate(2012, 12, 21, 'GMT');
+
+// Don't really want to die so mock now
+Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1));
+
+// comparisons are always done in UTC
+if (Carbon::now()->gte($worldWillEnd)) {
+ die();
+}
+
+// Phew! Return to normal behaviour
+Carbon::setTestNow();
+
+if (Carbon::now()->isWeekend()) {
+ echo 'Party!';
+}
+echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago'
+
+// ... but also does 'from now', 'after' and 'before'
+// rolling up to seconds, minutes, hours, days, months, years
+
+$daysSinceEpoch = Carbon::createFromTimestamp(0)->diffInDays();
+```
+
+## Installation
+
+### With Composer
+
+```
+$ composer require nesbot/carbon
+```
+
+```json
+{
+ "require": {
+ "nesbot/carbon": "~1.21"
+ }
+}
+```
+
+```php
+
+### Without Composer
+
+Why are you not using [composer](http://getcomposer.org/)? Download [Carbon.php](https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Carbon.php) from the repo and save the file into your project path somewhere.
+
+```php
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Carbon;
+
+use Carbon\Exceptions\InvalidDateException;
+use Closure;
+use DatePeriod;
+use DateTime;
+use DateTimeZone;
+use InvalidArgumentException;
+use Symfony\Component\Translation\Loader\ArrayLoader;
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\TranslatorInterface;
+
+/**
+ * A simple API extension for DateTime
+ *
+ * @property int $year
+ * @property int $yearIso
+ * @property int $month
+ * @property int $day
+ * @property int $hour
+ * @property int $minute
+ * @property int $second
+ * @property int $timestamp seconds since the Unix Epoch
+ * @property \DateTimeZone $timezone the current timezone
+ * @property \DateTimeZone $tz alias of timezone
+ * @property-read int $micro
+ * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday)
+ * @property-read int $dayOfYear 0 through 365
+ * @property-read int $weekOfMonth 1 through 5
+ * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday
+ * @property-read int $daysInMonth number of days in the given month
+ * @property-read int $age does a diffInYears() with default parameters
+ * @property-read int $quarter the quarter of this instance, 1 - 4
+ * @property-read int $offset the timezone offset in seconds from UTC
+ * @property-read int $offsetHours the timezone offset in hours from UTC
+ * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise
+ * @property-read bool $local checks if the timezone is local, true if local, false otherwise
+ * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise
+ * @property-read string $timezoneName
+ * @property-read string $tzName
+ */
+class Carbon extends DateTime
+{
+ /**
+ * The day constants.
+ */
+ const SUNDAY = 0;
+ const MONDAY = 1;
+ const TUESDAY = 2;
+ const WEDNESDAY = 3;
+ const THURSDAY = 4;
+ const FRIDAY = 5;
+ const SATURDAY = 6;
+
+ /**
+ * Names of days of the week.
+ *
+ * @var array
+ */
+ protected static $days = array(
+ self::SUNDAY => 'Sunday',
+ self::MONDAY => 'Monday',
+ self::TUESDAY => 'Tuesday',
+ self::WEDNESDAY => 'Wednesday',
+ self::THURSDAY => 'Thursday',
+ self::FRIDAY => 'Friday',
+ self::SATURDAY => 'Saturday',
+ );
+
+ /**
+ * Terms used to detect if a time passed is a relative date.
+ *
+ * This is here for testing purposes.
+ *
+ * @var array
+ */
+ protected static $relativeKeywords = array(
+ '+',
+ '-',
+ 'ago',
+ 'first',
+ 'last',
+ 'next',
+ 'this',
+ 'today',
+ 'tomorrow',
+ 'yesterday',
+ );
+
+ /**
+ * Number of X in Y.
+ */
+ const YEARS_PER_CENTURY = 100;
+ const YEARS_PER_DECADE = 10;
+ const MONTHS_PER_YEAR = 12;
+ const MONTHS_PER_QUARTER = 3;
+ const WEEKS_PER_YEAR = 52;
+ const DAYS_PER_WEEK = 7;
+ const HOURS_PER_DAY = 24;
+ const MINUTES_PER_HOUR = 60;
+ const SECONDS_PER_MINUTE = 60;
+
+ /**
+ * Default format to use for __toString method when type juggling occurs.
+ *
+ * @var string
+ */
+ const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s';
+
+ /**
+ * Format to use for __toString method when type juggling occurs.
+ *
+ * @var string
+ */
+ protected static $toStringFormat = self::DEFAULT_TO_STRING_FORMAT;
+
+ /**
+ * First day of week.
+ *
+ * @var int
+ */
+ protected static $weekStartsAt = self::MONDAY;
+
+ /**
+ * Last day of week.
+ *
+ * @var int
+ */
+ protected static $weekEndsAt = self::SUNDAY;
+
+ /**
+ * Days of weekend.
+ *
+ * @var array
+ */
+ protected static $weekendDays = array(
+ self::SATURDAY,
+ self::SUNDAY,
+ );
+
+ /**
+ * A test Carbon instance to be returned when now instances are created.
+ *
+ * @var \Carbon\Carbon
+ */
+ protected static $testNow;
+
+ /**
+ * A translator to ... er ... translate stuff.
+ *
+ * @var \Symfony\Component\Translation\TranslatorInterface
+ */
+ protected static $translator;
+
+ /**
+ * The errors that can occur.
+ *
+ * @var array
+ */
+ protected static $lastErrors;
+
+ /**
+ * Will UTF8 encoding be used to print localized date/time ?
+ *
+ * @var bool
+ */
+ protected static $utf8 = false;
+
+ /*
+ * Indicates if months should be calculated with overflow.
+ *
+ * @var bool
+ */
+ protected static $monthsOverflow = true;
+
+ /**
+ * Indicates if months should be calculated with overflow.
+ *
+ * @param bool $monthsOverflow
+ *
+ * @return void
+ */
+ public static function useMonthsOverflow($monthsOverflow = true)
+ {
+ static::$monthsOverflow = $monthsOverflow;
+ }
+
+ /**
+ * Reset the month overflow behavior.
+ *
+ * @return void
+ */
+ public static function resetMonthsOverflow()
+ {
+ static::$monthsOverflow = true;
+ }
+
+ /**
+ * Get the month overflow behavior.
+ *
+ * @return bool
+ */
+ public static function shouldOverflowMonths()
+ {
+ return static::$monthsOverflow;
+ }
+
+ /**
+ * Creates a DateTimeZone from a string, DateTimeZone or integer offset.
+ *
+ * @param \DateTimeZone|string|int|null $object
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return \DateTimeZone
+ */
+ protected static function safeCreateDateTimeZone($object)
+ {
+ if ($object === null) {
+ // Don't return null... avoid Bug #52063 in PHP <5.3.6
+ return new DateTimeZone(date_default_timezone_get());
+ }
+
+ if ($object instanceof DateTimeZone) {
+ return $object;
+ }
+
+ if (is_numeric($object)) {
+ $tzName = timezone_name_from_abbr(null, $object * 3600, true);
+
+ if ($tzName === false) {
+ throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')');
+ }
+
+ $object = $tzName;
+ }
+
+ $tz = @timezone_open((string) $object);
+
+ if ($tz === false) {
+ throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')');
+ }
+
+ return $tz;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //////////////////////////// CONSTRUCTORS /////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Create a new Carbon instance.
+ *
+ * Please see the testing aids section (specifically static::setTestNow())
+ * for more on the possibility of this constructor returning a test instance.
+ *
+ * @param string|null $time
+ * @param \DateTimeZone|string|null $tz
+ */
+ public function __construct($time = null, $tz = null)
+ {
+ // If the class has a test now set and we are trying to create a now()
+ // instance then override as required
+ if (static::hasTestNow() && (empty($time) || $time === 'now' || static::hasRelativeKeywords($time))) {
+ $testInstance = clone static::getTestNow();
+ if (static::hasRelativeKeywords($time)) {
+ $testInstance->modify($time);
+ }
+
+ //shift the time according to the given time zone
+ if ($tz !== null && $tz !== static::getTestNow()->getTimezone()) {
+ $testInstance->setTimezone($tz);
+ } else {
+ $tz = $testInstance->getTimezone();
+ }
+
+ $time = $testInstance->toDateTimeString();
+ }
+
+ parent::__construct($time, static::safeCreateDateTimeZone($tz));
+ }
+
+ /**
+ * Create a Carbon instance from a DateTime one.
+ *
+ * @param \DateTime $dt
+ *
+ * @return static
+ */
+ public static function instance(DateTime $dt)
+ {
+ if ($dt instanceof static) {
+ return clone $dt;
+ }
+
+ return new static($dt->format('Y-m-d H:i:s.u'), $dt->getTimezone());
+ }
+
+ /**
+ * Create a carbon instance from a string.
+ *
+ * This is an alias for the constructor that allows better fluent syntax
+ * as it allows you to do Carbon::parse('Monday next week')->fn() rather
+ * than (new Carbon('Monday next week'))->fn().
+ *
+ * @param string|null $time
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function parse($time = null, $tz = null)
+ {
+ return new static($time, $tz);
+ }
+
+ /**
+ * Get a Carbon instance for the current date and time.
+ *
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function now($tz = null)
+ {
+ return new static(null, $tz);
+ }
+
+ /**
+ * Create a Carbon instance for today.
+ *
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function today($tz = null)
+ {
+ return static::now($tz)->startOfDay();
+ }
+
+ /**
+ * Create a Carbon instance for tomorrow.
+ *
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function tomorrow($tz = null)
+ {
+ return static::today($tz)->addDay();
+ }
+
+ /**
+ * Create a Carbon instance for yesterday.
+ *
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function yesterday($tz = null)
+ {
+ return static::today($tz)->subDay();
+ }
+
+ /**
+ * Create a Carbon instance for the greatest supported date.
+ *
+ * @return static
+ */
+ public static function maxValue()
+ {
+ if (PHP_INT_SIZE === 4) {
+ // 32 bit (and additionally Windows 64 bit)
+ return static::createFromTimestamp(PHP_INT_MAX);
+ }
+
+ // 64 bit
+ return static::create(9999, 12, 31, 23, 59, 59);
+ }
+
+ /**
+ * Create a Carbon instance for the lowest supported date.
+ *
+ * @return static
+ */
+ public static function minValue()
+ {
+ if (PHP_INT_SIZE === 4) {
+ // 32 bit (and additionally Windows 64 bit)
+ return static::createFromTimestamp(~PHP_INT_MAX);
+ }
+
+ // 64 bit
+ return static::create(1, 1, 1, 0, 0, 0);
+ }
+
+ /**
+ * Create a new Carbon instance from a specific date and time.
+ *
+ * If any of $year, $month or $day are set to null their now() values will
+ * be used.
+ *
+ * If $hour is null it will be set to its now() value and the default
+ * values for $minute and $second will be their now() values.
+ *
+ * If $hour is not null then the default values for $minute and $second
+ * will be 0.
+ *
+ * @param int|null $year
+ * @param int|null $month
+ * @param int|null $day
+ * @param int|null $hour
+ * @param int|null $minute
+ * @param int|null $second
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function create($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)
+ {
+ $now = static::hasTestNow() ? static::getTestNow()->getTimestamp() : time();
+
+ $defaults = array_combine(array(
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second',
+ ), explode('-', date('Y-n-j-G-i-s', $now)));
+
+ $year = $year === null ? $defaults['year'] : $year;
+ $month = $month === null ? $defaults['month'] : $month;
+ $day = $day === null ? $defaults['day'] : $day;
+
+ if ($hour === null) {
+ $hour = $defaults['hour'];
+ $minute = $minute === null ? $defaults['minute'] : $minute;
+ $second = $second === null ? $defaults['second'] : $second;
+ } else {
+ $minute = $minute === null ? 0 : $minute;
+ $second = $second === null ? 0 : $second;
+ }
+
+ $fixYear = null;
+
+ if ($year < 0) {
+ $fixYear = $year;
+ $year = 0;
+ } elseif ($year > 9999) {
+ $fixYear = $year - 9999;
+ $year = 9999;
+ }
+
+ $instance = static::createFromFormat('Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz);
+
+ if ($fixYear !== null) {
+ $instance->addYears($fixYear);
+ }
+
+ return $instance;
+ }
+
+ /**
+ * Create a new safe Carbon instance from a specific date and time.
+ *
+ * If any of $year, $month or $day are set to null their now() values will
+ * be used.
+ *
+ * If $hour is null it will be set to its now() value and the default
+ * values for $minute and $second will be their now() values.
+ *
+ * If $hour is not null then the default values for $minute and $second
+ * will be 0.
+ *
+ * If one of the set values is not valid, an \InvalidArgumentException
+ * will be thrown.
+ *
+ * @param int|null $year
+ * @param int|null $month
+ * @param int|null $day
+ * @param int|null $hour
+ * @param int|null $minute
+ * @param int|null $second
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @throws \Carbon\Exceptions\InvalidDateException
+ *
+ * @return static
+ */
+ public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)
+ {
+ $fields = array(
+ 'year' => array(0, 9999),
+ 'month' => array(0, 12),
+ 'day' => array(0, 31),
+ 'hour' => array(0, 24),
+ 'minute' => array(0, 59),
+ 'second' => array(0, 59),
+ );
+
+ foreach ($fields as $field => $range) {
+ if ($$field !== null && (!is_int($$field) || $$field < $range[0] || $$field > $range[1])) {
+ throw new InvalidDateException($field, $$field);
+ }
+ }
+
+ $instance = static::create($year, $month, 1, $hour, $minute, $second, $tz);
+
+ if ($day !== null && $day > $instance->daysInMonth) {
+ throw new InvalidDateException('day', $day);
+ }
+
+ return $instance->day($day);
+ }
+
+ /**
+ * Create a Carbon instance from just a date. The time portion is set to now.
+ *
+ * @param int|null $year
+ * @param int|null $month
+ * @param int|null $day
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function createFromDate($year = null, $month = null, $day = null, $tz = null)
+ {
+ return static::create($year, $month, $day, null, null, null, $tz);
+ }
+
+ /**
+ * Create a Carbon instance from just a time. The date portion is set to today.
+ *
+ * @param int|null $hour
+ * @param int|null $minute
+ * @param int|null $second
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function createFromTime($hour = null, $minute = null, $second = null, $tz = null)
+ {
+ return static::create(null, null, null, $hour, $minute, $second, $tz);
+ }
+
+ /**
+ * Create a Carbon instance from a specific format.
+ *
+ * @param string $format
+ * @param string $time
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return static
+ */
+ public static function createFromFormat($format, $time, $tz = null)
+ {
+ if ($tz !== null) {
+ $dt = parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz));
+ } else {
+ $dt = parent::createFromFormat($format, $time);
+ }
+
+ static::setLastErrors($lastErrors = parent::getLastErrors());
+
+ if ($dt instanceof DateTime) {
+ return static::instance($dt);
+ }
+
+ throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors']));
+ }
+
+ /**
+ * Set last errors.
+ *
+ * @param array $lastErrors
+ *
+ * @return void
+ */
+ private static function setLastErrors(array $lastErrors)
+ {
+ static::$lastErrors = $lastErrors;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getLastErrors()
+ {
+ return static::$lastErrors;
+ }
+
+ /**
+ * Create a Carbon instance from a timestamp.
+ *
+ * @param int $timestamp
+ * @param \DateTimeZone|string|null $tz
+ *
+ * @return static
+ */
+ public static function createFromTimestamp($timestamp, $tz = null)
+ {
+ return static::now($tz)->setTimestamp($timestamp);
+ }
+
+ /**
+ * Create a Carbon instance from an UTC timestamp.
+ *
+ * @param int $timestamp
+ *
+ * @return static
+ */
+ public static function createFromTimestampUTC($timestamp)
+ {
+ return new static('@'.$timestamp);
+ }
+
+ /**
+ * Get a copy of the instance.
+ *
+ * @return static
+ */
+ public function copy()
+ {
+ return clone $this;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ ///////////////////////// GETTERS AND SETTERS /////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Get a part of the Carbon object
+ *
+ * @param string $name
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return string|int|\DateTimeZone
+ */
+ public function __get($name)
+ {
+ switch (true) {
+ case array_key_exists($name, $formats = array(
+ 'year' => 'Y',
+ 'yearIso' => 'o',
+ 'month' => 'n',
+ 'day' => 'j',
+ 'hour' => 'G',
+ 'minute' => 'i',
+ 'second' => 's',
+ 'micro' => 'u',
+ 'dayOfWeek' => 'w',
+ 'dayOfYear' => 'z',
+ 'weekOfYear' => 'W',
+ 'daysInMonth' => 't',
+ 'timestamp' => 'U',
+ )):
+ return (int) $this->format($formats[$name]);
+
+ case $name === 'weekOfMonth':
+ return (int) ceil($this->day / static::DAYS_PER_WEEK);
+
+ case $name === 'age':
+ return $this->diffInYears();
+
+ case $name === 'quarter':
+ return (int) ceil($this->month / static::MONTHS_PER_QUARTER);
+
+ case $name === 'offset':
+ return $this->getOffset();
+
+ case $name === 'offsetHours':
+ return $this->getOffset() / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR;
+
+ case $name === 'dst':
+ return $this->format('I') === '1';
+
+ case $name === 'local':
+ return $this->getOffset() === $this->copy()->setTimezone(date_default_timezone_get())->getOffset();
+
+ case $name === 'utc':
+ return $this->getOffset() === 0;
+
+ case $name === 'timezone' || $name === 'tz':
+ return $this->getTimezone();
+
+ case $name === 'timezoneName' || $name === 'tzName':
+ return $this->getTimezone()->getName();
+
+ default:
+ throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
+ }
+ }
+
+ /**
+ * Check if an attribute exists on the object
+ *
+ * @param string $name
+ *
+ * @return bool
+ */
+ public function __isset($name)
+ {
+ try {
+ $this->__get($name);
+ } catch (InvalidArgumentException $e) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Set a part of the Carbon object
+ *
+ * @param string $name
+ * @param string|int|\DateTimeZone $value
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function __set($name, $value)
+ {
+ switch ($name) {
+ case 'year':
+ case 'month':
+ case 'day':
+ case 'hour':
+ case 'minute':
+ case 'second':
+ list($year, $month, $day, $hour, $minute, $second) = explode('-', $this->format('Y-n-j-G-i-s'));
+ $$name = $value;
+ $this->setDateTime($year, $month, $day, $hour, $minute, $second);
+ break;
+
+ case 'timestamp':
+ parent::setTimestamp($value);
+ break;
+
+ case 'timezone':
+ case 'tz':
+ $this->setTimezone($value);
+ break;
+
+ default:
+ throw new InvalidArgumentException(sprintf("Unknown setter '%s'", $name));
+ }
+ }
+
+ /**
+ * Set the instance's year
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function year($value)
+ {
+ $this->year = $value;
+
+ return $this;
+ }
+
+ /**
+ * Set the instance's month
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function month($value)
+ {
+ $this->month = $value;
+
+ return $this;
+ }
+
+ /**
+ * Set the instance's day
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function day($value)
+ {
+ $this->day = $value;
+
+ return $this;
+ }
+
+ /**
+ * Set the instance's hour
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function hour($value)
+ {
+ $this->hour = $value;
+
+ return $this;
+ }
+
+ /**
+ * Set the instance's minute
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function minute($value)
+ {
+ $this->minute = $value;
+
+ return $this;
+ }
+
+ /**
+ * Set the instance's second
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function second($value)
+ {
+ $this->second = $value;
+
+ return $this;
+ }
+
+ /**
+ * Sets the current date of the DateTime object to a different date.
+ * Calls modify as a workaround for a php bug
+ *
+ * @param int $year
+ * @param int $month
+ * @param int $day
+ *
+ * @return static
+ *
+ * @see https://github.com/briannesbitt/Carbon/issues/539
+ * @see https://bugs.php.net/bug.php?id=63863
+ */
+ public function setDate($year, $month, $day)
+ {
+ $this->modify('+0 day');
+
+ return parent::setDate($year, $month, $day);
+ }
+
+ /**
+ * Set the date and time all together
+ *
+ * @param int $year
+ * @param int $month
+ * @param int $day
+ * @param int $hour
+ * @param int $minute
+ * @param int $second
+ *
+ * @return static
+ */
+ public function setDateTime($year, $month, $day, $hour, $minute, $second = 0)
+ {
+ return $this->setDate($year, $month, $day)->setTime($hour, $minute, $second);
+ }
+
+ /**
+ * Set the time by time string
+ *
+ * @param string $time
+ *
+ * @return static
+ */
+ public function setTimeFromTimeString($time)
+ {
+ $time = explode(':', $time);
+
+ $hour = $time[0];
+ $minute = isset($time[1]) ? $time[1] : 0;
+ $second = isset($time[2]) ? $time[2] : 0;
+
+ return $this->setTime($hour, $minute, $second);
+ }
+
+ /**
+ * Set the instance's timestamp
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function timestamp($value)
+ {
+ return $this->setTimestamp($value);
+ }
+
+ /**
+ * Alias for setTimezone()
+ *
+ * @param \DateTimeZone|string $value
+ *
+ * @return static
+ */
+ public function timezone($value)
+ {
+ return $this->setTimezone($value);
+ }
+
+ /**
+ * Alias for setTimezone()
+ *
+ * @param \DateTimeZone|string $value
+ *
+ * @return static
+ */
+ public function tz($value)
+ {
+ return $this->setTimezone($value);
+ }
+
+ /**
+ * Set the instance's timezone from a string or object
+ *
+ * @param \DateTimeZone|string $value
+ *
+ * @return static
+ */
+ public function setTimezone($value)
+ {
+ return parent::setTimezone(static::safeCreateDateTimeZone($value));
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////// WEEK SPECIAL DAYS /////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Get the first day of week
+ *
+ * @return int
+ */
+ public static function getWeekStartsAt()
+ {
+ return static::$weekStartsAt;
+ }
+
+ /**
+ * Set the first day of week
+ *
+ * @param int
+ */
+ public static function setWeekStartsAt($day)
+ {
+ static::$weekStartsAt = $day;
+ }
+
+ /**
+ * Get the last day of week
+ *
+ * @return int
+ */
+ public static function getWeekEndsAt()
+ {
+ return static::$weekEndsAt;
+ }
+
+ /**
+ * Set the last day of week
+ *
+ * @param int
+ */
+ public static function setWeekEndsAt($day)
+ {
+ static::$weekEndsAt = $day;
+ }
+
+ /**
+ * Get weekend days
+ *
+ * @return array
+ */
+ public static function getWeekendDays()
+ {
+ return static::$weekendDays;
+ }
+
+ /**
+ * Set weekend days
+ *
+ * @param array
+ */
+ public static function setWeekendDays($days)
+ {
+ static::$weekendDays = $days;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ ///////////////////////// TESTING AIDS ////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Set a Carbon instance (real or mock) to be returned when a "now"
+ * instance is created. The provided instance will be returned
+ * specifically under the following conditions:
+ * - A call to the static now() method, ex. Carbon::now()
+ * - When a null (or blank string) is passed to the constructor or parse(), ex. new Carbon(null)
+ * - When the string "now" is passed to the constructor or parse(), ex. new Carbon('now')
+ * - When a string containing the desired time is passed to Carbon::parse().
+ *
+ * Note the timezone parameter was left out of the examples above and
+ * has no affect as the mock value will be returned regardless of its value.
+ *
+ * To clear the test instance call this method using the default
+ * parameter of null.
+ *
+ * @param \Carbon\Carbon|string|null $testNow
+ */
+ public static function setTestNow($testNow = null)
+ {
+ static::$testNow = is_string($testNow) ? static::parse($testNow) : $testNow;
+ }
+
+ /**
+ * Get the Carbon instance (real or mock) to be returned when a "now"
+ * instance is created.
+ *
+ * @return static the current instance used for testing
+ */
+ public static function getTestNow()
+ {
+ return static::$testNow;
+ }
+
+ /**
+ * Determine if there is a valid test instance set. A valid test instance
+ * is anything that is not null.
+ *
+ * @return bool true if there is a test instance, otherwise false
+ */
+ public static function hasTestNow()
+ {
+ return static::getTestNow() !== null;
+ }
+
+ /**
+ * Determine if there is a relative keyword in the time string, this is to
+ * create dates relative to now for test instances. e.g.: next tuesday
+ *
+ * @param string $time
+ *
+ * @return bool true if there is a keyword, otherwise false
+ */
+ public static function hasRelativeKeywords($time)
+ {
+ // skip common format with a '-' in it
+ if (preg_match('/\d{4}-\d{1,2}-\d{1,2}/', $time) !== 1) {
+ foreach (static::$relativeKeywords as $keyword) {
+ if (stripos($time, $keyword) !== false) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////// LOCALIZATION //////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize the translator instance if necessary.
+ *
+ * @return \Symfony\Component\Translation\TranslatorInterface
+ */
+ protected static function translator()
+ {
+ if (static::$translator === null) {
+ static::$translator = new Translator('en');
+ static::$translator->addLoader('array', new ArrayLoader());
+ static::setLocale('en');
+ }
+
+ return static::$translator;
+ }
+
+ /**
+ * Get the translator instance in use
+ *
+ * @return \Symfony\Component\Translation\TranslatorInterface
+ */
+ public static function getTranslator()
+ {
+ return static::translator();
+ }
+
+ /**
+ * Set the translator instance to use
+ *
+ * @param \Symfony\Component\Translation\TranslatorInterface $translator
+ */
+ public static function setTranslator(TranslatorInterface $translator)
+ {
+ static::$translator = $translator;
+ }
+
+ /**
+ * Get the current translator locale
+ *
+ * @return string
+ */
+ public static function getLocale()
+ {
+ return static::translator()->getLocale();
+ }
+
+ /**
+ * Set the current translator locale and indicate if the source locale file exists
+ *
+ * @param string $locale
+ *
+ * @return bool
+ */
+ public static function setLocale($locale)
+ {
+ $locale = preg_replace_callback('/\b([a-z]{2})[-_](?:([a-z]{4})[-_])?([a-z]{2})\b/', function ($matches) {
+ return $matches[1].'_'.(!empty($matches[2]) ? ucfirst($matches[2]).'_' : '').strtoupper($matches[3]);
+ }, strtolower($locale));
+
+ if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) {
+ static::translator()->setLocale($locale);
+ // Ensure the locale has been loaded.
+ static::translator()->addResource('array', require $filename, $locale);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////// STRING FORMATTING /////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Set if UTF8 will be used for localized date/time
+ *
+ * @param bool $utf8
+ */
+ public static function setUtf8($utf8)
+ {
+ static::$utf8 = $utf8;
+ }
+
+ /**
+ * Format the instance with the current locale. You can set the current
+ * locale using setlocale() http://php.net/setlocale.
+ *
+ * @param string $format
+ *
+ * @return string
+ */
+ public function formatLocalized($format)
+ {
+ // Check for Windows to find and replace the %e
+ // modifier correctly
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ $format = preg_replace('#(?format(static::$toStringFormat);
+ }
+
+ /**
+ * Format the instance as date
+ *
+ * @return string
+ */
+ public function toDateString()
+ {
+ return $this->format('Y-m-d');
+ }
+
+ /**
+ * Format the instance as a readable date
+ *
+ * @return string
+ */
+ public function toFormattedDateString()
+ {
+ return $this->format('M j, Y');
+ }
+
+ /**
+ * Format the instance as time
+ *
+ * @return string
+ */
+ public function toTimeString()
+ {
+ return $this->format('H:i:s');
+ }
+
+ /**
+ * Format the instance as date and time
+ *
+ * @return string
+ */
+ public function toDateTimeString()
+ {
+ return $this->format('Y-m-d H:i:s');
+ }
+
+ /**
+ * Format the instance with day, date and time
+ *
+ * @return string
+ */
+ public function toDayDateTimeString()
+ {
+ return $this->format('D, M j, Y g:i A');
+ }
+
+ /**
+ * Format the instance as ATOM
+ *
+ * @return string
+ */
+ public function toAtomString()
+ {
+ return $this->format(static::ATOM);
+ }
+
+ /**
+ * Format the instance as COOKIE
+ *
+ * @return string
+ */
+ public function toCookieString()
+ {
+ return $this->format(static::COOKIE);
+ }
+
+ /**
+ * Format the instance as ISO8601
+ *
+ * @return string
+ */
+ public function toIso8601String()
+ {
+ return $this->toAtomString();
+ }
+
+ /**
+ * Format the instance as RFC822
+ *
+ * @return string
+ */
+ public function toRfc822String()
+ {
+ return $this->format(static::RFC822);
+ }
+
+ /**
+ * Format the instance as RFC850
+ *
+ * @return string
+ */
+ public function toRfc850String()
+ {
+ return $this->format(static::RFC850);
+ }
+
+ /**
+ * Format the instance as RFC1036
+ *
+ * @return string
+ */
+ public function toRfc1036String()
+ {
+ return $this->format(static::RFC1036);
+ }
+
+ /**
+ * Format the instance as RFC1123
+ *
+ * @return string
+ */
+ public function toRfc1123String()
+ {
+ return $this->format(static::RFC1123);
+ }
+
+ /**
+ * Format the instance as RFC2822
+ *
+ * @return string
+ */
+ public function toRfc2822String()
+ {
+ return $this->format(static::RFC2822);
+ }
+
+ /**
+ * Format the instance as RFC3339
+ *
+ * @return string
+ */
+ public function toRfc3339String()
+ {
+ return $this->format(static::RFC3339);
+ }
+
+ /**
+ * Format the instance as RSS
+ *
+ * @return string
+ */
+ public function toRssString()
+ {
+ return $this->format(static::RSS);
+ }
+
+ /**
+ * Format the instance as W3C
+ *
+ * @return string
+ */
+ public function toW3cString()
+ {
+ return $this->format(static::W3C);
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ ////////////////////////// COMPARISONS ////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Determines if the instance is equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function eq(Carbon $dt)
+ {
+ return $this == $dt;
+ }
+
+ /**
+ * Determines if the instance is equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @see eq()
+ *
+ * @return bool
+ */
+ public function equalTo(Carbon $dt)
+ {
+ return $this->eq($dt);
+ }
+
+ /**
+ * Determines if the instance is not equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function ne(Carbon $dt)
+ {
+ return !$this->eq($dt);
+ }
+
+ /**
+ * Determines if the instance is not equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @see ne()
+ *
+ * @return bool
+ */
+ public function notEqualTo(Carbon $dt)
+ {
+ return $this->ne($dt);
+ }
+
+ /**
+ * Determines if the instance is greater (after) than another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function gt(Carbon $dt)
+ {
+ return $this > $dt;
+ }
+
+ /**
+ * Determines if the instance is greater (after) than another
+ *
+ * @param Carbon $dt
+ *
+ * @see gt()
+ *
+ * @return bool
+ */
+ public function greaterThan(Carbon $dt)
+ {
+ return $this->gt($dt);
+ }
+
+ /**
+ * Determines if the instance is greater (after) than or equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function gte(Carbon $dt)
+ {
+ return $this >= $dt;
+ }
+
+ /**
+ * Determines if the instance is greater (after) than or equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @see gte()
+ *
+ * @return bool
+ */
+ public function greaterThanOrEqualTo(Carbon $dt)
+ {
+ return $this->gte($dt);
+ }
+
+ /**
+ * Determines if the instance is less (before) than another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function lt(Carbon $dt)
+ {
+ return $this < $dt;
+ }
+
+ /**
+ * Determines if the instance is less (before) than another
+ *
+ * @param Carbon $dt
+ *
+ * @see lt()
+ *
+ * @return bool
+ */
+ public function lessThan(Carbon $dt)
+ {
+ return $this->lt($dt);
+ }
+
+ /**
+ * Determines if the instance is less (before) or equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @return bool
+ */
+ public function lte(Carbon $dt)
+ {
+ return $this <= $dt;
+ }
+
+ /**
+ * Determines if the instance is less (before) or equal to another
+ *
+ * @param Carbon $dt
+ *
+ * @see lte()
+ *
+ * @return bool
+ */
+ public function lessThanOrEqualTo(Carbon $dt)
+ {
+ return $this->lte($dt);
+ }
+
+ /**
+ * Determines if the instance is between two others
+ *
+ * @param Carbon $dt1
+ * @param Carbon $dt2
+ * @param bool $equal Indicates if a > and < comparison should be used or <= or >=
+ *
+ * @return bool
+ */
+ public function between(Carbon $dt1, Carbon $dt2, $equal = true)
+ {
+ if ($dt1->gt($dt2)) {
+ $temp = $dt1;
+ $dt1 = $dt2;
+ $dt2 = $temp;
+ }
+
+ if ($equal) {
+ return $this->gte($dt1) && $this->lte($dt2);
+ }
+
+ return $this->gt($dt1) && $this->lt($dt2);
+ }
+
+ /**
+ * Get the closest date from the instance.
+ *
+ * @param Carbon $dt1
+ * @param Carbon $dt2
+ *
+ * @return static
+ */
+ public function closest(Carbon $dt1, Carbon $dt2)
+ {
+ return $this->diffInSeconds($dt1) < $this->diffInSeconds($dt2) ? $dt1 : $dt2;
+ }
+
+ /**
+ * Get the farthest date from the instance.
+ *
+ * @param Carbon $dt1
+ * @param Carbon $dt2
+ *
+ * @return static
+ */
+ public function farthest(Carbon $dt1, Carbon $dt2)
+ {
+ return $this->diffInSeconds($dt1) > $this->diffInSeconds($dt2) ? $dt1 : $dt2;
+ }
+
+ /**
+ * Get the minimum instance between a given instance (default now) and the current instance.
+ *
+ * @param \Carbon\Carbon|null $dt
+ *
+ * @return static
+ */
+ public function min(Carbon $dt = null)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return $this->lt($dt) ? $this : $dt;
+ }
+
+ /**
+ * Get the minimum instance between a given instance (default now) and the current instance.
+ *
+ * @param \Carbon\Carbon|null $dt
+ *
+ * @see min()
+ *
+ * @return static
+ */
+ public function minimum(Carbon $dt = null)
+ {
+ return $this->min($dt);
+ }
+
+ /**
+ * Get the maximum instance between a given instance (default now) and the current instance.
+ *
+ * @param \Carbon\Carbon|null $dt
+ *
+ * @return static
+ */
+ public function max(Carbon $dt = null)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return $this->gt($dt) ? $this : $dt;
+ }
+
+ /**
+ * Get the maximum instance between a given instance (default now) and the current instance.
+ *
+ * @param \Carbon\Carbon|null $dt
+ *
+ * @see max()
+ *
+ * @return static
+ */
+ public function maximum(Carbon $dt = null)
+ {
+ return $this->max($dt);
+ }
+
+ /**
+ * Determines if the instance is a weekday
+ *
+ * @return bool
+ */
+ public function isWeekday()
+ {
+ return !$this->isWeekend();
+ }
+
+ /**
+ * Determines if the instance is a weekend day
+ *
+ * @return bool
+ */
+ public function isWeekend()
+ {
+ return in_array($this->dayOfWeek, static::$weekendDays);
+ }
+
+ /**
+ * Determines if the instance is yesterday
+ *
+ * @return bool
+ */
+ public function isYesterday()
+ {
+ return $this->toDateString() === static::yesterday($this->getTimezone())->toDateString();
+ }
+
+ /**
+ * Determines if the instance is today
+ *
+ * @return bool
+ */
+ public function isToday()
+ {
+ return $this->toDateString() === static::now($this->getTimezone())->toDateString();
+ }
+
+ /**
+ * Determines if the instance is tomorrow
+ *
+ * @return bool
+ */
+ public function isTomorrow()
+ {
+ return $this->toDateString() === static::tomorrow($this->getTimezone())->toDateString();
+ }
+
+ /**
+ * Determines if the instance is within the next week
+ *
+ * @return bool
+ */
+ public function isNextWeek()
+ {
+ return $this->weekOfYear === static::now($this->getTimezone())->addWeek()->weekOfYear;
+ }
+
+ /**
+ * Determines if the instance is within the last week
+ *
+ * @return bool
+ */
+ public function isLastWeek()
+ {
+ return $this->weekOfYear === static::now($this->getTimezone())->subWeek()->weekOfYear;
+ }
+
+ /**
+ * Determines if the instance is within the next month
+ *
+ * @return bool
+ */
+ public function isNextMonth()
+ {
+ return $this->month === static::now($this->getTimezone())->addMonthNoOverflow()->month;
+ }
+
+ /**
+ * Determines if the instance is within the last month
+ *
+ * @return bool
+ */
+ public function isLastMonth()
+ {
+ return $this->month === static::now($this->getTimezone())->subMonthNoOverflow()->month;
+ }
+
+ /**
+ * Determines if the instance is within next year
+ *
+ * @return bool
+ */
+ public function isNextYear()
+ {
+ return $this->year === static::now($this->getTimezone())->addYear()->year;
+ }
+
+ /**
+ * Determines if the instance is within the previous year
+ *
+ * @return bool
+ */
+ public function isLastYear()
+ {
+ return $this->year === static::now($this->getTimezone())->subYear()->year;
+ }
+
+ /**
+ * Determines if the instance is in the future, ie. greater (after) than now
+ *
+ * @return bool
+ */
+ public function isFuture()
+ {
+ return $this->gt(static::now($this->getTimezone()));
+ }
+
+ /**
+ * Determines if the instance is in the past, ie. less (before) than now
+ *
+ * @return bool
+ */
+ public function isPast()
+ {
+ return $this->lt(static::now($this->getTimezone()));
+ }
+
+ /**
+ * Determines if the instance is a leap year
+ *
+ * @return bool
+ */
+ public function isLeapYear()
+ {
+ return $this->format('L') === '1';
+ }
+
+ /**
+ * Determines if the instance is a long year
+ *
+ * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates
+ *
+ * @return bool
+ */
+ public function isLongYear()
+ {
+ return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53;
+ }
+
+ /*
+ * Compares the formatted values of the two dates.
+ *
+ * @param string $format The date formats to compare.
+ * @param \Carbon\Carbon|null $dt The instance to compare with or null to use current day.
+ *
+ * @return bool
+ */
+ public function isSameAs($format, Carbon $dt = null)
+ {
+ $dt = $dt ?: static::now($this->tz);
+
+ return $this->format($format) === $dt->format($format);
+ }
+
+ /**
+ * Determines if the instance is in the current year
+ *
+ * @return bool
+ */
+ public function isCurrentYear()
+ {
+ return $this->isSameYear();
+ }
+
+ /**
+ * Checks if the passed in date is in the same year as the instance year.
+ *
+ * @param \Carbon\Carbon|null $dt The instance to compare with or null to use current day.
+ *
+ * @return bool
+ */
+ public function isSameYear(Carbon $dt = null)
+ {
+ return $this->isSameAs('Y', $dt);
+ }
+
+ /**
+ * Determines if the instance is in the current month
+ *
+ * @return bool
+ */
+ public function isCurrentMonth()
+ {
+ return $this->isSameMonth();
+ }
+
+ /**
+ * Checks if the passed in date is in the same month as the instance month (and year if needed).
+ *
+ * @param \Carbon\Carbon|null $dt The instance to compare with or null to use current day.
+ * @param bool $ofSameYear Check if it is the same month in the same year.
+ *
+ * @return bool
+ */
+ public function isSameMonth(Carbon $dt = null, $ofSameYear = false)
+ {
+ $format = $ofSameYear ? 'Y-m' : 'm';
+
+ return $this->isSameAs($format, $dt);
+ }
+
+ /**
+ * Checks if the passed in date is the same day as the instance current day.
+ *
+ * @param \Carbon\Carbon $dt
+ *
+ * @return bool
+ */
+ public function isSameDay(Carbon $dt)
+ {
+ return $this->toDateString() === $dt->toDateString();
+ }
+
+ /**
+ * Checks if this day is a Sunday.
+ *
+ * @return bool
+ */
+ public function isSunday()
+ {
+ return $this->dayOfWeek === static::SUNDAY;
+ }
+
+ /**
+ * Checks if this day is a Monday.
+ *
+ * @return bool
+ */
+ public function isMonday()
+ {
+ return $this->dayOfWeek === static::MONDAY;
+ }
+
+ /**
+ * Checks if this day is a Tuesday.
+ *
+ * @return bool
+ */
+ public function isTuesday()
+ {
+ return $this->dayOfWeek === static::TUESDAY;
+ }
+
+ /**
+ * Checks if this day is a Wednesday.
+ *
+ * @return bool
+ */
+ public function isWednesday()
+ {
+ return $this->dayOfWeek === static::WEDNESDAY;
+ }
+
+ /**
+ * Checks if this day is a Thursday.
+ *
+ * @return bool
+ */
+ public function isThursday()
+ {
+ return $this->dayOfWeek === static::THURSDAY;
+ }
+
+ /**
+ * Checks if this day is a Friday.
+ *
+ * @return bool
+ */
+ public function isFriday()
+ {
+ return $this->dayOfWeek === static::FRIDAY;
+ }
+
+ /**
+ * Checks if this day is a Saturday.
+ *
+ * @return bool
+ */
+ public function isSaturday()
+ {
+ return $this->dayOfWeek === static::SATURDAY;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////// ADDITIONS AND SUBTRACTIONS ////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Add years to the instance. Positive $value travel forward while
+ * negative $value travel into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addYears($value)
+ {
+ return $this->modify((int) $value.' year');
+ }
+
+ /**
+ * Add a year to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addYear($value = 1)
+ {
+ return $this->addYears($value);
+ }
+
+ /**
+ * Remove a year from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subYear($value = 1)
+ {
+ return $this->subYears($value);
+ }
+
+ /**
+ * Remove years from the instance.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subYears($value)
+ {
+ return $this->addYears(-1 * $value);
+ }
+
+ /**
+ * Add quarters to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addQuarters($value)
+ {
+ return $this->addMonths(static::MONTHS_PER_QUARTER * $value);
+ }
+
+ /**
+ * Add a quarter to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addQuarter($value = 1)
+ {
+ return $this->addQuarters($value);
+ }
+
+ /**
+ * Remove a quarter from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subQuarter($value = 1)
+ {
+ return $this->subQuarters($value);
+ }
+
+ /**
+ * Remove quarters from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subQuarters($value)
+ {
+ return $this->addQuarters(-1 * $value);
+ }
+
+ /**
+ * Add centuries to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addCenturies($value)
+ {
+ return $this->addYears(static::YEARS_PER_CENTURY * $value);
+ }
+
+ /**
+ * Add a century to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addCentury($value = 1)
+ {
+ return $this->addCenturies($value);
+ }
+
+ /**
+ * Remove a century from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subCentury($value = 1)
+ {
+ return $this->subCenturies($value);
+ }
+
+ /**
+ * Remove centuries from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subCenturies($value)
+ {
+ return $this->addCenturies(-1 * $value);
+ }
+
+ /**
+ * Add months to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonths($value)
+ {
+ if (static::shouldOverflowMonths()) {
+ return $this->addMonthsWithOverflow($value);
+ }
+
+ return $this->addMonthsNoOverflow($value);
+ }
+
+ /**
+ * Add a month to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonth($value = 1)
+ {
+ return $this->addMonths($value);
+ }
+
+ /**
+ * Remove a month from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonth($value = 1)
+ {
+ return $this->subMonths($value);
+ }
+
+ /**
+ * Remove months from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonths($value)
+ {
+ return $this->addMonths(-1 * $value);
+ }
+
+ /**
+ * Add months to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonthsWithOverflow($value)
+ {
+ return $this->modify((int) $value.' month');
+ }
+
+ /**
+ * Add a month to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonthWithOverflow($value = 1)
+ {
+ return $this->addMonthsWithOverflow($value);
+ }
+
+ /**
+ * Remove a month from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonthWithOverflow($value = 1)
+ {
+ return $this->subMonthsWithOverflow($value);
+ }
+
+ /**
+ * Remove months from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonthsWithOverflow($value)
+ {
+ return $this->addMonthsWithOverflow(-1 * $value);
+ }
+
+ /**
+ * Add months without overflowing to the instance. Positive $value
+ * travels forward while negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonthsNoOverflow($value)
+ {
+ $day = $this->day;
+
+ $this->modify((int) $value.' month');
+
+ if ($day !== $this->day) {
+ $this->modify('last day of previous month');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add a month with no overflow to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMonthNoOverflow($value = 1)
+ {
+ return $this->addMonthsNoOverflow($value);
+ }
+
+ /**
+ * Remove a month with no overflow from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonthNoOverflow($value = 1)
+ {
+ return $this->subMonthsNoOverflow($value);
+ }
+
+ /**
+ * Remove months with no overflow from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMonthsNoOverflow($value)
+ {
+ return $this->addMonthsNoOverflow(-1 * $value);
+ }
+
+ /**
+ * Add days to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addDays($value)
+ {
+ return $this->modify((int) $value.' day');
+ }
+
+ /**
+ * Add a day to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addDay($value = 1)
+ {
+ return $this->addDays($value);
+ }
+
+ /**
+ * Remove a day from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subDay($value = 1)
+ {
+ return $this->subDays($value);
+ }
+
+ /**
+ * Remove days from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subDays($value)
+ {
+ return $this->addDays(-1 * $value);
+ }
+
+ /**
+ * Add weekdays to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addWeekdays($value)
+ {
+ // fix for https://bugs.php.net/bug.php?id=54909
+ $t = $this->toTimeString();
+ $this->modify((int) $value.' weekday');
+
+ return $this->setTimeFromTimeString($t);
+ }
+
+ /**
+ * Add a weekday to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addWeekday($value = 1)
+ {
+ return $this->addWeekdays($value);
+ }
+
+ /**
+ * Remove a weekday from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subWeekday($value = 1)
+ {
+ return $this->subWeekdays($value);
+ }
+
+ /**
+ * Remove weekdays from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subWeekdays($value)
+ {
+ return $this->addWeekdays(-1 * $value);
+ }
+
+ /**
+ * Add weeks to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addWeeks($value)
+ {
+ return $this->modify((int) $value.' week');
+ }
+
+ /**
+ * Add a week to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addWeek($value = 1)
+ {
+ return $this->addWeeks($value);
+ }
+
+ /**
+ * Remove a week from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subWeek($value = 1)
+ {
+ return $this->subWeeks($value);
+ }
+
+ /**
+ * Remove weeks to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subWeeks($value)
+ {
+ return $this->addWeeks(-1 * $value);
+ }
+
+ /**
+ * Add hours to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addHours($value)
+ {
+ return $this->modify((int) $value.' hour');
+ }
+
+ /**
+ * Add an hour to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addHour($value = 1)
+ {
+ return $this->addHours($value);
+ }
+
+ /**
+ * Remove an hour from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subHour($value = 1)
+ {
+ return $this->subHours($value);
+ }
+
+ /**
+ * Remove hours from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subHours($value)
+ {
+ return $this->addHours(-1 * $value);
+ }
+
+ /**
+ * Add minutes to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMinutes($value)
+ {
+ return $this->modify((int) $value.' minute');
+ }
+
+ /**
+ * Add a minute to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addMinute($value = 1)
+ {
+ return $this->addMinutes($value);
+ }
+
+ /**
+ * Remove a minute from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMinute($value = 1)
+ {
+ return $this->subMinutes($value);
+ }
+
+ /**
+ * Remove minutes from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subMinutes($value)
+ {
+ return $this->addMinutes(-1 * $value);
+ }
+
+ /**
+ * Add seconds to the instance. Positive $value travels forward while
+ * negative $value travels into the past.
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addSeconds($value)
+ {
+ return $this->modify((int) $value.' second');
+ }
+
+ /**
+ * Add a second to the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function addSecond($value = 1)
+ {
+ return $this->addSeconds($value);
+ }
+
+ /**
+ * Remove a second from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subSecond($value = 1)
+ {
+ return $this->subSeconds($value);
+ }
+
+ /**
+ * Remove seconds from the instance
+ *
+ * @param int $value
+ *
+ * @return static
+ */
+ public function subSeconds($value)
+ {
+ return $this->addSeconds(-1 * $value);
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////// DIFFERENCES ///////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Get the difference in years
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInYears(Carbon $dt = null, $abs = true)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return (int) $this->diff($dt, $abs)->format('%r%y');
+ }
+
+ /**
+ * Get the difference in months
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInMonths(Carbon $dt = null, $abs = true)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return $this->diffInYears($dt, $abs) * static::MONTHS_PER_YEAR + (int) $this->diff($dt, $abs)->format('%r%m');
+ }
+
+ /**
+ * Get the difference in weeks
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInWeeks(Carbon $dt = null, $abs = true)
+ {
+ return (int) ($this->diffInDays($dt, $abs) / static::DAYS_PER_WEEK);
+ }
+
+ /**
+ * Get the difference in days
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInDays(Carbon $dt = null, $abs = true)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return (int) $this->diff($dt, $abs)->format('%r%a');
+ }
+
+ /**
+ * Get the difference in days using a filter closure
+ *
+ * @param Closure $callback
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInDaysFiltered(Closure $callback, Carbon $dt = null, $abs = true)
+ {
+ return $this->diffFiltered(CarbonInterval::day(), $callback, $dt, $abs);
+ }
+
+ /**
+ * Get the difference in hours using a filter closure
+ *
+ * @param Closure $callback
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInHoursFiltered(Closure $callback, Carbon $dt = null, $abs = true)
+ {
+ return $this->diffFiltered(CarbonInterval::hour(), $callback, $dt, $abs);
+ }
+
+ /**
+ * Get the difference by the given interval using a filter closure
+ *
+ * @param CarbonInterval $ci An interval to traverse by
+ * @param Closure $callback
+ * @param Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffFiltered(CarbonInterval $ci, Closure $callback, Carbon $dt = null, $abs = true)
+ {
+ $start = $this;
+ $end = $dt ?: static::now($this->getTimezone());
+ $inverse = false;
+
+ if ($end < $start) {
+ $start = $end;
+ $end = $this;
+ $inverse = true;
+ }
+
+ $period = new DatePeriod($start, $ci, $end);
+ $vals = array_filter(iterator_to_array($period), function (DateTime $date) use ($callback) {
+ return call_user_func($callback, Carbon::instance($date));
+ });
+
+ $diff = count($vals);
+
+ return $inverse && !$abs ? -$diff : $diff;
+ }
+
+ /**
+ * Get the difference in weekdays
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInWeekdays(Carbon $dt = null, $abs = true)
+ {
+ return $this->diffInDaysFiltered(function (Carbon $date) {
+ return $date->isWeekday();
+ }, $dt, $abs);
+ }
+
+ /**
+ * Get the difference in weekend days using a filter
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInWeekendDays(Carbon $dt = null, $abs = true)
+ {
+ return $this->diffInDaysFiltered(function (Carbon $date) {
+ return $date->isWeekend();
+ }, $dt, $abs);
+ }
+
+ /**
+ * Get the difference in hours
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInHours(Carbon $dt = null, $abs = true)
+ {
+ return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE / static::MINUTES_PER_HOUR);
+ }
+
+ /**
+ * Get the difference in minutes
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInMinutes(Carbon $dt = null, $abs = true)
+ {
+ return (int) ($this->diffInSeconds($dt, $abs) / static::SECONDS_PER_MINUTE);
+ }
+
+ /**
+ * Get the difference in seconds
+ *
+ * @param \Carbon\Carbon|null $dt
+ * @param bool $abs Get the absolute of the difference
+ *
+ * @return int
+ */
+ public function diffInSeconds(Carbon $dt = null, $abs = true)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+ $value = $dt->getTimestamp() - $this->getTimestamp();
+
+ return $abs ? abs($value) : $value;
+ }
+
+ /**
+ * The number of seconds since midnight.
+ *
+ * @return int
+ */
+ public function secondsSinceMidnight()
+ {
+ return $this->diffInSeconds($this->copy()->startOfDay());
+ }
+
+ /**
+ * The number of seconds until 23:23:59.
+ *
+ * @return int
+ */
+ public function secondsUntilEndOfDay()
+ {
+ return $this->diffInSeconds($this->copy()->endOfDay());
+ }
+
+ /**
+ * Get the difference in a human readable format in the current locale.
+ *
+ * When comparing a value in the past to default now:
+ * 1 hour ago
+ * 5 months ago
+ *
+ * When comparing a value in the future to default now:
+ * 1 hour from now
+ * 5 months from now
+ *
+ * When comparing a value in the past to another value:
+ * 1 hour before
+ * 5 months before
+ *
+ * When comparing a value in the future to another value:
+ * 1 hour after
+ * 5 months after
+ *
+ * @param Carbon|null $other
+ * @param bool $absolute removes time difference modifiers ago, after, etc
+ * @param bool $short displays short format of time units
+ *
+ * @return string
+ */
+ public function diffForHumans(Carbon $other = null, $absolute = false, $short = false)
+ {
+ $isNow = $other === null;
+
+ if ($isNow) {
+ $other = static::now($this->getTimezone());
+ }
+
+ $diffInterval = $this->diff($other);
+
+ switch (true) {
+ case $diffInterval->y > 0:
+ $unit = $short ? 'y' : 'year';
+ $count = $diffInterval->y;
+ break;
+
+ case $diffInterval->m > 0:
+ $unit = $short ? 'm' : 'month';
+ $count = $diffInterval->m;
+ break;
+
+ case $diffInterval->d > 0:
+ $unit = $short ? 'd' : 'day';
+ $count = $diffInterval->d;
+
+ if ($count >= static::DAYS_PER_WEEK) {
+ $unit = $short ? 'w' : 'week';
+ $count = (int) ($count / static::DAYS_PER_WEEK);
+ }
+ break;
+
+ case $diffInterval->h > 0:
+ $unit = $short ? 'h' : 'hour';
+ $count = $diffInterval->h;
+ break;
+
+ case $diffInterval->i > 0:
+ $unit = $short ? 'min' : 'minute';
+ $count = $diffInterval->i;
+ break;
+
+ default:
+ $count = $diffInterval->s;
+ $unit = $short ? 's' : 'second';
+ break;
+ }
+
+ if ($count === 0) {
+ $count = 1;
+ }
+
+ $time = static::translator()->transChoice($unit, $count, array(':count' => $count));
+
+ if ($absolute) {
+ return $time;
+ }
+
+ $isFuture = $diffInterval->invert === 1;
+
+ $transId = $isNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before');
+
+ // Some langs have special pluralization for past and future tense.
+ $tryKeyExists = $unit.'_'.$transId;
+ if ($tryKeyExists !== static::translator()->transChoice($tryKeyExists, $count)) {
+ $time = static::translator()->transChoice($tryKeyExists, $count, array(':count' => $count));
+ }
+
+ return static::translator()->trans($transId, array(':time' => $time));
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //////////////////////////// MODIFIERS ////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Resets the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfDay()
+ {
+ return $this->setTime(0, 0, 0);
+ }
+
+ /**
+ * Resets the time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfDay()
+ {
+ return $this->setTime(23, 59, 59);
+ }
+
+ /**
+ * Resets the date to the first day of the month and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfMonth()
+ {
+ return $this->setDateTime($this->year, $this->month, 1, 0, 0, 0);
+ }
+
+ /**
+ * Resets the date to end of the month and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfMonth()
+ {
+ return $this->setDateTime($this->year, $this->month, $this->daysInMonth, 23, 59, 59);
+ }
+
+ /**
+ * Resets the date to the first day of the quarter and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfQuarter()
+ {
+ $month = ($this->quarter - 1) * static::MONTHS_PER_QUARTER + 1;
+
+ return $this->setDateTime($this->year, $month, 1, 0, 0, 0);
+ }
+
+ /**
+ * Resets the date to end of the quarter and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfQuarter()
+ {
+ return $this->startOfQuarter()->addMonths(static::MONTHS_PER_QUARTER - 1)->endOfMonth();
+ }
+
+ /**
+ * Resets the date to the first day of the year and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfYear()
+ {
+ return $this->setDateTime($this->year, 1, 1, 0, 0, 0);
+ }
+
+ /**
+ * Resets the date to end of the year and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfYear()
+ {
+ return $this->setDateTime($this->year, 12, 31, 23, 59, 59);
+ }
+
+ /**
+ * Resets the date to the first day of the decade and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfDecade()
+ {
+ $year = $this->year - $this->year % static::YEARS_PER_DECADE;
+
+ return $this->setDateTime($year, 1, 1, 0, 0, 0);
+ }
+
+ /**
+ * Resets the date to end of the decade and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfDecade()
+ {
+ $year = $this->year - $this->year % static::YEARS_PER_DECADE + static::YEARS_PER_DECADE - 1;
+
+ return $this->setDateTime($year, 12, 31, 23, 59, 59);
+ }
+
+ /**
+ * Resets the date to the first day of the century and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfCentury()
+ {
+ $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY;
+
+ return $this->setDateTime($year, 1, 1, 0, 0, 0);
+ }
+
+ /**
+ * Resets the date to end of the century and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfCentury()
+ {
+ $year = $this->year - 1 - ($this->year - 1) % static::YEARS_PER_CENTURY + static::YEARS_PER_CENTURY;
+
+ return $this->setDateTime($year, 12, 31, 23, 59, 59);
+ }
+
+ /**
+ * Resets the date to the first day of week (defined in $weekStartsAt) and the time to 00:00:00
+ *
+ * @return static
+ */
+ public function startOfWeek()
+ {
+ while ($this->dayOfWeek !== static::$weekStartsAt) {
+ $this->subDay();
+ }
+
+ return $this->startOfDay();
+ }
+
+ /**
+ * Resets the date to end of week (defined in $weekEndsAt) and time to 23:59:59
+ *
+ * @return static
+ */
+ public function endOfWeek()
+ {
+ while ($this->dayOfWeek !== static::$weekEndsAt) {
+ $this->addDay();
+ }
+
+ return $this->endOfDay();
+ }
+
+ /**
+ * Modify to the next occurrence of a given day of the week.
+ * If no dayOfWeek is provided, modify to the next occurrence
+ * of the current day of the week. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function next($dayOfWeek = null)
+ {
+ if ($dayOfWeek === null) {
+ $dayOfWeek = $this->dayOfWeek;
+ }
+
+ return $this->startOfDay()->modify('next '.static::$days[$dayOfWeek]);
+ }
+
+ /**
+ * Go forward or backward to the next week- or weekend-day.
+ *
+ * @param bool $weekday
+ * @param bool $forward
+ *
+ * @return static
+ */
+ private function nextOrPreviousDay($weekday = true, $forward = true)
+ {
+ $step = $forward ? 1 : -1;
+
+ do {
+ $this->addDay($step);
+ } while ($weekday ? $this->isWeekend() : $this->isWeekday());
+
+ return $this;
+ }
+
+ /**
+ * Go forward to the next weekday.
+ *
+ * @return $this
+ */
+ public function nextWeekday()
+ {
+ return $this->nextOrPreviousDay();
+ }
+
+ /**
+ * Go backward to the previous weekday.
+ *
+ * @return static
+ */
+ public function previousWeekday()
+ {
+ return $this->nextOrPreviousDay(true, false);
+ }
+
+ /**
+ * Go forward to the next weekend day.
+ *
+ * @return static
+ */
+ public function nextWeekendDay()
+ {
+ return $this->nextOrPreviousDay(false);
+ }
+
+ /**
+ * Go backward to the previous weekend day.
+ *
+ * @return static
+ */
+ public function previousWeekendDay()
+ {
+ return $this->nextOrPreviousDay(false, false);
+ }
+
+ /**
+ * Modify to the previous occurrence of a given day of the week.
+ * If no dayOfWeek is provided, modify to the previous occurrence
+ * of the current day of the week. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function previous($dayOfWeek = null)
+ {
+ if ($dayOfWeek === null) {
+ $dayOfWeek = $this->dayOfWeek;
+ }
+
+ return $this->startOfDay()->modify('last '.static::$days[$dayOfWeek]);
+ }
+
+ /**
+ * Modify to the first occurrence of a given day of the week
+ * in the current month. If no dayOfWeek is provided, modify to the
+ * first day of the current month. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function firstOfMonth($dayOfWeek = null)
+ {
+ $this->startOfDay();
+
+ if ($dayOfWeek === null) {
+ return $this->day(1);
+ }
+
+ return $this->modify('first '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year);
+ }
+
+ /**
+ * Modify to the last occurrence of a given day of the week
+ * in the current month. If no dayOfWeek is provided, modify to the
+ * last day of the current month. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function lastOfMonth($dayOfWeek = null)
+ {
+ $this->startOfDay();
+
+ if ($dayOfWeek === null) {
+ return $this->day($this->daysInMonth);
+ }
+
+ return $this->modify('last '.static::$days[$dayOfWeek].' of '.$this->format('F').' '.$this->year);
+ }
+
+ /**
+ * Modify to the given occurrence of a given day of the week
+ * in the current month. If the calculated occurrence is outside the scope
+ * of the current month, then return false and no modifications are made.
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int $nth
+ * @param int $dayOfWeek
+ *
+ * @return mixed
+ */
+ public function nthOfMonth($nth, $dayOfWeek)
+ {
+ $dt = $this->copy()->firstOfMonth();
+ $check = $dt->format('Y-m');
+ $dt->modify('+'.$nth.' '.static::$days[$dayOfWeek]);
+
+ return $dt->format('Y-m') === $check ? $this->modify($dt) : false;
+ }
+
+ /**
+ * Modify to the first occurrence of a given day of the week
+ * in the current quarter. If no dayOfWeek is provided, modify to the
+ * first day of the current quarter. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function firstOfQuarter($dayOfWeek = null)
+ {
+ return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER - 2, 1)->firstOfMonth($dayOfWeek);
+ }
+
+ /**
+ * Modify to the last occurrence of a given day of the week
+ * in the current quarter. If no dayOfWeek is provided, modify to the
+ * last day of the current quarter. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function lastOfQuarter($dayOfWeek = null)
+ {
+ return $this->setDate($this->year, $this->quarter * static::MONTHS_PER_QUARTER, 1)->lastOfMonth($dayOfWeek);
+ }
+
+ /**
+ * Modify to the given occurrence of a given day of the week
+ * in the current quarter. If the calculated occurrence is outside the scope
+ * of the current quarter, then return false and no modifications are made.
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int $nth
+ * @param int $dayOfWeek
+ *
+ * @return mixed
+ */
+ public function nthOfQuarter($nth, $dayOfWeek)
+ {
+ $dt = $this->copy()->day(1)->month($this->quarter * static::MONTHS_PER_QUARTER);
+ $lastMonth = $dt->month;
+ $year = $dt->year;
+ $dt->firstOfQuarter()->modify('+'.$nth.' '.static::$days[$dayOfWeek]);
+
+ return ($lastMonth < $dt->month || $year !== $dt->year) ? false : $this->modify($dt);
+ }
+
+ /**
+ * Modify to the first occurrence of a given day of the week
+ * in the current year. If no dayOfWeek is provided, modify to the
+ * first day of the current year. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function firstOfYear($dayOfWeek = null)
+ {
+ return $this->month(1)->firstOfMonth($dayOfWeek);
+ }
+
+ /**
+ * Modify to the last occurrence of a given day of the week
+ * in the current year. If no dayOfWeek is provided, modify to the
+ * last day of the current year. Use the supplied constants
+ * to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int|null $dayOfWeek
+ *
+ * @return static
+ */
+ public function lastOfYear($dayOfWeek = null)
+ {
+ return $this->month(static::MONTHS_PER_YEAR)->lastOfMonth($dayOfWeek);
+ }
+
+ /**
+ * Modify to the given occurrence of a given day of the week
+ * in the current year. If the calculated occurrence is outside the scope
+ * of the current year, then return false and no modifications are made.
+ * Use the supplied constants to indicate the desired dayOfWeek, ex. static::MONDAY.
+ *
+ * @param int $nth
+ * @param int $dayOfWeek
+ *
+ * @return mixed
+ */
+ public function nthOfYear($nth, $dayOfWeek)
+ {
+ $dt = $this->copy()->firstOfYear()->modify('+'.$nth.' '.static::$days[$dayOfWeek]);
+
+ return $this->year === $dt->year ? $this->modify($dt) : false;
+ }
+
+ /**
+ * Modify the current instance to the average of a given instance (default now) and the current instance.
+ *
+ * @param \Carbon\Carbon|null $dt
+ *
+ * @return static
+ */
+ public function average(Carbon $dt = null)
+ {
+ $dt = $dt ?: static::now($this->getTimezone());
+
+ return $this->addSeconds((int) ($this->diffInSeconds($dt, false) / 2));
+ }
+
+ /**
+ * Check if its the birthday. Compares the date/month values of the two dates.
+ *
+ * @param \Carbon\Carbon|null $dt The instance to compare with or null to use current day.
+ *
+ * @return bool
+ */
+ public function isBirthday(Carbon $dt = null)
+ {
+ return $this->isSameAs('md', $dt);
+ }
+
+ /**
+ * Consider the timezone when modifying the instance.
+ *
+ * @param string $modify
+ *
+ * @return static
+ */
+ public function modify($modify)
+ {
+ if ($this->local) {
+ return parent::modify($modify);
+ }
+
+ $timezone = $this->getTimezone();
+ $this->setTimezone('UTC');
+ $instance = parent::modify($modify);
+ $this->setTimezone($timezone);
+
+ return $instance;
+ }
+
+ /**
+ * Return a serialized string of the instance.
+ *
+ * @return string
+ */
+ public function serialize()
+ {
+ return serialize($this);
+ }
+
+ /**
+ * Create an instance form a serialized string.
+ *
+ * @param string $value
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return static
+ */
+ public static function fromSerialized($value)
+ {
+ $instance = @unserialize($value);
+
+ if (!$instance instanceof static) {
+ throw new InvalidArgumentException('Invalid serialized value.');
+ }
+
+ return $instance;
+ }
+}
diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php
new file mode 100644
index 0000000..514ca6e
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php
@@ -0,0 +1,557 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Carbon;
+
+use DateInterval;
+use InvalidArgumentException;
+use Symfony\Component\Translation\Loader\ArrayLoader;
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\TranslatorInterface;
+
+/**
+ * A simple API extension for DateInterval.
+ * The implementation provides helpers to handle weeks but only days are saved.
+ * Weeks are calculated based on the total days of the current instance.
+ *
+ * @property int $years Total years of the current interval.
+ * @property int $months Total months of the current interval.
+ * @property int $weeks Total weeks of the current interval calculated from the days.
+ * @property int $dayz Total days of the current interval (weeks * 7 + days).
+ * @property int $hours Total hours of the current interval.
+ * @property int $minutes Total minutes of the current interval.
+ * @property int $seconds Total seconds of the current interval.
+ * @property-read int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7).
+ * @property-read int $daysExcludeWeeks alias of dayzExcludeWeeks
+ *
+ * @method static CarbonInterval years($years = 1) Create instance specifying a number of years.
+ * @method static CarbonInterval year($years = 1) Alias for years()
+ * @method static CarbonInterval months($months = 1) Create instance specifying a number of months.
+ * @method static CarbonInterval month($months = 1) Alias for months()
+ * @method static CarbonInterval weeks($weeks = 1) Create instance specifying a number of weeks.
+ * @method static CarbonInterval week($weeks = 1) Alias for weeks()
+ * @method static CarbonInterval days($days = 1) Create instance specifying a number of days.
+ * @method static CarbonInterval dayz($days = 1) Alias for days()
+ * @method static CarbonInterval day($days = 1) Alias for days()
+ * @method static CarbonInterval hours($hours = 1) Create instance specifying a number of hours.
+ * @method static CarbonInterval hour($hours = 1) Alias for hours()
+ * @method static CarbonInterval minutes($minutes = 1) Create instance specifying a number of minutes.
+ * @method static CarbonInterval minute($minutes = 1) Alias for minutes()
+ * @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds.
+ * @method static CarbonInterval second($seconds = 1) Alias for seconds()
+ * @method CarbonInterval years() years($years = 1) Set the years portion of the current interval.
+ * @method CarbonInterval year() year($years = 1) Alias for years().
+ * @method CarbonInterval months() months($months = 1) Set the months portion of the current interval.
+ * @method CarbonInterval month() month($months = 1) Alias for months().
+ * @method CarbonInterval weeks() weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value.
+ * @method CarbonInterval week() week($weeks = 1) Alias for weeks().
+ * @method CarbonInterval days() days($days = 1) Set the days portion of the current interval.
+ * @method CarbonInterval dayz() dayz($days = 1) Alias for days().
+ * @method CarbonInterval day() day($days = 1) Alias for days().
+ * @method CarbonInterval hours() hours($hours = 1) Set the hours portion of the current interval.
+ * @method CarbonInterval hour() hour($hours = 1) Alias for hours().
+ * @method CarbonInterval minutes() minutes($minutes = 1) Set the minutes portion of the current interval.
+ * @method CarbonInterval minute() minute($minutes = 1) Alias for minutes().
+ * @method CarbonInterval seconds() seconds($seconds = 1) Set the seconds portion of the current interval.
+ * @method CarbonInterval second() second($seconds = 1) Alias for seconds().
+ */
+class CarbonInterval extends DateInterval
+{
+ /**
+ * Interval spec period designators
+ */
+ const PERIOD_PREFIX = 'P';
+ const PERIOD_YEARS = 'Y';
+ const PERIOD_MONTHS = 'M';
+ const PERIOD_DAYS = 'D';
+ const PERIOD_TIME_PREFIX = 'T';
+ const PERIOD_HOURS = 'H';
+ const PERIOD_MINUTES = 'M';
+ const PERIOD_SECONDS = 'S';
+
+ /**
+ * A translator to ... er ... translate stuff
+ *
+ * @var \Symfony\Component\Translation\TranslatorInterface
+ */
+ protected static $translator;
+
+ /**
+ * Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance
+ * was created by DateTime:diff().
+ */
+ const PHP_DAYS_FALSE = -99999;
+
+ /**
+ * Determine if the interval was created via DateTime:diff() or not.
+ *
+ * @param DateInterval $interval
+ *
+ * @return bool
+ */
+ private static function wasCreatedFromDiff(DateInterval $interval)
+ {
+ return $interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //////////////////////////// CONSTRUCTORS /////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Create a new CarbonInterval instance.
+ *
+ * @param int $years
+ * @param int $months
+ * @param int $weeks
+ * @param int $days
+ * @param int $hours
+ * @param int $minutes
+ * @param int $seconds
+ */
+ public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null)
+ {
+ $spec = static::PERIOD_PREFIX;
+
+ $spec .= $years > 0 ? $years.static::PERIOD_YEARS : '';
+ $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : '';
+
+ $specDays = 0;
+ $specDays += $weeks > 0 ? $weeks * Carbon::DAYS_PER_WEEK : 0;
+ $specDays += $days > 0 ? $days : 0;
+
+ $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : '';
+
+ if ($hours > 0 || $minutes > 0 || $seconds > 0) {
+ $spec .= static::PERIOD_TIME_PREFIX;
+ $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : '';
+ $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : '';
+ $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : '';
+ }
+
+ if ($spec === static::PERIOD_PREFIX) {
+ // Allow the zero interval.
+ $spec .= '0'.static::PERIOD_YEARS;
+ }
+
+ parent::__construct($spec);
+ }
+
+ /**
+ * Create a new CarbonInterval instance from specific values.
+ * This is an alias for the constructor that allows better fluent
+ * syntax as it allows you to do CarbonInterval::create(1)->fn() rather than
+ * (new CarbonInterval(1))->fn().
+ *
+ * @param int $years
+ * @param int $months
+ * @param int $weeks
+ * @param int $days
+ * @param int $hours
+ * @param int $minutes
+ * @param int $seconds
+ *
+ * @return static
+ */
+ public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null)
+ {
+ return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds);
+ }
+
+ /**
+ * Provide static helpers to create instances. Allows CarbonInterval::years(3).
+ *
+ * Note: This is done using the magic method to allow static and instance methods to
+ * have the same names.
+ *
+ * @param string $name
+ * @param array $args
+ *
+ * @return static
+ */
+ public static function __callStatic($name, $args)
+ {
+ $arg = count($args) === 0 ? 1 : $args[0];
+
+ switch ($name) {
+ case 'years':
+ case 'year':
+ return new static($arg);
+
+ case 'months':
+ case 'month':
+ return new static(null, $arg);
+
+ case 'weeks':
+ case 'week':
+ return new static(null, null, $arg);
+
+ case 'days':
+ case 'dayz':
+ case 'day':
+ return new static(null, null, null, $arg);
+
+ case 'hours':
+ case 'hour':
+ return new static(null, null, null, null, $arg);
+
+ case 'minutes':
+ case 'minute':
+ return new static(null, null, null, null, null, $arg);
+
+ case 'seconds':
+ case 'second':
+ return new static(null, null, null, null, null, null, $arg);
+ }
+ }
+
+ /**
+ * Create a CarbonInterval instance from a DateInterval one. Can not instance
+ * DateInterval objects created from DateTime::diff() as you can't externally
+ * set the $days field.
+ *
+ * @param DateInterval $di
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return static
+ */
+ public static function instance(DateInterval $di)
+ {
+ if (static::wasCreatedFromDiff($di)) {
+ throw new InvalidArgumentException('Can not instance a DateInterval object created from DateTime::diff().');
+ }
+
+ $instance = new static($di->y, $di->m, 0, $di->d, $di->h, $di->i, $di->s);
+ $instance->invert = $di->invert;
+ $instance->days = $di->days;
+
+ return $instance;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////// LOCALIZATION //////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialize the translator instance if necessary.
+ *
+ * @return \Symfony\Component\Translation\TranslatorInterface
+ */
+ protected static function translator()
+ {
+ if (static::$translator === null) {
+ static::$translator = new Translator('en');
+ static::$translator->addLoader('array', new ArrayLoader());
+ static::setLocale('en');
+ }
+
+ return static::$translator;
+ }
+
+ /**
+ * Get the translator instance in use
+ *
+ * @return \Symfony\Component\Translation\TranslatorInterface
+ */
+ public static function getTranslator()
+ {
+ return static::translator();
+ }
+
+ /**
+ * Set the translator instance to use
+ *
+ * @param TranslatorInterface $translator
+ */
+ public static function setTranslator(TranslatorInterface $translator)
+ {
+ static::$translator = $translator;
+ }
+
+ /**
+ * Get the current translator locale
+ *
+ * @return string
+ */
+ public static function getLocale()
+ {
+ return static::translator()->getLocale();
+ }
+
+ /**
+ * Set the current translator locale
+ *
+ * @param string $locale
+ */
+ public static function setLocale($locale)
+ {
+ static::translator()->setLocale($locale);
+
+ // Ensure the locale has been loaded.
+ static::translator()->addResource('array', require __DIR__.'/Lang/'.$locale.'.php', $locale);
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ ///////////////////////// GETTERS AND SETTERS /////////////////////
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * Get a part of the CarbonInterval object
+ *
+ * @param string $name
+ *
+ * @throws \InvalidArgumentException
+ *
+ * @return int
+ */
+ public function __get($name)
+ {
+ switch ($name) {
+ case 'years':
+ return $this->y;
+
+ case 'months':
+ return $this->m;
+
+ case 'dayz':
+ return $this->d;
+
+ case 'hours':
+ return $this->h;
+
+ case 'minutes':
+ return $this->i;
+
+ case 'seconds':
+ return $this->s;
+
+ case 'weeks':
+ return (int) floor($this->d / Carbon::DAYS_PER_WEEK);
+
+ case 'daysExcludeWeeks':
+ case 'dayzExcludeWeeks':
+ return $this->d % Carbon::DAYS_PER_WEEK;
+
+ default:
+ throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
+ }
+ }
+
+ /**
+ * Set a part of the CarbonInterval object
+ *
+ * @param string $name
+ * @param int $val
+ *
+ * @throws \InvalidArgumentException
+ */
+ public function __set($name, $val)
+ {
+ switch ($name) {
+ case 'years':
+ $this->y = $val;
+ break;
+
+ case 'months':
+ $this->m = $val;
+ break;
+
+ case 'weeks':
+ $this->d = $val * Carbon::DAYS_PER_WEEK;
+ break;
+
+ case 'dayz':
+ $this->d = $val;
+ break;
+
+ case 'hours':
+ $this->h = $val;
+ break;
+
+ case 'minutes':
+ $this->i = $val;
+ break;
+
+ case 'seconds':
+ $this->s = $val;
+ break;
+ }
+ }
+
+ /**
+ * Allow setting of weeks and days to be cumulative.
+ *
+ * @param int $weeks Number of weeks to set
+ * @param int $days Number of days to set
+ *
+ * @return static
+ */
+ public function weeksAndDays($weeks, $days)
+ {
+ $this->dayz = ($weeks * Carbon::DAYS_PER_WEEK) + $days;
+
+ return $this;
+ }
+
+ /**
+ * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day().
+ *
+ * Note: This is done using the magic method to allow static and instance methods to
+ * have the same names.
+ *
+ * @param string $name
+ * @param array $args
+ *
+ * @return static
+ */
+ public function __call($name, $args)
+ {
+ $arg = count($args) === 0 ? 1 : $args[0];
+
+ switch ($name) {
+ case 'years':
+ case 'year':
+ $this->years = $arg;
+ break;
+
+ case 'months':
+ case 'month':
+ $this->months = $arg;
+ break;
+
+ case 'weeks':
+ case 'week':
+ $this->dayz = $arg * Carbon::DAYS_PER_WEEK;
+ break;
+
+ case 'days':
+ case 'dayz':
+ case 'day':
+ $this->dayz = $arg;
+ break;
+
+ case 'hours':
+ case 'hour':
+ $this->hours = $arg;
+ break;
+
+ case 'minutes':
+ case 'minute':
+ $this->minutes = $arg;
+ break;
+
+ case 'seconds':
+ case 'second':
+ $this->seconds = $arg;
+ break;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get the current interval in a human readable format in the current locale.
+ *
+ * @return string
+ */
+ public function forHumans()
+ {
+ $periods = array(
+ 'year' => $this->years,
+ 'month' => $this->months,
+ 'week' => $this->weeks,
+ 'day' => $this->daysExcludeWeeks,
+ 'hour' => $this->hours,
+ 'minute' => $this->minutes,
+ 'second' => $this->seconds,
+ );
+
+ $parts = array();
+ foreach ($periods as $unit => $count) {
+ if ($count > 0) {
+ array_push($parts, static::translator()->transChoice($unit, $count, array(':count' => $count)));
+ }
+ }
+
+ return implode(' ', $parts);
+ }
+
+ /**
+ * Format the instance as a string using the forHumans() function.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->forHumans();
+ }
+
+ /**
+ * Add the passed interval to the current instance
+ *
+ * @param DateInterval $interval
+ *
+ * @return static
+ */
+ public function add(DateInterval $interval)
+ {
+ $sign = $interval->invert === 1 ? -1 : 1;
+
+ if (static::wasCreatedFromDiff($interval)) {
+ $this->dayz += $interval->days * $sign;
+ } else {
+ $this->years += $interval->y * $sign;
+ $this->months += $interval->m * $sign;
+ $this->dayz += $interval->d * $sign;
+ $this->hours += $interval->h * $sign;
+ $this->minutes += $interval->i * $sign;
+ $this->seconds += $interval->s * $sign;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get the interval_spec string
+ *
+ * @return string
+ */
+ public function spec()
+ {
+ $date = array_filter(array(
+ static::PERIOD_YEARS => $this->y,
+ static::PERIOD_MONTHS => $this->m,
+ static::PERIOD_DAYS => $this->d,
+ ));
+
+ $time = array_filter(array(
+ static::PERIOD_HOURS => $this->h,
+ static::PERIOD_MINUTES => $this->i,
+ static::PERIOD_SECONDS => $this->s,
+ ));
+
+ $specString = static::PERIOD_PREFIX;
+
+ foreach ($date as $key => $value) {
+ $specString .= $value.$key;
+ }
+
+ if (count($time) > 0) {
+ $specString .= static::PERIOD_TIME_PREFIX;
+ foreach ($time as $key => $value) {
+ $specString .= $value.$key;
+ }
+ }
+
+ return $specString === static::PERIOD_PREFIX ? 'PT0S' : $specString;
+ }
+}
diff --git a/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php
new file mode 100644
index 0000000..1b0d473
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Carbon\Exceptions;
+
+use Exception;
+use InvalidArgumentException;
+
+class InvalidDateException extends InvalidArgumentException
+{
+ /**
+ * The invalid field.
+ *
+ * @var string
+ */
+ private $field;
+
+ /**
+ * The invalid value.
+ *
+ * @var mixed
+ */
+ private $value;
+
+ /**
+ * Constructor.
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param int $code
+ * @param \Exception|null $previous
+ */
+ public function __construct($field, $value, $code = 0, Exception $previous = null)
+ {
+ $this->field = $field;
+ $this->value = $value;
+ parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous);
+ }
+
+ /**
+ * Get the invalid field.
+ *
+ * @return string
+ */
+ public function getField()
+ {
+ return $this->field;
+ }
+
+ /**
+ * Get the invalid value.
+ *
+ * @return mixed
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+}
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/af.php b/vendor/nesbot/carbon/src/Carbon/Lang/af.php
new file mode 100644
index 0000000..a8610d6
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/af.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 jaar|:count jare',
+ 'y' => '1 jaar|:count jare',
+ 'month' => '1 maand|:count maande',
+ 'm' => '1 maand|:count maande',
+ 'week' => '1 week|:count weke',
+ 'w' => '1 week|:count weke',
+ 'day' => '1 dag|:count dae',
+ 'd' => '1 dag|:count dae',
+ 'hour' => '1 uur|:count ure',
+ 'h' => '1 uur|:count ure',
+ 'minute' => '1 minuut|:count minute',
+ 'min' => '1 minuut|:count minute',
+ 'second' => '1 sekond|:count sekondes',
+ 's' => '1 sekond|:count sekondes',
+ 'ago' => ':time terug',
+ 'from_now' => ':time van nou af',
+ 'after' => ':time na',
+ 'before' => ':time voor',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ar.php b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php
new file mode 100644
index 0000000..253cf50
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ar.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '{0}Ø³ÙØ©|{1}Ø³ÙØ©|{2}Ø³ÙØªÙÙ|[3,10]:count سÙÙØ§Øª|[11,Inf]:count Ø³ÙØ©',
+ 'y' => '{0}Ø³ÙØ©|{1}Ø³ÙØ©|{2}Ø³ÙØªÙÙ|[3,10]:count سÙÙØ§Øª|[11,Inf]:count Ø³ÙØ©',
+ 'month' => '{0}Ø´ÙØ±|{1} Ø´ÙØ±|{2}Ø´ÙØ±ÙÙ|[3,10]:count Ø£Ø´ÙØ±|[11,Inf]:count Ø´ÙØ±',
+ 'm' => '{0}Ø´ÙØ±|{1} Ø´ÙØ±|{2}Ø´ÙØ±ÙÙ|[3,10]:count Ø£Ø´ÙØ±|[11,Inf]:count Ø´ÙØ±',
+ 'week' => '{0}Ø¥Ø³Ø¨ÙØ¹|{1}Ø¥Ø³Ø¨ÙØ¹|{2}Ø¥Ø³Ø¨ÙØ¹ÙÙ|[3,10]:count Ø£Ø³Ø§Ø¨ÙØ¹|[11,Inf]:count Ø¥Ø³Ø¨ÙØ¹',
+ 'w' => '{0}Ø¥Ø³Ø¨ÙØ¹|{1}Ø¥Ø³Ø¨ÙØ¹|{2}Ø¥Ø³Ø¨ÙØ¹ÙÙ|[3,10]:count Ø£Ø³Ø§Ø¨ÙØ¹|[11,Inf]:count Ø¥Ø³Ø¨ÙØ¹',
+ 'day' => '{0}ÙÙÙ
|{1}ÙÙÙ
|{2}ÙÙÙ
ÙÙ|[3,10]:count Ø£ÙØ§Ù
|[11,Inf] ÙÙÙ
',
+ 'd' => '{0}ÙÙÙ
|{1}ÙÙÙ
|{2}ÙÙÙ
ÙÙ|[3,10]:count Ø£ÙØ§Ù
|[11,Inf] ÙÙÙ
',
+ 'hour' => '{0}ساعة|{1}ساعة|{2}ساعتÙÙ|[3,10]:count ساعات|[11,Inf]:count ساعة',
+ 'h' => '{0}ساعة|{1}ساعة|{2}ساعتÙÙ|[3,10]:count ساعات|[11,Inf]:count ساعة',
+ 'minute' => '{0}دÙÙÙØ©|{1}دÙÙÙØ©|{2}دÙÙÙØªÙÙ|[3,10]:count Ø¯ÙØ§Ø¦Ù|[11,Inf]:count دÙÙÙØ©',
+ 'min' => '{0}دÙÙÙØ©|{1}دÙÙÙØ©|{2}دÙÙÙØªÙÙ|[3,10]:count Ø¯ÙØ§Ø¦Ù|[11,Inf]:count دÙÙÙØ©',
+ 'second' => '{0}ثاÙÙØ©|{1}ثاÙÙØ©|{2}ثاÙÙØªÙÙ|[3,10]:count Ø«ÙØ§Ù|[11,Inf]:count ثاÙÙØ©',
+ 's' => '{0}ثاÙÙØ©|{1}ثاÙÙØ©|{2}ثاÙÙØªÙÙ|[3,10]:count Ø«ÙØ§Ù|[11,Inf]:count ثاÙÙØ©',
+ 'ago' => 'Ù
ÙØ° :time',
+ 'from_now' => 'Ù
Ù Ø§ÙØ¢Ù :time',
+ 'after' => 'بعد :time',
+ 'before' => 'ÙØ¨Ù :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/vendor/nesbot/carbon/src/Carbon/Lang/az.php
new file mode 100644
index 0000000..e4f3789
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/az.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count il',
+ 'y' => ':count il',
+ 'month' => ':count ay',
+ 'm' => ':count ay',
+ 'week' => ':count hÉftÉ',
+ 'w' => ':count hÉftÉ',
+ 'day' => ':count gün',
+ 'd' => ':count gün',
+ 'hour' => ':count saat',
+ 'h' => ':count saat',
+ 'minute' => ':count dÉqiqÉ',
+ 'min' => ':count dÉqiqÉ',
+ 'second' => ':count saniyÉ',
+ 's' => ':count saniyÉ',
+ 'ago' => ':time öncÉ',
+ 'from_now' => ':time sonra',
+ 'after' => ':time sonra',
+ 'before' => ':time öncÉ',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bg.php b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php
new file mode 100644
index 0000000..309934b
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/bg.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 година|:count години',
+ 'y' => '1 година|:count години',
+ 'month' => '1 меÑеÑ|:count меÑеÑа',
+ 'm' => '1 меÑеÑ|:count меÑеÑа',
+ 'week' => '1 ÑедмиÑа|:count ÑедмиÑи',
+ 'w' => '1 ÑедмиÑа|:count ÑедмиÑи',
+ 'day' => '1 ден|:count дни',
+ 'd' => '1 ден|:count дни',
+ 'hour' => '1 ÑаÑ|:count ÑаÑа',
+ 'h' => '1 ÑаÑ|:count ÑаÑа',
+ 'minute' => '1 минÑÑа|:count минÑÑи',
+ 'm' => '1 минÑÑа|:count минÑÑи',
+ 'second' => '1 ÑекÑнда|:count ÑекÑнди',
+ 's' => '1 ÑекÑнда|:count ÑекÑнди',
+ 'ago' => 'пÑеди :time',
+ 'from_now' => ':time Ð¾Ñ Ñега',
+ 'after' => 'Ñлед :time',
+ 'before' => 'пÑеди :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php
new file mode 100644
index 0000000..a930df3
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => 'à§§ বà¦à¦°|:count বà¦à¦°',
+ 'y' => 'à§§ বà¦à¦°|:count বà¦à¦°',
+ 'month' => '১ মাস|:count মাস',
+ 'm' => '১ মাস|:count মাস',
+ 'week' => 'à§§ সপà§à¦¤à¦¾à¦¹|:count সপà§à¦¤à¦¾à¦¹',
+ 'w' => 'à§§ সপà§à¦¤à¦¾à¦¹|:count সপà§à¦¤à¦¾à¦¹',
+ 'day' => '১ দিন|:count দিন',
+ 'd' => '১ দিন|:count দিন',
+ 'hour' => 'à§§ à¦à¦¨à§à¦à¦¾|:count à¦à¦¨à§à¦à¦¾',
+ 'h' => 'à§§ à¦à¦¨à§à¦à¦¾|:count à¦à¦¨à§à¦à¦¾',
+ 'minute' => 'à§§ মিনিà¦|:count মিনিà¦',
+ 'min' => 'à§§ মিনিà¦|:count মিনিà¦',
+ 'second' => 'à§§ সà§à¦à§à¦¨à§à¦¡|:count সà§à¦à§à¦¨à§à¦¡',
+ 's' => 'à§§ সà§à¦à§à¦¨à§à¦¡|:count সà§à¦à§à¦¨à§à¦¡',
+ 'ago' => ':time পà§à¦°à§à¦¬à§',
+ 'from_now' => 'à¦à¦à¦¨ থà§à¦à§ :time',
+ 'after' => ':time পরà§',
+ 'before' => ':time à¦à¦à§',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php
new file mode 100644
index 0000000..91262e7
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 any|:count anys',
+ 'y' => '1 any|:count anys',
+ 'month' => '1 mes|:count mesos',
+ 'm' => '1 mes|:count mesos',
+ 'week' => '1 setmana|:count setmanes',
+ 'w' => '1 setmana|:count setmanes',
+ 'day' => '1 dia|:count dies',
+ 'd' => '1 dia|:count dies',
+ 'hour' => '1 hora|:count hores',
+ 'h' => '1 hora|:count hores',
+ 'minute' => '1 minut|:count minuts',
+ 'min' => '1 minut|:count minuts',
+ 'second' => '1 segon|:count segons',
+ 's' => '1 segon|:count segons',
+ 'ago' => 'fa :time',
+ 'from_now' => 'dins de :time',
+ 'after' => ':time després',
+ 'before' => ':time abans',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php
new file mode 100644
index 0000000..f4aba76
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/cs.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 rok|:count roky|:count let',
+ 'y' => '1 rok|:count roky|:count let',
+ 'month' => '1 mÄsÃc|:count mÄsÃce|:count mÄsÃců',
+ 'm' => '1 mÄsÃc|:count mÄsÃce|:count mÄsÃců',
+ 'week' => '1 týden|:count týdny|:count týdnů',
+ 'w' => '1 týden|:count týdny|:count týdnů',
+ 'day' => '1 den|:count dny|:count dnÃ',
+ 'd' => '1 den|:count dny|:count dnÃ',
+ 'hour' => '1 hodinu|:count hodiny|:count hodin',
+ 'h' => '1 hodinu|:count hodiny|:count hodin',
+ 'minute' => '1 minutu|:count minuty|:count minut',
+ 'min' => '1 minutu|:count minuty|:count minut',
+ 'second' => '1 sekundu|:count sekundy|:count sekund',
+ 's' => '1 sekundu|:count sekundy|:count sekund',
+ 'ago' => ':time nazpÄt',
+ 'from_now' => 'za :time',
+ 'after' => ':time pozdÄji',
+ 'before' => ':time pÅedtÃm',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/vendor/nesbot/carbon/src/Carbon/Lang/da.php
new file mode 100644
index 0000000..6710474
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/da.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 år|:count år',
+ 'y' => '1 år|:count år',
+ 'month' => '1 måned|:count måneder',
+ 'm' => '1 måned|:count måneder',
+ 'week' => '1 uge|:count uger',
+ 'w' => '1 uge|:count uger',
+ 'day' => '1 dag|:count dage',
+ 'd' => '1 dag|:count dage',
+ 'hour' => '1 time|:count timer',
+ 'h' => '1 time|:count timer',
+ 'minute' => '1 minut|:count minutter',
+ 'min' => '1 minut|:count minutter',
+ 'second' => '1 sekund|:count sekunder',
+ 's' => '1 sekund|:count sekunder',
+ 'ago' => ':time siden',
+ 'from_now' => 'om :time',
+ 'after' => ':time efter',
+ 'before' => ':time før',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/vendor/nesbot/carbon/src/Carbon/Lang/de.php
new file mode 100644
index 0000000..d1c572a
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/de.php
@@ -0,0 +1,40 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 Jahr|:count Jahre',
+ 'y' => '1J|:countJ',
+ 'month' => '1 Monat|:count Monate',
+ 'm' => '1Mon|:countMon',
+ 'week' => '1 Woche|:count Wochen',
+ 'w' => '1Wo|:countWo',
+ 'day' => '1 Tag|:count Tage',
+ 'd' => '1Tg|:countTg',
+ 'hour' => '1 Stunde|:count Stunden',
+ 'h' => '1Std|:countStd',
+ 'minute' => '1 Minute|:count Minuten',
+ 'min' => '1Min|:countMin',
+ 'second' => '1 Sekunde|:count Sekunden',
+ 's' => '1Sek|:countSek',
+ 'ago' => 'vor :time',
+ 'from_now' => 'in :time',
+ 'after' => ':time später',
+ 'before' => ':time zuvor',
+
+ 'year_from_now' => '1 Jahr|:count Jahren',
+ 'month_from_now' => '1 Monat|:count Monaten',
+ 'week_from_now' => '1 Woche|:count Wochen',
+ 'day_from_now' => '1 Tag|:count Tagen',
+ 'year_ago' => '1 Jahr|:count Jahren',
+ 'month_ago' => '1 Monat|:count Monaten',
+ 'week_ago' => '1 Woche|:count Wochen',
+ 'day_ago' => '1 Tag|:count Tagen',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/el.php b/vendor/nesbot/carbon/src/Carbon/Lang/el.php
new file mode 100644
index 0000000..6028074
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/el.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 ÏÏÏνοÏ|:count ÏÏÏνια',
+ 'y' => '1 ÏÏÏνοÏ|:count ÏÏÏνια',
+ 'month' => '1 μήναÏ|:count μήνεÏ',
+ 'm' => '1 μήναÏ|:count μήνεÏ',
+ 'week' => '1 εβδομάδα|:count εβδομάδεÏ',
+ 'w' => '1 εβδομάδα|:count εβδομάδεÏ',
+ 'day' => '1 μÎÏα|:count μÎÏεÏ',
+ 'd' => '1 μÎÏα|:count μÎÏεÏ',
+ 'hour' => '1 ÏÏα|:count ÏÏεÏ',
+ 'h' => '1 ÏÏα|:count ÏÏεÏ',
+ 'minute' => '1 λεÏÏÏ|:count λεÏÏά',
+ 'min' => '1 λεÏÏÏ|:count λεÏÏά',
+ 'second' => '1 δεÏ
ÏεÏÏλεÏÏο|:count δεÏ
ÏεÏÏλεÏÏα',
+ 's' => '1 δεÏ
ÏεÏÏλεÏÏο|:count δεÏ
ÏεÏÏλεÏÏα',
+ 'ago' => 'ÏÏίν αÏο :time',
+ 'from_now' => 'Ïε :time αÏο ÏÏÏα',
+ 'after' => ':time μεÏά',
+ 'before' => ':time ÏÏίν',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/vendor/nesbot/carbon/src/Carbon/Lang/en.php
new file mode 100644
index 0000000..181c59b
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/en.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 year|:count years',
+ 'y' => '1yr|:countyrs',
+ 'month' => '1 month|:count months',
+ 'm' => '1mo|:countmos',
+ 'week' => '1 week|:count weeks',
+ 'w' => '1w|:countw',
+ 'day' => '1 day|:count days',
+ 'd' => '1d|:countd',
+ 'hour' => '1 hour|:count hours',
+ 'h' => '1h|:counth',
+ 'minute' => '1 minute|:count minutes',
+ 'min' => '1m|:countm',
+ 'second' => '1 second|:count seconds',
+ 's' => '1s|:counts',
+ 'ago' => ':time ago',
+ 'from_now' => ':time from now',
+ 'after' => ':time after',
+ 'before' => ':time before',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eo.php b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php
new file mode 100644
index 0000000..ff1f531
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/eo.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 jaro|:count jaroj',
+ 'y' => '1 jaro|:count jaroj',
+ 'month' => '1 monato|:count monatoj',
+ 'm' => '1 monato|:count monatoj',
+ 'week' => '1 semajno|:count semajnoj',
+ 'w' => '1 semajno|:count semajnoj',
+ 'day' => '1 tago|:count tagoj',
+ 'd' => '1 tago|:count tagoj',
+ 'hour' => '1 horo|:count horoj',
+ 'h' => '1 horo|:count horoj',
+ 'minute' => '1 minuto|:count minutoj',
+ 'min' => '1 minuto|:count minutoj',
+ 'second' => '1 sekundo|:count sekundoj',
+ 's' => '1 sekundo|:count sekundoj',
+ 'ago' => 'antaÅ :time',
+ 'from_now' => 'je :time',
+ 'after' => ':time poste',
+ 'before' => ':time antaÅe',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/vendor/nesbot/carbon/src/Carbon/Lang/es.php
new file mode 100644
index 0000000..fb0aff1
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/es.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 año|:count años',
+ 'y' => '1 año|:count años',
+ 'month' => '1 mes|:count meses',
+ 'm' => '1 mes|:count meses',
+ 'week' => '1 semana|:count semanas',
+ 'w' => '1 semana|:count semanas',
+ 'day' => '1 dÃa|:count dÃas',
+ 'd' => '1 dÃa|:count dÃas',
+ 'hour' => '1 hora|:count horas',
+ 'h' => '1 hora|:count horas',
+ 'minute' => '1 minuto|:count minutos',
+ 'min' => '1 minuto|:count minutos',
+ 'second' => '1 segundo|:count segundos',
+ 's' => '1 segundo|:count segundos',
+ 'ago' => 'hace :time',
+ 'from_now' => 'dentro de :time',
+ 'after' => ':time después',
+ 'before' => ':time antes',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/et.php b/vendor/nesbot/carbon/src/Carbon/Lang/et.php
new file mode 100644
index 0000000..70d682d
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/et.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 aasta|:count aastat',
+ 'y' => '1 aasta|:count aastat',
+ 'month' => '1 kuu|:count kuud',
+ 'm' => '1 kuu|:count kuud',
+ 'week' => '1 nädal|:count nädalat',
+ 'w' => '1 nädal|:count nädalat',
+ 'day' => '1 päev|:count päeva',
+ 'd' => '1 päev|:count päeva',
+ 'hour' => '1 tund|:count tundi',
+ 'h' => '1 tund|:count tundi',
+ 'minute' => '1 minut|:count minutit',
+ 'min' => '1 minut|:count minutit',
+ 'second' => '1 sekund|:count sekundit',
+ 's' => '1 sekund|:count sekundit',
+ 'ago' => ':time tagasi',
+ 'from_now' => ':time pärast',
+ 'after' => ':time pärast',
+ 'before' => ':time enne',
+ 'year_from_now' => ':count aasta',
+ 'month_from_now' => ':count kuu',
+ 'week_from_now' => ':count nädala',
+ 'day_from_now' => ':count päeva',
+ 'hour_from_now' => ':count tunni',
+ 'minute_from_now' => ':count minuti',
+ 'second_from_now' => ':count sekundi',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/eu.php b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php
new file mode 100644
index 0000000..1cb6b7c
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/eu.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => 'Urte 1|:count urte',
+ 'y' => 'Urte 1|:count urte',
+ 'month' => 'Hile 1|:count hile',
+ 'm' => 'Hile 1|:count hile',
+ 'week' => 'Aste 1|:count aste',
+ 'w' => 'Aste 1|:count aste',
+ 'day' => 'Egun 1|:count egun',
+ 'd' => 'Egun 1|:count egun',
+ 'hour' => 'Ordu 1|:count ordu',
+ 'h' => 'Ordu 1|:count ordu',
+ 'minute' => 'Minutu 1|:count minutu',
+ 'min' => 'Minutu 1|:count minutu',
+ 'second' => 'Segundu 1|:count segundu',
+ 's' => 'Segundu 1|:count segundu',
+ 'ago' => 'Orain dela :time',
+ 'from_now' => ':time barru',
+ 'after' => ':time geroago',
+ 'before' => ':time lehenago',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fa.php b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php
new file mode 100644
index 0000000..31bec88
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/fa.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count ساÙ',
+ 'y' => ':count ساÙ',
+ 'month' => ':count Ù
اÙ',
+ 'm' => ':count Ù
اÙ',
+ 'week' => ':count ÙÙØªÙ',
+ 'w' => ':count ÙÙØªÙ',
+ 'day' => ':count Ø±ÙØ²',
+ 'd' => ':count Ø±ÙØ²',
+ 'hour' => ':count ساعت',
+ 'h' => ':count ساعت',
+ 'minute' => ':count دÙÛÙÙ',
+ 'min' => ':count دÙÛÙÙ',
+ 'second' => ':count ثاÙÛÙ',
+ 's' => ':count ثاÙÛÙ',
+ 'ago' => ':time Ù¾ÛØ´',
+ 'from_now' => ':time بعد',
+ 'after' => ':time پس از',
+ 'before' => ':time Ù¾ÛØ´ از',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php
new file mode 100644
index 0000000..46794fa
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/fi.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 vuosi|:count vuotta',
+ 'y' => '1 vuosi|:count vuotta',
+ 'month' => '1 kuukausi|:count kuukautta',
+ 'm' => '1 kuukausi|:count kuukautta',
+ 'week' => '1 viikko|:count viikkoa',
+ 'w' => '1 viikko|:count viikkoa',
+ 'day' => '1 päivä|:count päivää',
+ 'd' => '1 päivä|:count päivää',
+ 'hour' => '1 tunti|:count tuntia',
+ 'h' => '1 tunti|:count tuntia',
+ 'minute' => '1 minuutti|:count minuuttia',
+ 'min' => '1 minuutti|:count minuuttia',
+ 'second' => '1 sekunti|:count sekuntia',
+ 's' => '1 sekunti|:count sekuntia',
+ 'ago' => ':time sitten',
+ 'from_now' => ':time tästä hetkestä',
+ 'after' => ':time sen jälkeen',
+ 'before' => ':time ennen',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fo.php b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php
new file mode 100644
index 0000000..d4d6823
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/fo.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 ár|:count ár',
+ 'y' => '1 ár|:count ár',
+ 'month' => '1 mánaður|:count mánaðir',
+ 'm' => '1 mánaður|:count mánaðir',
+ 'week' => '1 vika|:count vikur',
+ 'w' => '1 vika|:count vikur',
+ 'day' => '1 dag|:count dagar',
+ 'd' => '1 dag|:count dagar',
+ 'hour' => '1 tÃmi|:count tÃmar',
+ 'h' => '1 tÃmi|:count tÃmar',
+ 'minute' => '1 minutt|:count minuttir',
+ 'min' => '1 minutt|:count minuttir',
+ 'second' => '1 sekund|:count sekundir',
+ 's' => '1 sekund|:count sekundir',
+ 'ago' => ':time sÃðan',
+ 'from_now' => 'um :time',
+ 'after' => ':time aftaná',
+ 'before' => ':time áðrenn',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php
new file mode 100644
index 0000000..be79738
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 an|:count ans',
+ 'y' => '1 an|:count ans',
+ 'month' => ':count mois',
+ 'm' => ':count mois',
+ 'week' => '1 semaine|:count semaines',
+ 'w' => '1 semaine|:count semaines',
+ 'day' => '1 jour|:count jours',
+ 'd' => '1 jour|:count jours',
+ 'hour' => '1 heure|:count heures',
+ 'h' => '1 heure|:count heures',
+ 'minute' => '1 minute|:count minutes',
+ 'min' => '1 minute|:count minutes',
+ 'second' => '1 seconde|:count secondes',
+ 's' => '1 seconde|:count secondes',
+ 'ago' => 'il y a :time',
+ 'from_now' => 'dans :time',
+ 'after' => ':time après',
+ 'before' => ':time avant',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/gl.php b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php
new file mode 100644
index 0000000..609bf75
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/gl.php
@@ -0,0 +1,24 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 ano|:count anos',
+ 'month' => '1 mes|:count meses',
+ 'week' => '1 semana|:count semanas',
+ 'day' => '1 dÃa|:count dÃas',
+ 'hour' => '1 hora|:count horas',
+ 'minute' => '1 minuto|:count minutos',
+ 'second' => '1 segundo|:count segundos',
+ 'ago' => 'fai :time',
+ 'from_now' => 'dentro de :time',
+ 'after' => ':time despois',
+ 'before' => ':time antes',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/he.php b/vendor/nesbot/carbon/src/Carbon/Lang/he.php
new file mode 100644
index 0000000..2d4f4f8
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/he.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '×©× ×|{2}×©× ×ª×××|:count ×©× ××',
+ 'y' => '×©× ×|{2}×©× ×ª×××|:count ×©× ××',
+ 'month' => '×××ש|{2}×××ש×××|:count ×××ש××',
+ 'm' => '×××ש|{2}×××ש×××|:count ×××ש××',
+ 'week' => 'ש×××¢|{2}ש×××¢×××|:count ש×××¢×ת',
+ 'w' => 'ש×××¢|{2}ש×××¢×××|:count ש×××¢×ת',
+ 'day' => '×××|{2}××××××|:count ××××',
+ 'd' => '×××|{2}××××××|:count ××××',
+ 'hour' => 'שע×|{2}שעת×××|:count שע×ת',
+ 'h' => 'שע×|{2}שעת×××|:count שע×ת',
+ 'minute' => '××§×|{2}××§×ת×××|:count ××§×ת',
+ 'min' => '××§×|{2}××§×ת×××|:count ××§×ת',
+ 'second' => '×©× ××|:count ×©× ××ת',
+ 's' => '×©× ××|:count ×©× ××ת',
+ 'ago' => '××¤× × :time',
+ 'from_now' => '××¢×× :time',
+ 'after' => '×××¨× :time',
+ 'before' => '××¤× × :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hr.php b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php
new file mode 100644
index 0000000..1a339de
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/hr.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count godinu|:count godine|:count godina',
+ 'y' => ':count godinu|:count godine|:count godina',
+ 'month' => ':count mjesec|:count mjeseca|:count mjeseci',
+ 'm' => ':count mjesec|:count mjeseca|:count mjeseci',
+ 'week' => ':count tjedan|:count tjedna|:count tjedana',
+ 'w' => ':count tjedan|:count tjedna|:count tjedana',
+ 'day' => ':count dan|:count dana|:count dana',
+ 'd' => ':count dan|:count dana|:count dana',
+ 'hour' => ':count sat|:count sata|:count sati',
+ 'h' => ':count sat|:count sata|:count sati',
+ 'minute' => ':count minutu|:count minute |:count minuta',
+ 'min' => ':count minutu|:count minute |:count minuta',
+ 'second' => ':count sekundu|:count sekunde|:count sekundi',
+ 's' => ':count sekundu|:count sekunde|:count sekundi',
+ 'ago' => 'prije :time',
+ 'from_now' => 'za :time',
+ 'after' => 'za :time',
+ 'before' => 'prije :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php
new file mode 100644
index 0000000..45daf41
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/hu.php
@@ -0,0 +1,52 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count év',
+ 'y' => ':count év',
+ 'month' => ':count hónap',
+ 'm' => ':count hónap',
+ 'week' => ':count hét',
+ 'w' => ':count hét',
+ 'day' => ':count nap',
+ 'd' => ':count nap',
+ 'hour' => ':count óra',
+ 'h' => ':count óra',
+ 'minute' => ':count perc',
+ 'min' => ':count perc',
+ 'second' => ':count másodperc',
+ 's' => ':count másodperc',
+ 'ago' => ':time',
+ 'from_now' => ':time múlva',
+ 'after' => ':time késÅbb',
+ 'before' => ':time korábban',
+ 'year_ago' => ':count éve',
+ 'month_ago' => ':count hónapja',
+ 'week_ago' => ':count hete',
+ 'day_ago' => ':count napja',
+ 'hour_ago' => ':count órája',
+ 'minute_ago' => ':count perce',
+ 'second_ago' => ':count másodperce',
+ 'year_after' => ':count évvel',
+ 'month_after' => ':count hónappal',
+ 'week_after' => ':count héttel',
+ 'day_after' => ':count nappal',
+ 'hour_after' => ':count órával',
+ 'minute_after' => ':count perccel',
+ 'second_after' => ':count másodperccel',
+ 'year_before' => ':count évvel',
+ 'month_before' => ':count hónappal',
+ 'week_before' => ':count héttel',
+ 'day_before' => ':count nappal',
+ 'hour_before' => ':count órával',
+ 'minute_before' => ':count perccel',
+ 'second_before' => ':count másodperccel',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hy.php b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php
new file mode 100644
index 0000000..4b4545d
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/hy.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count Õ¿Õ¡ÖÕ«',
+ 'y' => ':count Õ¿Õ¡ÖÕ«',
+ 'month' => ':count Õ¡Õ´Õ«Õ½',
+ 'm' => ':count Õ¡Õ´Õ«Õ½',
+ 'week' => ':count Õ·Õ¡Õ¢Õ¡Õ©',
+ 'w' => ':count Õ·Õ¡Õ¢Õ¡Õ©',
+ 'day' => ':count Ö
Ö',
+ 'd' => ':count Ö
Ö',
+ 'hour' => ':count ÕªÕ¡Õ´',
+ 'h' => ':count ÕªÕ¡Õ´',
+ 'minute' => ':count ÖÕ¸ÕºÕ¥',
+ 'min' => ':count ÖÕ¸ÕºÕ¥',
+ 'second' => ':count Õ¾Õ¡ÕµÖÕ¯ÕµÕ¡Õ¶',
+ 's' => ':count Õ¾Õ¡ÕµÖÕ¯ÕµÕ¡Õ¶',
+ 'ago' => ':time Õ¡Õ¼Õ¡Õ»',
+ 'from_now' => ':time Õ°Õ¥Õ¿Õ¸',
+ 'after' => ':time Õ°Õ¥Õ¿Õ¸',
+ 'before' => ':time Õ¡Õ¼Õ¡Õ»',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/id.php b/vendor/nesbot/carbon/src/Carbon/Lang/id.php
new file mode 100644
index 0000000..7f7114f
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/id.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count tahun',
+ 'y' => ':count tahun',
+ 'month' => ':count bulan',
+ 'm' => ':count bulan',
+ 'week' => ':count minggu',
+ 'w' => ':count minggu',
+ 'day' => ':count hari',
+ 'd' => ':count hari',
+ 'hour' => ':count jam',
+ 'h' => ':count jam',
+ 'minute' => ':count menit',
+ 'min' => ':count menit',
+ 'second' => ':count detik',
+ 's' => ':count detik',
+ 'ago' => ':time yang lalu',
+ 'from_now' => ':time dari sekarang',
+ 'after' => ':time setelah',
+ 'before' => ':time sebelum',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/vendor/nesbot/carbon/src/Carbon/Lang/it.php
new file mode 100644
index 0000000..19eedaf
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/it.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 anno|:count anni',
+ 'y' => '1 anno|:count anni',
+ 'month' => '1 mese|:count mesi',
+ 'm' => '1 mese|:count mesi',
+ 'week' => '1 settimana|:count settimane',
+ 'w' => '1 settimana|:count settimane',
+ 'day' => '1 giorno|:count giorni',
+ 'd' => '1 giorno|:count giorni',
+ 'hour' => '1 ora|:count ore',
+ 'h' => '1 ora|:count ore',
+ 'minute' => '1 minuto|:count minuti',
+ 'min' => '1 minuto|:count minuti',
+ 'second' => '1 secondo|:count secondi',
+ 's' => '1 secondo|:count secondi',
+ 'ago' => ':time fa',
+ 'from_now' => ':time da adesso',
+ 'after' => ':time dopo',
+ 'before' => ':time prima',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ja.php b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php
new file mode 100644
index 0000000..c12c199
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ja.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count å¹´',
+ 'y' => ':count å¹´',
+ 'month' => ':count ã¶æ',
+ 'm' => ':count ã¶æ',
+ 'week' => ':count é±é',
+ 'w' => ':count é±é',
+ 'day' => ':count æ¥',
+ 'd' => ':count æ¥',
+ 'hour' => ':count æé',
+ 'h' => ':count æé',
+ 'minute' => ':count å',
+ 'min' => ':count å',
+ 'second' => ':count ç§',
+ 's' => ':count ç§',
+ 'ago' => ':time å',
+ 'from_now' => 'ä»ãã :time',
+ 'after' => ':time å¾',
+ 'before' => ':time å',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ka.php b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php
new file mode 100644
index 0000000..a8dde7e
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ka.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count á¬ááá¡',
+ 'y' => ':count á¬ááá¡',
+ 'month' => ':count áááá¡',
+ 'm' => ':count áááá¡',
+ 'week' => ':count áááá áá¡',
+ 'w' => ':count áááá áá¡',
+ 'day' => ':count áá¦áá¡',
+ 'd' => ':count áá¦áá¡',
+ 'hour' => ':count á¡ááááá¡',
+ 'h' => ':count á¡ááááá¡',
+ 'minute' => ':count á¬á£ááá¡',
+ 'min' => ':count á¬á£ááá¡',
+ 'second' => ':count á¬áááá¡',
+ 's' => ':count á¬áááá¡',
+ 'ago' => ':time á£ááá',
+ 'from_now' => ':time á¨ááááá',
+ 'after' => ':time á¨ááááá',
+ 'before' => ':time á£ááá',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/km.php b/vendor/nesbot/carbon/src/Carbon/Lang/km.php
new file mode 100644
index 0000000..a104e06
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/km.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count áááá¶á',
+ 'y' => ':count áááá¶á',
+ 'month' => ':count áá',
+ 'm' => ':count áá',
+ 'week' => ':count ááááá¶á á',
+ 'w' => ':count ááááá¶á á',
+ 'day' => ':count áááá',
+ 'd' => ':count áááá',
+ 'hour' => ':count áááá',
+ 'h' => ':count áááá',
+ 'minute' => ':count áá¶áá¸',
+ 'min' => ':count áá¶áá¸',
+ 'second' => ':count áá·áá¶áá¸',
+ 's' => ':count áá·áá¶áá¸',
+ 'ago' => ':timeáá»á',
+ 'from_now' => ':timeáá¸âá¥á¡á¼á',
+ 'after' => 'áá
âááááá :time',
+ 'before' => 'áá
âáá»á :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php
new file mode 100644
index 0000000..9eac8c9
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count ë
',
+ 'y' => ':count ë
',
+ 'month' => ':count ê°ì',
+ 'm' => ':count ê°ì',
+ 'week' => ':count 주ì¼',
+ 'w' => ':count 주ì¼',
+ 'day' => ':count ì¼',
+ 'd' => ':count ì¼',
+ 'hour' => ':count ìê°',
+ 'h' => ':count ìê°',
+ 'minute' => ':count ë¶',
+ 'min' => ':count ë¶',
+ 'second' => ':count ì´',
+ 's' => ':count ì´',
+ 'ago' => ':time ì ',
+ 'from_now' => ':time í',
+ 'after' => ':time ë¤',
+ 'before' => ':time ì',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lt.php b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php
new file mode 100644
index 0000000..3f2fd1e
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/lt.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count metus|:count metus|:count metų',
+ 'y' => ':count metus|:count metus|:count metų',
+ 'month' => ':count mÄnesį|:count mÄnesius|:count mÄnesių',
+ 'm' => ':count mÄnesį|:count mÄnesius|:count mÄnesių',
+ 'week' => ':count savaitÄ|:count savaites|:count savaiÄių',
+ 'w' => ':count savaitÄ|:count savaites|:count savaiÄių',
+ 'day' => ':count dienÄ
|:count dienas|:count dienų',
+ 'd' => ':count dienÄ
|:count dienas|:count dienų',
+ 'hour' => ':count valandÄ
|:count valandas|:count valandų',
+ 'h' => ':count valandÄ
|:count valandas|:count valandų',
+ 'minute' => ':count minutÄ|:count minutes|:count minuÄių',
+ 'min' => ':count minutÄ|:count minutes|:count minuÄių',
+ 'second' => ':count sekundÄ|:count sekundes|:count sekundžių',
+ 's' => ':count sekundÄ|:count sekundes|:count sekundžių',
+ 'second_from_now' => ':count sekundÄs|:count sekundžių|:count sekundžių',
+ 'minute_from_now' => ':count minutÄs|:count minuÄių|:count minuÄių',
+ 'hour_from_now' => ':count valandos|:count valandų|:count valandų',
+ 'day_from_now' => ':count dienos|:count dienų|:count dienų',
+ 'week_from_now' => ':count savaitÄs|:count savaiÄių|:count savaiÄių',
+ 'month_from_now' => ':count mÄnesio|:count mÄnesių|:count mÄnesių',
+ 'year_from_now' => ':count metų',
+ 'ago' => 'prieš :time',
+ 'from_now' => 'už :time',
+ 'after' => 'po :time',
+ 'before' => ':time nuo dabar',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php
new file mode 100644
index 0000000..363193d
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/lv.php
@@ -0,0 +1,47 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '0 gadiem|:count gada|:count gadiem',
+ 'y' => '0 gadiem|:count gada|:count gadiem',
+ 'month' => '0 mÄneÅ¡iem|:count mÄneÅ¡a|:count mÄneÅ¡iem',
+ 'm' => '0 mÄneÅ¡iem|:count mÄneÅ¡a|:count mÄneÅ¡iem',
+ 'week' => '0 nedÄļÄm|:count nedÄļas|:count nedÄļÄm',
+ 'w' => '0 nedÄļÄm|:count nedÄļas|:count nedÄļÄm',
+ 'day' => '0 dienÄm|:count dienas|:count dienÄm',
+ 'd' => '0 dienÄm|:count dienas|:count dienÄm',
+ 'hour' => '0 stundÄm|:count stundas|:count stundÄm',
+ 'h' => '0 stundÄm|:count stundas|:count stundÄm',
+ 'minute' => '0 minÅ«tÄm|:count minÅ«tes|:count minÅ«tÄm',
+ 'min' => '0 minÅ«tÄm|:count minÅ«tes|:count minÅ«tÄm',
+ 'second' => '0 sekundÄm|:count sekundes|:count sekundÄm',
+ 's' => '0 sekundÄm|:count sekundes|:count sekundÄm',
+ 'ago' => 'pirms :time',
+ 'from_now' => 'pÄc :time',
+ 'after' => ':time vÄlÄk',
+ 'before' => ':time pirms',
+
+ 'year_after' => '0 gadus|:count gadu|:count gadus',
+ 'month_after' => '0 mÄneÅ¡us|:count mÄnesi|:count mÄneÅ¡us',
+ 'week_after' => '0 nedÄļas|:count nedÄļu|:count nedÄļas',
+ 'day_after' => '0 dienas|:count dienu|:count dienas',
+ 'hour_after' => '0 stundas|:count stundu|:count stundas',
+ 'minute_after' => '0 minūtes|:count minūti|:count minūtes',
+ 'second_after' => '0 sekundes|:count sekundi|:count sekundes',
+
+ 'year_before' => '0 gadus|:count gadu|:count gadus',
+ 'month_before' => '0 mÄneÅ¡us|:count mÄnesi|:count mÄneÅ¡us',
+ 'week_before' => '0 nedÄļas|:count nedÄļu|:count nedÄļas',
+ 'day_before' => '0 dienas|:count dienu|:count dienas',
+ 'hour_before' => '0 stundas|:count stundu|:count stundas',
+ 'minute_before' => '0 minūtes|:count minūti|:count minūtes',
+ 'second_before' => '0 sekundes|:count sekundi|:count sekundes',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/mk.php b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php
new file mode 100644
index 0000000..51e661d
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/mk.php
@@ -0,0 +1,24 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 година|:count години',
+ 'month' => '1 меÑеÑ|:count меÑеÑи',
+ 'week' => '1 ÑедмиÑа|:count ÑедмиÑи',
+ 'day' => '1 ден|:count дена',
+ 'hour' => '1 ÑаÑ|:count ÑаÑа',
+ 'minute' => '1 минÑÑа|:count минÑÑи',
+ 'second' => '1 ÑекÑнда|:count ÑекÑнди',
+ 'ago' => 'пÑед :time',
+ 'from_now' => ':time од Ñега',
+ 'after' => 'по :time',
+ 'before' => 'пÑед :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php
new file mode 100644
index 0000000..ef57422
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ms.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count tahun',
+ 'y' => ':count tahun',
+ 'month' => ':count bulan',
+ 'm' => ':count bulan',
+ 'week' => ':count minggu',
+ 'w' => ':count minggu',
+ 'day' => ':count hari',
+ 'd' => ':count hari',
+ 'hour' => ':count jam',
+ 'h' => ':count jam',
+ 'minute' => ':count minit',
+ 'min' => ':count minit',
+ 'second' => ':count saat',
+ 's' => ':count saat',
+ 'ago' => ':time yang lalu',
+ 'from_now' => ':time dari sekarang',
+ 'after' => ':time selepas',
+ 'before' => ':time sebelum',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php
new file mode 100644
index 0000000..a398ca9
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count jaar',
+ 'y' => ':count jaar',
+ 'month' => '1 maand|:count maanden',
+ 'm' => '1 maand|:count maanden',
+ 'week' => '1 week|:count weken',
+ 'w' => '1 week|:count weken',
+ 'day' => '1 dag|:count dagen',
+ 'd' => '1 dag|:count dagen',
+ 'hour' => ':count uur',
+ 'h' => ':count uur',
+ 'minute' => '1 minuut|:count minuten',
+ 'min' => '1 minuut|:count minuten',
+ 'second' => '1 seconde|:count seconden',
+ 's' => '1 seconde|:count seconden',
+ 'ago' => ':time geleden',
+ 'from_now' => 'over :time',
+ 'after' => ':time later',
+ 'before' => ':time eerder',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/vendor/nesbot/carbon/src/Carbon/Lang/no.php
new file mode 100644
index 0000000..178fbdc
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/no.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 år|:count år',
+ 'y' => '1 år|:count år',
+ 'month' => '1 måned|:count måneder',
+ 'm' => '1 måned|:count måneder',
+ 'week' => '1 uke|:count uker',
+ 'w' => '1 uke|:count uker',
+ 'day' => '1 dag|:count dager',
+ 'd' => '1 dag|:count dager',
+ 'hour' => '1 time|:count timer',
+ 'h' => '1 time|:count timer',
+ 'minute' => '1 minutt|:count minutter',
+ 'min' => '1 minutt|:count minutter',
+ 'second' => '1 sekund|:count sekunder',
+ 's' => '1 sekund|:count sekunder',
+ 'ago' => ':time siden',
+ 'from_now' => 'om :time',
+ 'after' => ':time etter',
+ 'before' => ':time før',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php
new file mode 100644
index 0000000..bca2d7f
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 rok|:count lata|:count lat',
+ 'y' => '1 rok|:count lata|:count lat',
+ 'month' => '1 miesiÄ
c|:count miesiÄ
ce|:count miesiÄcy',
+ 'm' => '1 miesiÄ
c|:count miesiÄ
ce|:count miesiÄcy',
+ 'week' => '1 tydzieÅ|:count tygodnie|:count tygodni',
+ 'w' => '1 tydzieÅ|:count tygodnie|:count tygodni',
+ 'day' => '1 dzieÅ|:count dni|:count dni',
+ 'd' => '1 dzieÅ|:count dni|:count dni',
+ 'hour' => '1 godzina|:count godziny|:count godzin',
+ 'h' => '1 godzina|:count godziny|:count godzin',
+ 'minute' => '1 minuta|:count minuty|:count minut',
+ 'min' => '1 minuta|:count minuty|:count minut',
+ 'second' => '1 sekunda|:count sekundy|:count sekund',
+ 's' => '1 sekunda|:count sekundy|:count sekund',
+ 'ago' => ':time temu',
+ 'from_now' => ':time od teraz',
+ 'after' => ':time przed',
+ 'before' => ':time po',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php
new file mode 100644
index 0000000..f170648
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 ano|:count anos',
+ 'y' => '1 ano|:count anos',
+ 'month' => '1 mês|:count meses',
+ 'm' => '1 mês|:count meses',
+ 'week' => '1 semana|:count semanas',
+ 'w' => '1 semana|:count semanas',
+ 'day' => '1 dia|:count dias',
+ 'd' => '1 dia|:count dias',
+ 'hour' => '1 hora|:count horas',
+ 'h' => '1 hora|:count horas',
+ 'minute' => '1 minuto|:count minutos',
+ 'min' => '1 minuto|:count minutos',
+ 'second' => '1 segundo|:count segundos',
+ 's' => '1 segundo|:count segundos',
+ 'ago' => ':time atrás',
+ 'from_now' => 'em :time',
+ 'after' => ':time depois',
+ 'before' => ':time antes',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php
new file mode 100644
index 0000000..f9cbdc7
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 ano|:count anos',
+ 'y' => '1 ano|:count anos',
+ 'month' => '1 mês|:count meses',
+ 'm' => '1 mês|:count meses',
+ 'week' => '1 semana|:count semanas',
+ 'w' => '1 semana|:count semanas',
+ 'day' => '1 dia|:count dias',
+ 'd' => '1 dia|:count dias',
+ 'hour' => '1 hora|:count horas',
+ 'h' => '1 hora|:count horas',
+ 'minute' => '1 minuto|:count minutos',
+ 'min' => '1 minuto|:count minutos',
+ 'second' => '1 segundo|:count segundos',
+ 's' => '1 segundo|:count segundos',
+ 'ago' => 'há :time',
+ 'from_now' => 'em :time',
+ 'after' => 'após :time',
+ 'before' => ':time atrás',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ro.php b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php
new file mode 100644
index 0000000..cc16724
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ro.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => 'un an|:count ani|:count ani',
+ 'y' => 'un an|:count ani|:count ani',
+ 'month' => 'o lunÄ|:count luni|:count luni',
+ 'm' => 'o lunÄ|:count luni|:count luni',
+ 'week' => 'o sÄptÄmânÄ|:count sÄptÄmâni|:count sÄptÄmâni',
+ 'w' => 'o sÄptÄmânÄ|:count sÄptÄmâni|:count sÄptÄmâni',
+ 'day' => 'o zi|:count zile|:count zile',
+ 'd' => 'o zi|:count zile|:count zile',
+ 'hour' => 'o orÄ|:count ore|:count ore',
+ 'h' => 'o orÄ|:count ore|:count ore',
+ 'minute' => 'un minut|:count minute|:count minute',
+ 'min' => 'un minut|:count minute|:count minute',
+ 'second' => 'o secundÄ|:count secunde|:count secunde',
+ 's' => 'o secundÄ|:count secunde|:count secunde',
+ 'ago' => 'acum :time',
+ 'from_now' => ':time de acum',
+ 'after' => 'peste :time',
+ 'before' => 'acum :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php
new file mode 100644
index 0000000..680cbdc
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count год|:count года|:count леÑ',
+ 'y' => ':count год|:count года|:count леÑ',
+ 'month' => ':count меÑÑÑ|:count меÑÑÑа|:count меÑÑÑев',
+ 'm' => ':count меÑÑÑ|:count меÑÑÑа|:count меÑÑÑев',
+ 'week' => ':count неделÑ|:count недели|:count неделÑ',
+ 'w' => ':count неделÑ|:count недели|:count неделÑ',
+ 'day' => ':count денÑ|:count днÑ|:count дней',
+ 'd' => ':count денÑ|:count днÑ|:count дней',
+ 'hour' => ':count ÑаÑ|:count ÑаÑа|:count ÑаÑов',
+ 'h' => ':count ÑаÑ|:count ÑаÑа|:count ÑаÑов',
+ 'minute' => ':count минÑÑÑ|:count минÑÑÑ|:count минÑÑ',
+ 'min' => ':count минÑÑÑ|:count минÑÑÑ|:count минÑÑ',
+ 'second' => ':count ÑекÑндÑ|:count ÑекÑндÑ|:count ÑекÑнд',
+ 's' => ':count ÑекÑндÑ|:count ÑекÑндÑ|:count ÑекÑнд',
+ 'ago' => ':time назад',
+ 'from_now' => 'ÑеÑез :time',
+ 'after' => ':time поÑле',
+ 'before' => ':time до',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php
new file mode 100644
index 0000000..45c8f76
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sk.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => 'rok|:count roky|:count rokov',
+ 'y' => 'rok|:count roky|:count rokov',
+ 'month' => 'mesiac|:count mesiace|:count mesiacov',
+ 'm' => 'mesiac|:count mesiace|:count mesiacov',
+ 'week' => 'týždeÅ|:count týždne|:count týždÅov',
+ 'w' => 'týždeÅ|:count týždne|:count týždÅov',
+ 'day' => 'deÅ|:count dni|:count dnÃ',
+ 'd' => 'deÅ|:count dni|:count dnÃ',
+ 'hour' => 'hodinu|:count hodiny|:count hodÃn',
+ 'h' => 'hodinu|:count hodiny|:count hodÃn',
+ 'minute' => 'minútu|:count minúty|:count minút',
+ 'min' => 'minútu|:count minúty|:count minút',
+ 'second' => 'sekundu|:count sekundy|:count sekúnd',
+ 's' => 'sekundu|:count sekundy|:count sekúnd',
+ 'ago' => 'pred :time',
+ 'from_now' => 'za :time',
+ 'after' => ':time neskôr',
+ 'before' => ':time predtým',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php
new file mode 100644
index 0000000..fcef085
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count leto|:count leti|:count leta|:count let',
+ 'y' => ':count leto|:count leti|:count leta|:count let',
+ 'month' => ':count mesec|:count meseca|:count mesece|:count mesecev',
+ 'm' => ':count mesec|:count meseca|:count mesece|:count mesecev',
+ 'week' => ':count teden|:count tedna|:count tedne|:count tednov',
+ 'w' => ':count teden|:count tedna|:count tedne|:count tednov',
+ 'day' => ':count dan|:count dni|:count dni|:count dni',
+ 'd' => ':count dan|:count dni|:count dni|:count dni',
+ 'hour' => ':count uro|:count uri|:count ure|:count ur',
+ 'h' => ':count uro|:count uri|:count ure|:count ur',
+ 'minute' => ':count minuto|:count minuti|:count minute|:count minut',
+ 'min' => ':count minuto|:count minuti|:count minute|:count minut',
+ 'second' => ':count sekundo|:count sekundi|:count sekunde|:count sekund',
+ 's' => ':count sekundo|:count sekundi|:count sekunde|:count sekund',
+ 'year_ago' => ':count letom|:count leti|:count leti|:count leti',
+ 'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci',
+ 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni',
+ 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi',
+ 'hour_ago' => ':count uro|:count urama|:count urami|:count urami',
+ 'minute_ago' => ':count minuto|:count minutama|:count minutami|:count minutami',
+ 'second_ago' => ':count sekundo|:count sekundama|:count sekundami|:count sekundami',
+ 'ago' => 'pred :time',
+ 'from_now' => 'Äez :time',
+ 'after' => 'Äez :time',
+ 'before' => 'pred :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sq.php b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php
new file mode 100644
index 0000000..41be251
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sq.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 vit|:count vjet',
+ 'y' => '1 vit|:count vjet',
+ 'month' => '1 muaj|:count muaj',
+ 'm' => '1 muaj|:count muaj',
+ 'week' => '1 javë|:count javë',
+ 'w' => '1 javë|:count javë',
+ 'day' => '1 ditë|:count ditë',
+ 'd' => '1 ditë|:count ditë',
+ 'hour' => '1 orë|:count orë',
+ 'h' => '1 orë|:count orë',
+ 'minute' => '1 minutë|:count minuta',
+ 'min' => '1 minutë|:count minuta',
+ 'second' => '1 sekondë|:count sekonda',
+ 's' => '1 sekondë|:count sekonda',
+ 'ago' => ':time më parë',
+ 'from_now' => ':time nga tani',
+ 'after' => ':time pas',
+ 'before' => ':time para',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php
new file mode 100644
index 0000000..70915a2
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count godina|:count godine|:count godina',
+ 'y' => ':count godina|:count godine|:count godina',
+ 'month' => ':count mesec|:count meseca|:count meseci',
+ 'm' => ':count mesec|:count meseca|:count meseci',
+ 'week' => ':count nedelja|:count nedelje|:count nedelja',
+ 'w' => ':count nedelja|:count nedelje|:count nedelja',
+ 'day' => ':count dan|:count dana|:count dana',
+ 'd' => ':count dan|:count dana|:count dana',
+ 'hour' => ':count sat|:count sata|:count sati',
+ 'h' => ':count sat|:count sata|:count sati',
+ 'minute' => ':count minut|:count minuta |:count minuta',
+ 'min' => ':count minut|:count minuta |:count minuta',
+ 'second' => ':count sekund|:count sekunde|:count sekunde',
+ 's' => ':count sekund|:count sekunde|:count sekunde',
+ 'ago' => 'pre :time',
+ 'from_now' => ':time od sada',
+ 'after' => 'nakon :time',
+ 'before' => 'pre :time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php
new file mode 100644
index 0000000..9b67838
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година',
+ 'y' => ':count г.',
+ 'month' => '{1} :count мÑеÑеÑ|{2,3,4}:count мÑеÑеÑа|[5,Inf[ :count мÑеÑеÑи',
+ 'm' => ':count мÑ.',
+ 'week' => '{1} :count недÑеÑа|{2,3,4}:count недÑеÑе|[5,Inf[ :count недÑеÑа',
+ 'w' => ':count нед.',
+ 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана',
+ 'd' => ':count д.',
+ 'hour' => '{1,21} :count ÑаÑ|{2,3,4,22,23,24}:count ÑаÑа|[5,Inf[ :count ÑаÑи',
+ 'h' => ':count Ñ.',
+ 'minute' => '{1,21,31,41,51} :count минÑÑ|[2,Inf[ :count минÑÑа',
+ 'min' => ':count мин.',
+ 'second' => '{1,21,31,41,51} :count ÑекÑнд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count ÑекÑнде|[5,Inf[:count ÑекÑнди',
+ 's' => ':count Ñек.',
+ 'ago' => 'пÑиÑе :time',
+ 'from_now' => 'за :time',
+ 'after' => ':time након',
+ 'before' => ':time пÑиÑе',
+
+ 'year_from_now' => '{1,21,31,41,51} :count годинÑ|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година',
+ 'year_ago' => '{1,21,31,41,51} :count годинÑ|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count године|[5,Inf[ :count година',
+
+ 'week_from_now' => '{1} :count недÑеÑÑ|{2,3,4} :count недÑеÑе|[5,Inf[ :count недÑеÑа',
+ 'week_ago' => '{1} :count недÑеÑÑ|{2,3,4} :count недÑеÑе|[5,Inf[ :count недÑеÑа',
+
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php
new file mode 100644
index 0000000..d0aaee3
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina',
+ 'y' => ':count g.',
+ 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci',
+ 'm' => ':count mj.',
+ 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja',
+ 'w' => ':count ned.',
+ 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana',
+ 'd' => ':count d.',
+ 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati',
+ 'h' => ':count Ä.',
+ 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta',
+ 'min' => ':count min.',
+ 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi',
+ 's' => ':count sek.',
+ 'ago' => 'prije :time',
+ 'from_now' => 'za :time',
+ 'after' => ':time nakon',
+ 'before' => ':time prije',
+
+ 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina',
+ 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina',
+
+ 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja',
+ 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja',
+
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php
new file mode 100644
index 0000000..d0aaee3
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_ME.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina',
+ 'y' => ':count g.',
+ 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci',
+ 'm' => ':count mj.',
+ 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja',
+ 'w' => ':count ned.',
+ 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana',
+ 'd' => ':count d.',
+ 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati',
+ 'h' => ':count Ä.',
+ 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta',
+ 'min' => ':count min.',
+ 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi',
+ 's' => ':count sek.',
+ 'ago' => 'prije :time',
+ 'from_now' => 'za :time',
+ 'after' => ':time nakon',
+ 'before' => ':time prije',
+
+ 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina',
+ 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina',
+
+ 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja',
+ 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja',
+
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php
new file mode 100644
index 0000000..6bebf7b
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/sv.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 år|:count år',
+ 'y' => '1 år|:count år',
+ 'month' => '1 månad|:count månader',
+ 'm' => '1 månad|:count månader',
+ 'week' => '1 vecka|:count veckor',
+ 'w' => '1 vecka|:count veckor',
+ 'day' => '1 dag|:count dagar',
+ 'd' => '1 dag|:count dagar',
+ 'hour' => '1 timme|:count timmar',
+ 'h' => '1 timme|:count timmar',
+ 'minute' => '1 minut|:count minuter',
+ 'min' => '1 minut|:count minuter',
+ 'second' => '1 sekund|:count sekunder',
+ 's' => '1 sekund|:count sekunder',
+ 'ago' => ':time sedan',
+ 'from_now' => 'om :time',
+ 'after' => ':time efter',
+ 'before' => ':time före',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/th.php b/vendor/nesbot/carbon/src/Carbon/Lang/th.php
new file mode 100644
index 0000000..c4c402e
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/th.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => '1 à¸à¸µ|:count à¸à¸µ',
+ 'y' => '1 à¸à¸µ|:count à¸à¸µ',
+ 'month' => '1 à¹à¸à¸·à¸à¸|:count à¹à¸à¸·à¸à¸',
+ 'm' => '1 à¹à¸à¸·à¸à¸|:count à¹à¸à¸·à¸à¸',
+ 'week' => '1 สัà¸à¸à¸²à¸«à¹|:count สัà¸à¸à¸²à¸«à¹',
+ 'w' => '1 สัà¸à¸à¸²à¸«à¹|:count สัà¸à¸à¸²à¸«à¹',
+ 'day' => '1 วัà¸|:count วัà¸',
+ 'd' => '1 วัà¸|:count วัà¸',
+ 'hour' => '1 à¸à¸±à¹à¸§à¹à¸¡à¸|:count à¸à¸±à¹à¸§à¹à¸¡à¸',
+ 'h' => '1 à¸à¸±à¹à¸§à¹à¸¡à¸|:count à¸à¸±à¹à¸§à¹à¸¡à¸',
+ 'minute' => '1 à¸à¸²à¸à¸µ|:count à¸à¸²à¸à¸µ',
+ 'min' => '1 à¸à¸²à¸à¸µ|:count à¸à¸²à¸à¸µ',
+ 'second' => '1 วิà¸à¸²à¸à¸µ|:count วิà¸à¸²à¸à¸µ',
+ 's' => '1 วิà¸à¸²à¸à¸µ|:count วิà¸à¸²à¸à¸µ',
+ 'ago' => ':time à¸à¸µà¹à¹à¸¥à¹à¸§',
+ 'from_now' => ':time à¸à¸²à¸à¸à¸µà¹',
+ 'after' => 'หลัà¸:time',
+ 'before' => 'à¸à¹à¸à¸:time',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/tr.php b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php
new file mode 100644
index 0000000..6a9dfed
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/tr.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count yıl',
+ 'y' => ':count yıl',
+ 'month' => ':count ay',
+ 'm' => ':count ay',
+ 'week' => ':count hafta',
+ 'w' => ':count hafta',
+ 'day' => ':count gün',
+ 'd' => ':count gün',
+ 'hour' => ':count saat',
+ 'h' => ':count saat',
+ 'minute' => ':count dakika',
+ 'min' => ':count dakika',
+ 'second' => ':count saniye',
+ 's' => ':count saniye',
+ 'ago' => ':time önce',
+ 'from_now' => ':time sonra',
+ 'after' => ':time sonra',
+ 'before' => ':time önce',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php
new file mode 100644
index 0000000..aeebca3
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count ÑÑк|:count Ñоки|:count ÑокÑв',
+ 'y' => ':count ÑÑк|:count Ñоки|:count ÑокÑв',
+ 'month' => ':count мÑÑÑÑÑ|:count мÑÑÑÑÑ|:count мÑÑÑÑÑв',
+ 'm' => ':count мÑÑÑÑÑ|:count мÑÑÑÑÑ|:count мÑÑÑÑÑв',
+ 'week' => ':count ÑижденÑ|:count ÑижнÑ|:count ÑижнÑв',
+ 'w' => ':count ÑижденÑ|:count ÑижнÑ|:count ÑижнÑв',
+ 'day' => ':count денÑ|:count днÑ|:count днÑв',
+ 'd' => ':count денÑ|:count днÑ|:count днÑв',
+ 'hour' => ':count година|:count години|:count годин',
+ 'h' => ':count година|:count години|:count годин',
+ 'minute' => ':count Ñ
вилинÑ|:count Ñ
вилини|:count Ñ
вилин',
+ 'min' => ':count Ñ
вилинÑ|:count Ñ
вилини|:count Ñ
вилин',
+ 'second' => ':count ÑекÑндÑ|:count ÑекÑнди|:count ÑекÑнд',
+ 's' => ':count ÑекÑндÑ|:count ÑекÑнди|:count ÑекÑнд',
+ 'ago' => ':time назад',
+ 'from_now' => 'ÑеÑез :time',
+ 'after' => ':time пÑÑлÑ',
+ 'before' => ':time до',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ur.php b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php
new file mode 100644
index 0000000..3c5f7ed
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/ur.php
@@ -0,0 +1,24 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count ساÙ',
+ 'month' => ':count Ù
اÙ',
+ 'week' => ':count ÛÙØªÛ',
+ 'day' => ':count Ø±ÙØ²',
+ 'hour' => ':count Ú¯Ú¾ÙÙ¹Û',
+ 'minute' => ':count Ù
ÙÙ¹',
+ 'second' => ':count سÛÚ©ÙÚ',
+ 'ago' => ':time Ù¾ÛÙÛ',
+ 'from_now' => ':time بعد',
+ 'after' => ':time بعد',
+ 'before' => ':time Ù¾ÛÙÛ',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uz.php b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php
new file mode 100644
index 0000000..c997f29
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/uz.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count yil|:count yil|:count yil',
+ 'y' => ':count yil|:count yil|:count yil',
+ 'month' => ':count oy|:count oy|:count oylar',
+ 'm' => ':count oy|:count oy|:count oylar',
+ 'week' => ':count hafta|:count hafta|:count hafta',
+ 'w' => ':count hafta|:count hafta|:count hafta',
+ 'day' => ':count kun|:count kun|:count kun',
+ 'd' => ':count kun|:count kun|:count kun',
+ 'hour' => ':count soat|:count soat|:count soat',
+ 'h' => ':count soat|:count soat|:count soat',
+ 'minute' => ':count minut|:count minut|:count minut',
+ 'min' => ':count minut|:count minut|:count minut',
+ 'second' => ':count sekund|:count sekund|:count sekund',
+ 's' => ':count sekund|:count sekund|:count sekund',
+ 'ago' => ':time avval',
+ 'from_now' => ':time keyin',
+ 'after' => ':time keyin',
+ 'before' => ':time oldin',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/vi.php b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php
new file mode 100644
index 0000000..3f9838d
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/vi.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count nÄm',
+ 'y' => ':count nÄm',
+ 'month' => ':count tháng',
+ 'm' => ':count tháng',
+ 'week' => ':count tuần',
+ 'w' => ':count tuần',
+ 'day' => ':count ngà y',
+ 'd' => ':count ngà y',
+ 'hour' => ':count giá»',
+ 'h' => ':count giá»',
+ 'minute' => ':count phút',
+ 'min' => ':count phút',
+ 'second' => ':count giây',
+ 's' => ':count giây',
+ 'ago' => ':time trưá»c',
+ 'from_now' => ':time từ bây giá»',
+ 'after' => ':time sau',
+ 'before' => ':time trưá»c',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php
new file mode 100644
index 0000000..9e1f6ca
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':countå¹´',
+ 'y' => ':countå¹´',
+ 'month' => ':count个æ',
+ 'm' => ':count个æ',
+ 'week' => ':countå¨',
+ 'w' => ':countå¨',
+ 'day' => ':count天',
+ 'd' => ':count天',
+ 'hour' => ':countå°æ¶',
+ 'h' => ':countå°æ¶',
+ 'minute' => ':countåé',
+ 'min' => ':countåé',
+ 'second' => ':countç§',
+ 's' => ':countç§',
+ 'ago' => ':timeå',
+ 'from_now' => 'è·ç°å¨:time',
+ 'after' => ':timeå',
+ 'before' => ':timeå',
+);
diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php
new file mode 100644
index 0000000..6c1d417
--- /dev/null
+++ b/vendor/nesbot/carbon/src/Carbon/Lang/zh_TW.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+return array(
+ 'year' => ':count å¹´',
+ 'y' => ':count å¹´',
+ 'month' => ':count æ',
+ 'm' => ':count æ',
+ 'week' => ':count å¨',
+ 'w' => ':count å¨',
+ 'day' => ':count 天',
+ 'd' => ':count 天',
+ 'hour' => ':count å°æ',
+ 'h' => ':count å°æ',
+ 'minute' => ':count åé',
+ 'min' => ':count åé',
+ 'second' => ':count ç§',
+ 's' => ':count ç§',
+ 'ago' => ':timeå',
+ 'from_now' => 'è·ç¾å¨ :time',
+ 'after' => ':timeå¾',
+ 'before' => ':timeå',
+);
diff --git a/vendor/squizlabs/php_codesniffer/.gitattributes b/vendor/squizlabs/php_codesniffer/.gitattributes
new file mode 100644
index 0000000..56dcc5d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/.gitattributes
@@ -0,0 +1,5 @@
+.travis.yml export-ignore
+package.xml export-ignore
+phpunit.xml.dist export-ignore
+php5-testingConfig.ini export-ignore
+php7-testingConfig.ini export-ignore
diff --git a/vendor/squizlabs/php_codesniffer/.gitignore b/vendor/squizlabs/php_codesniffer/.gitignore
new file mode 100644
index 0000000..9965895
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/.gitignore
@@ -0,0 +1,6 @@
+/CodeSniffer.conf
+/phpcs.xml
+/phpunit.xml
+.idea/*
+/vendor/
+composer.lock
diff --git a/vendor/squizlabs/php_codesniffer/CONTRIBUTING.md b/vendor/squizlabs/php_codesniffer/CONTRIBUTING.md
new file mode 100644
index 0000000..5cc7363
--- /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 0000000..62dc395
--- /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 0000000..d2288a5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/README.md
@@ -0,0 +1,71 @@
+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.
+
+[](https://travis-ci.org/squizlabs/PHP_CodeSniffer) [](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer)
+
+[](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.
+
+Installation
+------------
+
+The easiest way to get started with PHP\_CodeSniffer is to download the [Phar](http://php.net/manual/en/intro.phar.php) files for each of the commands:
+
+ curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
+ php phpcs.phar -h
+
+ curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
+ php phpcbf.phar -h
+
+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:
+
+ pear install PHP_CodeSniffer
+
+If you prefer using [Composer](http://getcomposer.org/) you can easily install PHP_CodeSniffer system-wide with the following command:
+
+ 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:
+
+ ./vendor/bin/phpcs -h
+ ./vendor/bin/phpcbf -h
+
+You can also download the PHP\_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:
+
+ git clone https://github.com/squizlabs/PHP_CodeSniffer.git
+ cd PHP_CodeSniffer
+ php bin/phpcs -h
+ php bin/phpcbf -h
+
+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.
diff --git a/vendor/squizlabs/php_codesniffer/autoload.php b/vendor/squizlabs/php_codesniffer/autoload.php
new file mode 100644
index 0000000..f918a1b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/autoload.php
@@ -0,0 +1,288 @@
+
+ * @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 = array();
+
+ /**
+ * A mapping of class names to file names.
+ *
+ * @var array
+ */
+ private static $loadedFiles = array();
+
+ /**
+ * A list of additional directories to search during autoloading.
+ *
+ * This is typically a list of coding standard directories.
+ *
+ * @var string[]
+ */
+ private static $searchPaths = array();
+
+
+ /**
+ * 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];
+ }
+
+ $classes = get_declared_classes();
+ $interfaces = get_declared_interfaces();
+ $traits = get_declared_traits();
+
+ include $path;
+
+ $className = null;
+ $newClasses = array_reverse(array_diff(get_declared_classes(), $classes));
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+
+ if ($className === null) {
+ $newClasses = array_reverse(array_diff(get_declared_interfaces(), $interfaces));
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+ }
+
+ if ($className === null) {
+ $newClasses = array_reverse(array_diff(get_declared_traits(), $traits));
+ foreach ($newClasses as $name) {
+ if (isset(self::$loadedFiles[$name]) === false) {
+ $className = $name;
+ break;
+ }
+ }
+ }
+
+ self::$loadedClasses[$path] = $className;
+ self::$loadedFiles[$className] = $path;
+ return self::$loadedClasses[$path];
+
+ }//end loadFile()
+
+
+ /**
+ * 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()
+
+
+ /**
+ * 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 0000000..45b43f4
--- /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 0000000..d2d0592
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcbf.bat
@@ -0,0 +1,14 @@
+@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 "%PHPBIN%" == "" set PHPBIN=@php_bin@
+if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
+GOTO RUN
+:USE_PEAR_PATH
+set PHPBIN=%PHP_PEAR_PHP_BIN%
+:RUN
+"%PHPBIN%" "@bin_dir@\phpcbf" %*
diff --git a/vendor/squizlabs/php_codesniffer/bin/phpcs b/vendor/squizlabs/php_codesniffer/bin/phpcs
new file mode 100755
index 0000000..52d28cd
--- /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 0000000..a8442e0
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
@@ -0,0 +1,14 @@
+@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 "%PHPBIN%" == "" set PHPBIN=@php_bin@
+if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
+GOTO RUN
+:USE_PEAR_PATH
+set PHPBIN=%PHP_PEAR_PHP_BIN%
+:RUN
+"%PHPBIN%" "@bin_dir@\phpcs" %*
diff --git a/vendor/squizlabs/php_codesniffer/composer.json b/vendor/squizlabs/php_codesniffer/composer.json
new file mode 100644
index 0000000..fa62701
--- /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": "http://www.squizlabs.com/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"
+ },
+ "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 0000000..f95432c
--- /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 Squiz Pty Ltd 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.xml.dist b/vendor/squizlabs/php_codesniffer/phpcs.xml.dist
new file mode 100644
index 0000000..805f31d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/phpcs.xml.dist
@@ -0,0 +1,105 @@
+
+
+ The coding standard for PHP_CodeSniffer itself.
+
+ autoload.php
+ bin
+ src
+ tests
+
+ */Standards/*/Tests/*\.(inc|css|js)
+
+
+
+
+
+
+
+
+ error
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ error
+
+
+
+
+ error
+
+
+
+
+ tests/bootstrap.php
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/scripts/build-phar.php b/vendor/squizlabs/php_codesniffer/scripts/build-phar.php
new file mode 100644
index 0000000..ee01c83
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/scripts/build-phar.php
@@ -0,0 +1,96 @@
+#!/usr/bin/env php
+
+ * @author Greg Sherwood
+ * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ * @link http://pear.php.net/package/PHP_CodeSniffer
+ */
+
+error_reporting(E_ALL | E_STRICT);
+
+if (ini_get('phar.readonly') === '1') {
+ echo 'Unable to build, phar.readonly in php.ini is set to read only.'.PHP_EOL;
+ exit(1);
+}
+
+$scripts = array(
+ 'phpcs',
+ 'phpcbf',
+ );
+
+foreach ($scripts as $script) {
+ echo "Building $script phar".PHP_EOL;
+
+ $pharName = $script.'.phar';
+ $pharFile = getcwd().'/'.$pharName;
+ echo "\t=> $pharFile".PHP_EOL;
+ if (file_exists($pharFile) === true) {
+ echo "\t** file exists, removing **".PHP_EOL;
+ unlink($pharFile);
+ }
+
+ $phar = new Phar($pharFile, 0, $pharName);
+
+ /*
+ Add the files.
+ */
+
+ echo "\t=> adding files... ";
+
+ $srcDir = realpath(__DIR__.'/../src');
+ $srcDirLen = strlen($srcDir);
+
+ $rdi = new \RecursiveDirectoryIterator($srcDir, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
+ $di = new \RecursiveIteratorIterator($rdi, 0, \RecursiveIteratorIterator::CATCH_GET_CHILD);
+
+ foreach ($di as $file) {
+ $filename = $file->getFilename();
+
+ // Skip hidden files.
+ if (substr($filename, 0, 1) === '.') {
+ continue;
+ }
+
+ $fullpath = $file->getPathname();
+ if (strpos($fullpath, '/Tests/') !== false) {
+ continue;
+ }
+
+ $path = 'src'.substr($fullpath, $srcDirLen);
+
+ $phar->addFromString($path, php_strip_whitespace($fullpath));
+ }
+
+ // Add autoloader.
+ $phar->addFromString('autoload.php', php_strip_whitespace(realpath(__DIR__.'/../autoload.php')));
+
+ // Add licence file.
+ $phar->addFromString('licence.txt', php_strip_whitespace(realpath(__DIR__.'/../licence.txt')));
+
+ echo 'done'.PHP_EOL;
+
+ /*
+ Add the stub.
+ */
+
+ echo "\t=> adding stub... ";
+ $stub = '#!/usr/bin/env php'."\n";
+ $stub .= 'run'.$script.'();'."\n";
+ $stub .= 'exit($exitCode);'."\n";
+ $stub .= '__HALT_COMPILER();';
+ $phar->setStub($stub);
+
+ echo 'done'.PHP_EOL;
+}//end foreach
diff --git a/vendor/squizlabs/php_codesniffer/src/Config.php b/vendor/squizlabs/php_codesniffer/src/Config.php
new file mode 100644
index 0000000..62bda73
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Config.php
@@ -0,0 +1,1670 @@
+
+ * @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\Exceptions\DeepExitException;
+
+class Config
+{
+
+ /**
+ * The current version.
+ *
+ * @var string
+ */
+ const VERSION = '3.1.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.
+ *
+ * The list of settings are:
+ *
+ * string[] files The files and directories to check.
+ * string[] standards The standards being used for checking.
+ * 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
+ * bool interactive Enable interactive checking mode.
+ * bool parallel Check files in parallel.
+ * bool cache Enable the use of the file cache.
+ * bool cacheFile A file where the cache data should be written
+ * bool colors Display colours in output.
+ * bool explain Explain the coding standards.
+ * bool local Process local files in directories only (no recursion).
+ * bool showSources Show sniff source codes in report output.
+ * bool showProgress Show basic progress information while running.
+ * bool quiet Quiet mode; disables progress and verbose output.
+ * bool annotations Process @codingStandard annotations.
+ * int tabWidth How many spaces each tab is worth.
+ * string encoding The encoding of the files being checked.
+ * string[] sniffs The sniffs that should be used for checking.
+ * If empty, all sniffs in the supplied standards will be used.
+ * string[] exclude The sniffs that should be excluded from checking.
+ * If empty, all sniffs in the supplied standards will be used.
+ * string[] ignored Regular expressions used to ignore files and folders during checking.
+ * string reportFile A file where the report output should be written.
+ * string generator The documentation generator to use.
+ * string filter The filter to use for the run.
+ * string[] bootstrap One of more files to include before the run begins.
+ * 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.
+ * int errorSeverity The minimum severity an error must have to be displayed.
+ * int warningSeverity The minimum severity a warning must have to be displayed.
+ * bool recordErrors Record the content of error messages as well as error counts.
+ * string suffix A suffix to add to fixed files.
+ * string basepath A file system location to strip from the paths of files shown in reports.
+ * bool stdin Read content from STDIN instead of supplied files.
+ * string stdinContent Content passed directly to PHPCS on STDIN.
+ * string stdinPath The path to use for content passed on STDIN.
+ *
+ * array extensions File extensions that should be checked, and what tokenizer to use.
+ * E.g., array('inc' => 'PHP');
+ * 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.
+ *
+ * string[] unknown Any arguments gathered on the command line that are unknown to us.
+ * E.g., using `phpcs -c` will give array('c');
+ *
+ * @var array
+ */
+ private $settings = array(
+ '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 = array();
+
+ /**
+ * Command line values that the user has supplied directly.
+ *
+ * @var array
+ */
+ private $overriddenDefaults = array();
+
+ /**
+ * 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 = array();
+
+
+ /**
+ * Get the value of an inaccessible property.
+ *
+ * @param string $name The name of the property.
+ *
+ * @return mixed
+ * @throws 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 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' && preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1) {
+ $value = (int) $matches[1];
+ } else {
+ $value = (int) $value;
+ }
+ break;
+ case 'standards' :
+ $cleaned = array();
+
+ // 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=array(), $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;
+ }
+
+ $checkStdin = false;
+ if (empty($cliArgs) === true) {
+ $cliArgs = $_SERVER['argv'];
+ array_shift($cliArgs);
+ $checkStdin = true;
+ }
+
+ $this->restoreDefaults();
+ $this->setCommandLineValues($cliArgs);
+
+ if (isset($this->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 = array(
+ '.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 = array($default);
+ break(2);
+ }
+ }
+
+ $lastDir = $currentDir;
+ $currentDir = dirname($currentDir);
+ } while ($currentDir !== '.' && $currentDir !== $lastDir);
+ }//end if
+
+ // Check for content on STDIN.
+ if ($checkStdin === true) {
+ $handle = fopen('php://stdin', 'r');
+ if (stream_set_blocking($handle, false) === true) {
+ $fileContents = '';
+ while (($line = fgets($handle)) !== false) {
+ $fileContents .= $line;
+ usleep(10);
+ }
+
+ stream_set_blocking($handle, true);
+ fclose($handle);
+ if (trim($fileContents) !== '') {
+ $this->stdin = true;
+ $this->stdinContent = $fileContents;
+ $this->overriddenDefaults['stdin'] = true;
+ $this->overriddenDefaults['stdinContent'] = true;
+ }
+ }
+ }
+
+ }//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;
+ $this->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 array
+ */
+ public function restoreDefaults()
+ {
+ $this->files = array();
+ $this->standards = array('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 = array(
+ 'php' => 'PHP',
+ 'inc' => 'PHP',
+ 'js' => 'JS',
+ 'css' => 'CSS',
+ );
+ $this->sniffs = array();
+ $this->exclude = array();
+ $this->ignored = array();
+ $this->reportFile = null;
+ $this->generator = null;
+ $this->filter = null;
+ $this->bootstrap = array();
+ $this->basepath = null;
+ $this->reports = array('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 = array();
+
+ $standard = self::getConfigData('default_standard');
+ if ($standard !== null) {
+ $this->standards = explode(',', $standard);
+ }
+
+ $reportFormat = self::getConfigData('report_format');
+ if ($reportFormat !== null) {
+ $this->reports = array($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
+ */
+ 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++;
+ $this->overriddenDefaults['verbosity'] = true;
+ break;
+ case 'l' :
+ $this->local = true;
+ $this->overriddenDefaults['local'] = true;
+ break;
+ case 's' :
+ $this->showSources = true;
+ $this->overriddenDefaults['showSources'] = true;
+ break;
+ case 'a' :
+ $this->interactive = true;
+ $this->overriddenDefaults['interactive'] = true;
+ break;
+ case 'e':
+ $this->explain = true;
+ $this->overriddenDefaults['explain'] = true;
+ break;
+ case 'p' :
+ if ($this->quiet === true) {
+ // Ignore when quiet mode is enabled.
+ break;
+ }
+
+ $this->showProgress = true;
+ $this->overriddenDefaults['showProgress'] = true;
+ break;
+ case 'q' :
+ // Quiet mode disables a few other settings as well.
+ $this->quiet = true;
+ $this->showProgress = false;
+ $this->verbosity = 0;
+
+ $this->overriddenDefaults['quiet'] = true;
+ break;
+ case 'm' :
+ $this->recordErrors = false;
+ $this->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($this->overriddenDefaults['warningSeverity']) === false) {
+ $this->warningSeverity = 0;
+ $this->overriddenDefaults['warningSeverity'] = true;
+ }
+ break;
+ case 'w' :
+ if (isset($this->overriddenDefaults['warningSeverity']) === false) {
+ $this->warningSeverity = $this->errorSeverity;
+ $this->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
+ */
+ 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($this->overriddenDefaults['colors']) === true) {
+ break;
+ }
+
+ $this->colors = true;
+ $this->overriddenDefaults['colors'] = true;
+ break;
+ case 'no-colors':
+ if (isset($this->overriddenDefaults['colors']) === true) {
+ break;
+ }
+
+ $this->colors = false;
+ $this->overriddenDefaults['colors'] = true;
+ break;
+ case 'cache':
+ if (isset($this->overriddenDefaults['cache']) === true) {
+ break;
+ }
+
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
+ $this->cache = true;
+ $this->overriddenDefaults['cache'] = true;
+ }
+ break;
+ case 'no-cache':
+ if (isset($this->overriddenDefaults['cache']) === true) {
+ break;
+ }
+
+ $this->cache = false;
+ $this->overriddenDefaults['cache'] = true;
+ break;
+ case 'ignore-annotations':
+ if (isset($this->overriddenDefaults['annotations']) === true) {
+ break;
+ }
+
+ $this->annotations = false;
+ $this->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);
+ break;
+ default:
+ if (substr($arg, 0, 7) === 'sniffs=') {
+ if (isset($this->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;
+ $this->overriddenDefaults['sniffs'] = true;
+ } else if (substr($arg, 0, 8) === 'exclude=') {
+ if (isset($this->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;
+ $this->overriddenDefaults['exclude'] = true;
+ } else if (defined('PHP_CODESNIFFER_IN_TESTS') === false
+ && substr($arg, 0, 6) === 'cache='
+ ) {
+ if ((isset($this->overriddenDefaults['cache']) === true
+ && $this->cache === false)
+ || isset($this->overriddenDefaults['cacheFile']) === true
+ ) {
+ break;
+ }
+
+ // Turn caching on.
+ $this->cache = true;
+ $this->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
+
+ $this->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 = array();
+ 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);
+ $this->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($this->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));
+ }
+
+ $this->overriddenDefaults['stdinPath'] = true;
+ } else if (PHP_CODESNIFFER_CBF === false && substr($arg, 0, 12) === 'report-file=') {
+ if (isset($this->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 = 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);
+ }
+
+ if ($dir === '.') {
+ // Passed report file is a file in the current directory.
+ $this->reportFile = getcwd().'/'.basename($this->reportFile);
+ } else {
+ if ($dir{0} === '/') {
+ // An absolute path.
+ $dir = Util\Common::realpath($dir);
+ } else {
+ $dir = Util\Common::realpath(getcwd().'/'.$dir);
+ }
+
+ if ($dir !== false) {
+ // Report file path is relative.
+ $this->reportFile = $dir.'/'.basename($this->reportFile);
+ }
+ }
+ }//end if
+
+ $this->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($this->overriddenDefaults['reportWidth']) === true) {
+ break;
+ }
+
+ $this->reportWidth = substr($arg, 13);
+ $this->overriddenDefaults['reportWidth'] = true;
+ } else if (substr($arg, 0, 9) === 'basepath=') {
+ if (isset($this->overriddenDefaults['basepath']) === true) {
+ 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);
+ }
+
+ $this->overriddenDefaults['basepath'] = true;
+
+ 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 = array();
+
+ 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 = dirname($output);
+ if ($dir === '.') {
+ // Passed report file is a filename in the current directory.
+ $output = getcwd().'/'.basename($output);
+ } else {
+ if ($dir{0} === '/') {
+ // An absolute path.
+ $dir = Util\Common::realpath($dir);
+ } else {
+ $dir = Util\Common::realpath(getcwd().'/'.$dir);
+ }
+
+ if ($dir !== false) {
+ // Report file path is relative.
+ $output = $dir.'/'.basename($output);
+ }
+ }
+ }//end if
+ }//end if
+
+ $reports[$report] = $output;
+ } else {
+ // This is a single report.
+ if (isset($this->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($this->overriddenDefaults['reports']) === false) {
+ $this->reports = $reports;
+ } else {
+ $this->reports = array_merge($this->reports, $reports);
+ }
+
+ $this->overriddenDefaults['reports'] = true;
+ } else if (substr($arg, 0, 7) === 'filter=') {
+ if (isset($this->overriddenDefaults['filter']) === true) {
+ break;
+ }
+
+ $this->filter = substr($arg, 7);
+ $this->overriddenDefaults['filter'] = true;
+ } else if (substr($arg, 0, 9) === 'standard=') {
+ $standards = trim(substr($arg, 9));
+ if ($standards !== '') {
+ $this->standards = explode(',', $standards);
+ }
+
+ $this->overriddenDefaults['standards'] = true;
+ } else if (substr($arg, 0, 11) === 'extensions=') {
+ if (isset($this->overriddenDefaults['extensions']) === true) {
+ break;
+ }
+
+ $extensions = explode(',', substr($arg, 11));
+ $newExtensions = array();
+ 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;
+ $this->overriddenDefaults['extensions'] = true;
+ } else if (substr($arg, 0, 7) === 'suffix=') {
+ if (isset($this->overriddenDefaults['suffix']) === true) {
+ break;
+ }
+
+ $this->suffix = substr($arg, 7);
+ $this->overriddenDefaults['suffix'] = true;
+ } else if (substr($arg, 0, 9) === 'parallel=') {
+ if (isset($this->overriddenDefaults['parallel']) === true) {
+ break;
+ }
+
+ $this->parallel = max((int) substr($arg, 9), 1);
+ $this->overriddenDefaults['parallel'] = true;
+ } else if (substr($arg, 0, 9) === 'severity=') {
+ $this->errorSeverity = (int) substr($arg, 9);
+ $this->warningSeverity = $this->errorSeverity;
+ if (isset($this->overriddenDefaults['errorSeverity']) === false) {
+ $this->overriddenDefaults['errorSeverity'] = true;
+ }
+
+ if (isset($this->overriddenDefaults['warningSeverity']) === false) {
+ $this->overriddenDefaults['warningSeverity'] = true;
+ }
+ } else if (substr($arg, 0, 15) === 'error-severity=') {
+ if (isset($this->overriddenDefaults['errorSeverity']) === true) {
+ break;
+ }
+
+ $this->errorSeverity = (int) substr($arg, 15);
+ $this->overriddenDefaults['errorSeverity'] = true;
+ } else if (substr($arg, 0, 17) === 'warning-severity=') {
+ if (isset($this->overriddenDefaults['warningSeverity']) === true) {
+ break;
+ }
+
+ $this->warningSeverity = (int) substr($arg, 17);
+ $this->overriddenDefaults['warningSeverity'] = true;
+ } else if (substr($arg, 0, 7) === 'ignore=') {
+ if (isset($this->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;
+ $this->overriddenDefaults['ignored'] = true;
+ } else if (substr($arg, 0, 10) === 'generator='
+ && PHP_CODESNIFFER_CBF === false
+ ) {
+ if (isset($this->overriddenDefaults['generator']) === true) {
+ break;
+ }
+
+ $this->generator = substr($arg, 10);
+ $this->overriddenDefaults['generator'] = true;
+ } else if (substr($arg, 0, 9) === 'encoding=') {
+ if (isset($this->overriddenDefaults['encoding']) === true) {
+ break;
+ }
+
+ $this->encoding = strtolower(substr($arg, 9));
+ $this->overriddenDefaults['encoding'] = true;
+ } else if (substr($arg, 0, 10) === 'tab-width=') {
+ if (isset($this->overriddenDefaults['tabWidth']) === true) {
+ break;
+ }
+
+ $this->tabWidth = (int) substr($arg, 10);
+ $this->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
+ */
+ 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
+ */
+ 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 {
+ $files = $this->files;
+ $files[] = $file;
+ $this->files = $files;
+ $this->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=] - ...'.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 @codingStandard 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 ' 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 ' 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 ' Uses 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 ' (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=] - ...'.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 @codingStandard 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 ' 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 ' 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 ' 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 (array_key_exists($name, self::$executablePaths) === true) {
+ return self::$executablePaths[$name];
+ }
+
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ $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 RuntimeException If the config file can not be written.
+ */
+ public static function setConfigData($key, $value, $temp=false)
+ {
+ if ($temp === false) {
+ $path = '';
+ if (is_callable('\Phar::running') === true) {
+ $path = \Phar::running(false);
+ }
+
+ if ($path !== '') {
+ $configFile = dirname($path).'/CodeSniffer.conf';
+ } else {
+ $configFile = dirname(__DIR__).'/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()
+ */
+ 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).'/CodeSniffer.conf';
+ } else {
+ $configFile = dirname(__DIR__).'/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 = array();
+ return array();
+ }
+
+ if (is_readable($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 0000000..b144094
--- /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 0000000..4bb10bf
--- /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 \Exception
+{
+
+}//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 0000000..ceba00c
--- /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 0000000..b40feea
--- /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 !== null) {
+ 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;
+ }
+
+ return 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 0000000..4f14187
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/File.php
@@ -0,0 +1,2269 @@
+
+ * @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 absolute path to the file associated with this object.
+ *
+ * @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 string
+ */
+ 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;
+
+ /**
+ * 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 = array();
+
+ /**
+ * The errors raised from sniffs.
+ *
+ * @var array
+ * @see getErrors()
+ */
+ protected $errors = array();
+
+ /**
+ * The warnings raised from sniffs.
+ *
+ * @var array
+ * @see getWarnings()
+ */
+ protected $warnings = array();
+
+ /**
+ * The metrics recorded by sniffs.
+ *
+ * @var array
+ * @see getMetrics()
+ */
+ protected $metrics = array();
+
+ /**
+ * 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;
+
+ /**
+ * An array of sniffs that are being ignored.
+ *
+ * @var array
+ */
+ protected $ignoredListeners = array();
+
+ /**
+ * An array of message codes that are being ignored.
+ *
+ * @var array
+ */
+ protected $ignoredCodes = array();
+
+ /**
+ * An array of sniffs listening to this file's processing.
+ *
+ * @var \PHP_CodeSniffer\Sniffs\Sniff[]
+ */
+ protected $listeners = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+
+ /**
+ * 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->getIgnorePatterns();
+
+ }//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 = array();
+
+ 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 = array();
+ $this->warnings = array();
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+
+ $this->parse();
+
+ $this->fixer->startFile($this);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 2) {
+ echo "\t*** START TOKEN PROCESSING ***".PHP_EOL;
+ }
+
+ $foundCode = false;
+ $listenerIgnoreTo = array();
+ $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_DOC_COMMENT_TAG
+ || ($inTests === true && $token['code'] === T_INLINE_HTML))
+ ) {
+ if (strpos($token['content'], '@codingStandards') !== false) {
+ if (strpos($token['content'], '@codingStandardsIgnoreFile') !== false) {
+ // Ignoring the whole file, just a little late.
+ $this->errors = array();
+ $this->warnings = array();
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+ return;
+ } else if (strpos($token['content'], '@codingStandardsChangeSetting') !== false) {
+ $start = strpos($token['content'], '@codingStandardsChangeSetting');
+ $comment = substr($token['content'], ($start + 30));
+ $parts = explode(' ', $comment);
+ if ($parts >= 3) {
+ $sniffParts = explode('.', $parts[0]);
+ if ($sniffParts >= 3) {
+ // If the sniff code is not know 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
+ }//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 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
+
+ $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->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->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=array(),
+ $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=array(),
+ $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=array(),
+ $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=array(),
+ $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=array(),
+ $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=array(),
+ $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)
+ {
+ if (isset($this->tokenizer->ignoredLines[$line]) === true) {
+ return false;
+ }
+
+ $includeAll = true;
+ if ($this->configCache['cache'] === false
+ || $this->configCache['recordErrors'] === false
+ ) {
+ $includeAll = 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 = array($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 = array(
+ $sniffCode,
+ $parts[0].'.'.$parts[1].'.'.$parts[2],
+ $parts[0].'.'.$parts[1],
+ $parts[0],
+ );
+ }//end if
+
+ // 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']) === false)
+ || (empty($this->configCache['exclude']) === false
+ && in_array(strtolower($listenerCode), $this->configCache['exclude']) === 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.
+ foreach ($checkCodes as $checkCode) {
+ if (isset($this->configCache['ignorePatterns'][$checkCode]) === false) {
+ continue;
+ }
+
+ foreach ($this->configCache['ignorePatterns'][$checkCode] as $pattern => $type) {
+ // While there is support for a type of each pattern
+ // (absolute or relative) we don't actually support it here.
+ $replacements = array(
+ '\\,' => ',',
+ '*' => '.*',
+ );
+
+ // 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';
+ if (preg_match($pattern, $this->path) === 1) {
+ $this->ignoredCodes[$checkCode] = true;
+ return false;
+ }
+ }//end foreach
+ }//end foreach
+
+ $messageCount++;
+ if ($fixable === true) {
+ $this->fixableCount++;
+ }
+
+ if ($this->configCache['recordErrors'] === false
+ && $includeAll === false
+ ) {
+ return true;
+ }
+
+ // Work out the error message.
+ if (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] = array();
+ }
+
+ if (isset($messages[$line][$column]) === false) {
+ $messages[$line][$column] = array();
+ }
+
+ $messages[$line][$column][] = array(
+ '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()
+
+
+ /**
+ * Adds an warning to the warning stack.
+ *
+ * @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] = array('values' => array($value => 1));
+ } else {
+ 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 successes recorded.
+ *
+ * @return int
+ */
+ public function getSuccessCount()
+ {
+ return $this->successCount;
+
+ }//end getSuccessCount()
+
+
+ /**
+ * 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 names for classes, interfaces, traits, 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, 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
+ ) {
+ throw new RuntimeException('Token type "'.$this->tokens[$stackPtr]['type'].'" is not T_FUNCTION, T_CLASS, T_INTERFACE or T_TRAIT');
+ }
+
+ 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.
+ *
+ * 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.
+ * 'pass_by_reference' => boolean, // Is the variable passed by reference?
+ * 'variable_length' => boolean, // Is the param of variable length through use of `...` ?
+ * 'type_hint' => string, // The type hint for the variable.
+ * 'nullable_type' => boolean, // Is the variable using a nullable type?
+ * )
+ *
+ *
+ * Parameters with default values have an additional array index of
+ * 'default' with the value of the default as a string.
+ *
+ * @param int $stackPtr The position in the stack of the function token
+ * to acquire the parameters for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the specified $stackPtr is not of
+ * type T_FUNCTION or T_CLOSURE.
+ */
+ public function getMethodParameters($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
+ && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
+ ) {
+ throw new TokenizerException('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
+ }
+
+ $opener = $this->tokens[$stackPtr]['parenthesis_opener'];
+ $closer = $this->tokens[$stackPtr]['parenthesis_closer'];
+
+ $vars = array();
+ $currVar = null;
+ $paramStart = ($opener + 1);
+ $defaultStart = null;
+ $paramCount = 0;
+ $passByReference = false;
+ $variableLength = false;
+ $typeHint = '';
+ $nullableType = false;
+
+ 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'] + 1);
+ }
+ }
+
+ if (isset($this->tokens[$i]['bracket_opener']) === true) {
+ // Don't do this if it's the close parenthesis for the method.
+ if ($i !== $this->tokens[$i]['bracket_closer']) {
+ $i = ($this->tokens[$i]['bracket_closer'] + 1);
+ }
+ }
+
+ switch ($this->tokens[$i]['code']) {
+ case T_BITWISE_AND:
+ if ($defaultStart === null) {
+ $passByReference = true;
+ }
+ break;
+ case T_VARIABLE:
+ $currVar = $i;
+ break;
+ case T_ELLIPSIS:
+ $variableLength = true;
+ break;
+ case T_ARRAY_HINT:
+ case T_CALLABLE:
+ $typeHint .= $this->tokens[$i]['content'];
+ break;
+ case T_SELF:
+ case T_PARENT:
+ case T_STATIC:
+ // Self is valid, the others invalid, but were probably intended as type hints.
+ if (isset($defaultStart) === false) {
+ $typeHint .= $this->tokens[$i]['content'];
+ }
+ 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) {
+ $typeHint .= $this->tokens[$i]['content'];
+ }
+ break;
+ case T_NS_SEPARATOR:
+ // Part of a type hint or default value.
+ if ($defaultStart === null) {
+ $typeHint .= $this->tokens[$i]['content'];
+ }
+ break;
+ case T_NULLABLE:
+ if ($defaultStart === null) {
+ $nullableType = true;
+ $typeHint .= $this->tokens[$i]['content'];
+ }
+ 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;
+ }
+
+ $vars[$paramCount] = array();
+ $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]['pass_by_reference'] = $passByReference;
+ $vars[$paramCount]['variable_length'] = $variableLength;
+ $vars[$paramCount]['type_hint'] = $typeHint;
+ $vars[$paramCount]['nullable_type'] = $nullableType;
+
+ // Reset the vars, as we are about to process the next parameter.
+ $defaultStart = null;
+ $paramStart = ($i + 1);
+ $passByReference = false;
+ $variableLength = false;
+ $typeHint = '';
+ $nullableType = false;
+
+ $paramCount++;
+ break;
+ case T_EQUAL:
+ $defaultStart = ($i + 1);
+ break;
+ }//end switch
+ }//end for
+
+ return $vars;
+
+ }//end getMethodParameters()
+
+
+ /**
+ * Returns the visibility and implementation properties of a method.
+ *
+ * The format of the array is:
+ *
+ * array(
+ * 'scope' => 'public', // public protected or protected
+ * 'scope_specified' => true, // true is scope keyword was found.
+ * '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.
+ * );
+ *
+ *
+ * @param int $stackPtr The position in the stack of the function token to
+ * acquire the properties for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the specified position is not a
+ * T_FUNCTION token.
+ */
+ public function getMethodProperties($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_FUNCTION
+ && $this->tokens[$stackPtr]['code'] !== T_CLOSURE
+ ) {
+ throw new TokenizerException('$stackPtr must be of type T_FUNCTION or T_CLOSURE');
+ }
+
+ if ($this->tokens[$stackPtr]['code'] === T_FUNCTION) {
+ $valid = array(
+ 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 = array(
+ 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
+
+ return array(
+ 'scope' => $scope,
+ 'scope_specified' => $scopeSpecified,
+ 'is_abstract' => $isAbstract,
+ 'is_final' => $isFinal,
+ 'is_static' => $isStatic,
+ );
+
+ }//end getMethodProperties()
+
+
+ /**
+ * Returns the visibility and implementation properties of the class member
+ * variable found at the specified position in the stack.
+ *
+ * The format of the array is:
+ *
+ *
+ * array(
+ * 'scope' => 'public', // public protected or protected
+ * 'is_static' => false, // true if the static keyword was found.
+ * );
+ *
+ *
+ * @param int $stackPtr The position in the stack of the T_VARIABLE token to
+ * acquire the properties for.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\TokenizerException 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 TokenizerException('$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
+ ) {
+ // T_VARIABLEs in interfaces 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: interfaces may not include member vars';
+ $this->addWarning($error, $stackPtr, 'Internal.ParseError.InterfaceHasMemberVar');
+ return array();
+ }
+ } else {
+ throw new TokenizerException('$stackPtr is not a class member var');
+ }
+ }
+
+ $valid = array(
+ T_PUBLIC => T_PUBLIC,
+ T_PRIVATE => T_PRIVATE,
+ T_PROTECTED => T_PROTECTED,
+ T_STATIC => T_STATIC,
+ T_WHITESPACE => T_WHITESPACE,
+ T_COMMENT => T_COMMENT,
+ T_DOC_COMMENT => T_DOC_COMMENT,
+ T_VARIABLE => T_VARIABLE,
+ T_COMMA => T_COMMA,
+ );
+
+ $scope = 'public';
+ $scopeSpecified = 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_STATIC:
+ $isStatic = true;
+ break;
+ }
+ }//end for
+
+ return array(
+ 'scope' => $scope,
+ 'scope_specified' => $scopeSpecified,
+ 'is_static' => $isStatic,
+ );
+
+ }//end getMemberProperties()
+
+
+ /**
+ * Returns the visibility and implementation properties of a class.
+ *
+ * The format of the array 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\TokenizerException If the specified position is not a
+ * T_CLASS token.
+ */
+ public function getClassProperties($stackPtr)
+ {
+ if ($this->tokens[$stackPtr]['code'] !== T_CLASS) {
+ throw new TokenizerException('$stackPtr must be of type T_CLASS');
+ }
+
+ $valid = array(
+ 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 array(
+ '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) {
+ // 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
+ ) {
+ $params = $this->getMethodParameters($this->tokens[$lastBracket]['parenthesis_owner']);
+ foreach ($params as $param) {
+ $varToken = $tokenAfter;
+ if ($param['variable_length'] === true) {
+ $varToken = $this->findNext(
+ (Util\Tokens::$emptyTokens + array(T_ELLIPSIS)),
+ ($stackPtr + 1),
+ null,
+ true
+ );
+ }
+
+ if ($param['token'] === $varToken
+ && $param['pass_by_reference'] === true
+ ) {
+ // 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.
+ *
+ * @return string The token contents.
+ */
+ public function getTokensAsString($start, $length)
+ {
+ $str = '';
+ $end = ($start + $length);
+ if ($end > $this->numTokens) {
+ $end = $this->numTokens;
+ }
+
+ for ($i = $start; $i < $end; $i++) {
+ $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|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 $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 $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|bool
+ * @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|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 $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 $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|bool
+ * @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|array $ignore Token types that should not be considered stop points.
+ *
+ * @return int
+ */
+ public function findStartOfStatement($start, $ignore=null)
+ {
+ $endTokens = Util\Tokens::$blockOpeners;
+
+ $endTokens[T_COLON] = true;
+ $endTokens[T_COMMA] = true;
+ $endTokens[T_DOUBLE_ARROW] = true;
+ $endTokens[T_SEMICOLON] = true;
+ $endTokens[T_OPEN_TAG] = true;
+ $endTokens[T_CLOSE_TAG] = true;
+ $endTokens[T_OPEN_SHORT_ARRAY] = true;
+
+ if ($ignore !== null) {
+ $ignore = (array) $ignore;
+ foreach ($ignore as $code) {
+ if (isset($endTokens[$code]) === true) {
+ unset($endTokens[$code]);
+ }
+ }
+ }
+
+ $lastNotEmpty = $start;
+
+ for ($i = $start; $i >= 0; $i--) {
+ if (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']
+ ) {
+ // 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'];
+ }
+
+ 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|array $ignore Token types that should not be considered stop points.
+ *
+ * @return int
+ */
+ public function findEndOfStatement($start, $ignore=null)
+ {
+ $endTokens = array(
+ 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) {
+ if (isset($endTokens[$code]) === true) {
+ unset($endTokens[$code]);
+ }
+ }
+ }
+
+ $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'])
+ ) {
+ $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'];
+ }
+
+ 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|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 | bool
+ */
+ public function findFirstOnLine($types, $start, $exclude=false, $value=null)
+ {
+ if (is_array($types) === false) {
+ $types = array($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|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) {
+ // 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 $type The type of token to search for.
+ *
+ * @return int
+ */
+ public function getCondition($stackPtr, $type)
+ {
+ // 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'];
+ 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_closer']) === false) {
+ return false;
+ }
+
+ $classCloserIndex = $this->tokens[$stackPtr]['scope_closer'];
+ $extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classCloserIndex);
+ if (false === $extendsIndex) {
+ return false;
+ }
+
+ $find = array(
+ T_NS_SEPARATOR,
+ T_STRING,
+ T_WHITESPACE,
+ );
+
+ $end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, 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 implements.
+ *
+ * Returns FALSE on error or if there are no implemented interface names.
+ *
+ * @param int $stackPtr The stack position of the class.
+ *
+ * @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
+ ) {
+ 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 = array(
+ 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 0000000..c6b7d2b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
@@ -0,0 +1,246 @@
+
+ * @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\Util;
+use PHP_CodeSniffer\Ruleset;
+use PHP_CodeSniffer\Config;
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+
+class FileList implements \Iterator, \Countable
+{
+
+ /**
+ * A list of file paths that are included in the list.
+ *
+ * @var array
+ */
+ private $files = array();
+
+ /**
+ * 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 = array();
+
+
+ /**
+ * 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(array($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
+ */
+ 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 = \PHP_CodeSniffer\Autoload::loadFile($filename);
+ } else {
+ $filterClass = '\PHP_CodeSniffer\Filters\\'.$filterType;
+ }
+ }
+
+ return $filterClass;
+
+ }//end getFilterClass()
+
+
+ /**
+ * Rewind the iterator to the first file.
+ *
+ * @return void
+ */
+ function rewind()
+ {
+ reset($this->files);
+
+ }//end rewind()
+
+
+ /**
+ * Get the file that is currently being processed.
+ *
+ * @return \PHP_CodeSniffer\Files\File
+ */
+ function current()
+ {
+ $path = key($this->files);
+ if ($this->files[$path] === null) {
+ $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
+ */
+ function key()
+ {
+ return key($this->files);
+
+ }//end key()
+
+
+ /**
+ * Move forward to the next file.
+ *
+ * @return void
+ */
+ function next()
+ {
+ next($this->files);
+
+ }//end next()
+
+
+ /**
+ * Checks if current position is valid.
+ *
+ * @return boolean
+ */
+ function valid()
+ {
+ if (current($this->files) === false) {
+ return false;
+ }
+
+ return true;
+
+ }//end valid()
+
+
+ /**
+ * Return the number of files in the list.
+ *
+ * @return integer
+ */
+ 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 0000000..00ee2d6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
@@ -0,0 +1,210 @@
+
+ * @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;
+
+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 (is_readable($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', array(), 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) {
+ // We are ignoring the whole file.
+ $this->ignored = true;
+ return;
+ }
+ }
+ }
+
+ $this->reloadContent();
+
+ return parent::__construct($this->path, $ruleset, $config);
+
+ }//end __construct()
+
+
+ /**
+ * Loads the latest version of the file's content from the file system.
+ *
+ * @return void
+ */
+ 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) {
+ return parent::process();
+ }
+
+ $hash = md5_file($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 = array(
+ '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 = array();
+ $this->warnings = array();
+ $this->errorCount = 0;
+ $this->warningCount = 0;
+ $this->fixableCount = 0;
+
+ 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'],
+ array(),
+ $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'],
+ array(),
+ $error['severity'],
+ $error['fixable']
+ );
+ }
+ }
+ }
+
+ }//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 0000000..13af8ff
--- /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 0000000..61581e1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
@@ -0,0 +1,245 @@
+
+ * @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;
+
+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;
+
+
+ /**
+ * 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
+ */
+ public function accept()
+ {
+ $filePath = Util\Common::realpath($this->current());
+ if ($filePath === false) {
+ return false;
+ }
+
+ 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;
+ }
+
+ 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
+ */
+ public function getChildren()
+ {
+ $children = new static(
+ 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;
+ 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();
+ 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 = array();
+ $this->ignoreFilePatterns = array();
+
+ $ignorePatterns = array_merge($this->config->ignored, $this->ruleset->getIgnorePatterns());
+ foreach ($ignorePatterns as $pattern => $type) {
+ // If the ignore pattern ends with /* then it is ignoring an entire directory.
+ if (substr($pattern, -2) === '/*') {
+ $this->ignoreDirPatterns[substr($pattern, 0, -2)] = $type;
+ } else {
+ $this->ignoreFilePatterns[$pattern] = $type;
+ }
+ }
+ }
+
+ $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 = array(
+ '\\,' => ',',
+ '*' => '.*',
+ );
+
+ // 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 0000000..86512e2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Filters/GitModified.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\Filters;
+
+use PHP_CodeSniffer\Util;
+
+class GitModified extends ExactMatch
+{
+
+
+ /**
+ * Get a list of blacklisted file paths.
+ *
+ * @return array
+ */
+ protected function getBlacklist()
+ {
+ return array();
+
+ }//end getBlacklist()
+
+
+ /**
+ * Get a list of whitelisted file paths.
+ *
+ * @return array
+ */
+ protected function getWhitelist()
+ {
+ $modified = array();
+
+ $cmd = 'git ls-files -o -m --exclude-standard -- '.escapeshellarg($this->basedir);
+ $output = array();
+ exec($cmd, $output);
+
+ $basedir = $this->basedir;
+ if (is_dir($basedir) === false) {
+ $basedir = dirname($basedir);
+ }
+
+ foreach ($output as $path) {
+ $path = Util\Common::realpath($path);
+ 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 0000000..e16dc5f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Fixer.php
@@ -0,0 +1,728 @@
+
+ * @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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ $tokens = $phpcsFile->getTokens();
+ $this->tokens = array();
+ 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;
+ }
+
+ $stdin = false;
+ if (empty($this->currentFile->config->files) === true) {
+ $stdin = true;
+ }
+
+ $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 ($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 colored 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 ($colors === false) {
+ return $diff;
+ }
+
+ $diffLines = explode(PHP_EOL, $diff);
+ if (count($diffLines) === 1) {
+ // Seems to be required for cygwin.
+ $diffLines = explode("\n", $diff);
+ }
+
+ $diff = array();
+ 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();
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+
+ @ob_end_clean();
+ echo "\t=> Changeset started by $sniff (line $line)".PHP_EOL;
+ ob_start();
+ }
+
+ $this->changeset = array();
+ $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 = array();
+ 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 = array();
+
+ }//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'];
+ }
+
+ $numChanges = count($this->changeset);
+
+ @ob_end_clean();
+ echo "\t\tR: $sniff (line $line) rolled back the changeset ($numChanges changes)".PHP_EOL;
+ echo "\t=> Changeset rolled back".PHP_EOL;
+ ob_start();
+ }
+
+ $this->changeset = array();
+ }//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();
+ if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
+ $sniff = $bt[2]['class'];
+ $line = $bt[1]['line'];
+ } else {
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+ }
+
+ $tokens = $this->currentFile->getTokens();
+ $type = $tokens[$stackPtr]['type'];
+ $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 $line) replaced token $stackPtr ($type) \"$oldContent\" => \"$newContent\"".PHP_EOL;
+ ob_start();
+ }
+
+ return true;
+ }
+
+ if (isset($this->oldTokenValues[$stackPtr]) === false) {
+ $this->oldTokenValues[$stackPtr] = array(
+ '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 $line) has possible conflict with another sniff on loop $loop; caused by the following change ****".PHP_EOL;
+ echo "$indent**** replaced token $stackPtr ($type) \"$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 $line) replaced token $stackPtr ($type) \"$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();
+ if ($bt[1]['class'] === 'PHP_CodeSniffer\Fixer') {
+ $sniff = $bt[2]['class'];
+ $line = $bt[1]['line'];
+ } else {
+ $sniff = $bt[1]['class'];
+ $line = $bt[0]['line'];
+ }
+
+ $tokens = $this->currentFile->getTokens();
+ $type = $tokens[$stackPtr]['type'];
+ $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 $line) reverted token $stackPtr ($type) \"$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 chacters 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()
+
+
+}//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 0000000..ee5457a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
@@ -0,0 +1,119 @@
+
+ * @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;
+use PHP_CodeSniffer\Util\Common;
+
+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 = array();
+
+
+ /**
+ * 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;
+
+ $standardFiles = array();
+ 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 0000000..db26468
--- /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 ' Table of Contents
'.PHP_EOL;
+ echo ' '.PHP_EOL;
+
+ foreach ($this->docFiles as $file) {
+ $doc = new \DOMDocument();
+ $doc->load($file);
+ $documentation = $doc->getElementsByTagName('documentation')->item(0);
+ $title = $this->getTitle($documentation);
+ echo ' - $title
".PHP_EOL;
+ }
+
+ 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 " $content
".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');
+
+ $firstTitle = $codeBlocks->item(0)->getAttribute('title');
+ $first = trim($codeBlocks->item(0)->nodeValue);
+ $first = str_replace('', $first);
+ $first = str_replace(' ', ' ', $first);
+ $first = str_replace('', '', $first);
+ $first = str_replace('', '', $first);
+
+ $secondTitle = $codeBlocks->item(1)->getAttribute('title');
+ $second = trim($codeBlocks->item(1)->nodeValue);
+ $second = str_replace('', $second);
+ $second = str_replace(' ', ' ', $second);
+ $second = str_replace('', '', $second);
+ $second = str_replace('', '', $second);
+
+ echo ' '.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo " $firstTitle | ".PHP_EOL;
+ echo " $secondTitle | ".PHP_EOL;
+ echo '
'.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo " $first | ".PHP_EOL;
+ echo " $second | ".PHP_EOL;
+ echo '
'.PHP_EOL;
+ echo '
'.PHP_EOL;
+
+ }//end printCodeComparisonBlock()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Generators/Markdown.php b/vendor/squizlabs/php_codesniffer/src/Generators/Markdown.php
new file mode 100644
index 0000000..b51b267
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/Markdown.php
@@ -0,0 +1,161 @@
+
+ * @copyright 2014 Arroba IT
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Generators;
+
+use PHP_CodeSniffer\Config;
+
+class Markdown extends Generator
+{
+
+
+ /**
+ * Generates the documentation for a standard.
+ *
+ * @return void
+ * @see processSniff()
+ */
+ public function generate()
+ {
+ ob_start();
+ $this->printHeader();
+
+ 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 markdown header.
+ *
+ * @return void
+ */
+ protected function printHeader()
+ {
+ $standard = $this->ruleset->name;
+
+ echo "# $standard Coding Standard".PHP_EOL;
+
+ }//end printHeader()
+
+
+ /**
+ * Print the markdown footer.
+ *
+ * @return void
+ */
+ protected function printFooter()
+ {
+ // Turn off errors so we don't get timezone warnings if people
+ // don't have their timezone set.
+ error_reporting(0);
+ echo 'Documentation generated on '.date('r');
+ echo ' by [PHP_CodeSniffer '.Config::VERSION.'](https://github.com/squizlabs/PHP_CodeSniffer)'.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
+ */
+ protected function processSniff(\DOMNode $doc)
+ {
+ $title = $this->getTitle($doc);
+ 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);
+
+ $content = str_replace('<em>', '*', $content);
+ $content = str_replace('</em>', '*', $content);
+
+ echo $content.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');
+
+ $firstTitle = $codeBlocks->item(0)->getAttribute('title');
+ $first = trim($codeBlocks->item(0)->nodeValue);
+ $first = str_replace("\n", "\n ", $first);
+ $first = str_replace('', '', $first);
+ $first = str_replace('', '', $first);
+
+ $secondTitle = $codeBlocks->item(1)->getAttribute('title');
+ $second = trim($codeBlocks->item(1)->nodeValue);
+ $second = str_replace("\n", "\n ", $second);
+ $second = str_replace('', '', $second);
+ $second = str_replace('', '', $second);
+
+ echo ' '.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo " $firstTitle | ".PHP_EOL;
+ echo " $secondTitle | ".PHP_EOL;
+ echo '
'.PHP_EOL;
+ echo ' '.PHP_EOL;
+ echo ''.PHP_EOL.PHP_EOL;
+ echo " $first".PHP_EOL.PHP_EOL;
+ echo ' | '.PHP_EOL;
+ echo ''.PHP_EOL.PHP_EOL;
+ echo " $second".PHP_EOL.PHP_EOL;
+ echo ' | '.PHP_EOL;
+ echo '
'.PHP_EOL;
+ 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 0000000..2ab33f2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Generators/Text.php
@@ -0,0 +1,245 @@
+
+ * @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);
+
+ $lines = array();
+ $tempLine = '';
+ $words = explode(' ', $text);
+
+ foreach ($words as $word) {
+ if (strlen($tempLine.$word) >= 99) {
+ if (strlen($tempLine.$word) === 99) {
+ // Adding the extra space will push us to the edge
+ // so we are done.
+ $lines[] = $tempLine.$word;
+ $tempLine = '';
+ } else if (strlen($tempLine.$word) === 100) {
+ // We are already at the edge, so we are done.
+ $lines[] = $tempLine.$word;
+ $tempLine = '';
+ } else {
+ $lines[] = rtrim($tempLine);
+ $tempLine = $word.' ';
+ }
+ } else {
+ $tempLine .= $word.' ';
+ }
+ }//end foreach
+
+ if ($tempLine !== '') {
+ $lines[] = rtrim($tempLine);
+ }
+
+ 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 = array();
+ $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 = array();
+ $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(' ', (47 - strlen($firstLineText)));
+ echo '| ';
+ echo $secondLineText.str_repeat(' ', (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 0000000..cfa5a97
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reporter.php
@@ -0,0 +1,401 @@
+
+ * @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\Reports\Report;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+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 = array();
+
+ /**
+ * A cache of opened temporary files.
+ *
+ * @var array
+ */
+ private $tmpFiles = array();
+
+
+ /**
+ * 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 RuntimeException If a report is not available.
+ */
+ public function __construct(Config $config)
+ {
+ $this->config = $config;
+
+ foreach ($config->reports as $type => $output) {
+ $type = ucfirst($type);
+
+ if ($output === null) {
+ $output = $config->reportFile;
+ }
+
+ 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 {
+ $reportClassName = 'PHP_CodeSniffer\Reports\\'.$type;
+ }
+
+ $reportClass = new $reportClassName();
+ if (false === ($reportClass instanceof Report)) {
+ throw new RuntimeException('Class "'.$reportClassName.'" must implement the "PHP_CodeSniffer\Report" interface.');
+ }
+
+ $this->reports[$type] = array(
+ '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)
+ {
+ $report = ucfirst($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);
+ } else {
+ $flags = FILE_APPEND;
+ file_put_contents($report['output'], $generatedReport, FILE_APPEND);
+ }//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 = array(
+ 'filename' => Common::stripBasepath($phpcsFile->getFilename(), $this->config->basepath),
+ 'errors' => $phpcsFile->getErrorCount(),
+ 'warnings' => $phpcsFile->getWarningCount(),
+ 'fixable' => $phpcsFile->getFixableCount(),
+ 'messages' => array(),
+ );
+
+ 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] = array(
+ array(
+ 'message' => $message,
+ 'source' => 'Internal.RecordErrors',
+ 'severity' => 5,
+ 'fixable' => false,
+ 'type' => 'ERROR',
+ ),
+ );
+ return $report;
+ }
+
+ $errors = array();
+
+ // Merge errors and warnings.
+ foreach ($phpcsFile->getErrors() as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ $newErrors = array();
+ foreach ($colErrors as $data) {
+ $newErrors[] = array(
+ '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 = array();
+ foreach ($colWarnings as $data) {
+ $newWarnings[] = array(
+ 'message' => $data['message'],
+ 'source' => $data['source'],
+ 'severity' => $data['severity'],
+ 'fixable' => $data['fixable'],
+ 'type' => 'WARNING',
+ );
+ }
+
+ if (isset($errors[$line]) === false) {
+ $errors[$line] = array();
+ }
+
+ 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 0000000..f9a2263
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php
@@ -0,0 +1,249 @@
+
+ * @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
+ */
+ 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";
+ }
+
+ $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 = array();
+ $maxLength = 0;
+ $totalFixed = 0;
+ $failures = 0;
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $fileLen = strlen($parts[0]);
+ $reportFiles[$parts[0]] = array(
+ '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 0000000..06a78e1
--- /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 0000000..0aaa768
--- /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 = array();
+ $lastLine = 0;
+ $stackPtr = 0;
+ foreach ($tokens as $stackPtr => $token) {
+ if ($token['line'] !== $lastLine) {
+ if ($lastLine > 0) {
+ $lineTokens[$lastLine]['end'] = ($stackPtr - 1);
+ }
+
+ $lastLine++;
+ $lineTokens[$lastLine] = array(
+ '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 (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ $tab = "\000";
+ } else {
+ $tab = "\033[30;1m»\033[0m";
+ }
+
+ $phpcsFile->tokenizer->replaceTabsInToken($token, $tab, "\000");
+ $tokenContent = $token['content'];
+ }
+
+ $tokenContent = Util\Common::prepareForOutput($tokenContent, array("\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 0000000..6db7ecf
--- /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 0000000..855f92f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
@@ -0,0 +1,131 @@
+
+ * @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 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) {
+ 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 0000000..3555f55
--- /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 0000000..10bbbe9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
@@ -0,0 +1,218 @@
+
+ * @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);
+ if ($showSources === true) {
+ // Account for the chars used to print colors.
+ $maxErrorSpace += 8;
+ }
+
+ foreach ($report['messages'] as $line => $lineErrors) {
+ foreach ($lineErrors as $column => $colErrors) {
+ foreach ($colErrors as $error) {
+ $message = $error['message'];
+ $message = str_replace("\n", "\n".$paddingLine2, $message);
+ if ($showSources === true) {
+ $message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
+ }
+
+ // The padding that goes on the front of the line.
+ $padding = ($maxLineNumLength - strlen($line));
+ $errorMsg = wordwrap(
+ $message,
+ $maxErrorSpace,
+ PHP_EOL.$paddingLine2
+ );
+
+ 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 0000000..33271f7
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Gitblame.php
@@ -0,0 +1,90 @@
+
+ * @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 = array();
+ $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
+ */
+ 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);
+ fclose($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 0000000..5bc255d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Hgblame.php
@@ -0,0 +1,109 @@
+
+ * @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 = array();
+ $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
+ */
+ protected function getBlameContent($filename)
+ {
+ $cwd = getcwd();
+
+ $fileParts = explode(DIRECTORY_SEPARATOR, $filename);
+ $found = false;
+ $location = '';
+ while (empty($fileParts) === false) {
+ array_pop($fileParts);
+ $location = implode($fileParts, DIRECTORY_SEPARATOR);
+ 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);
+ fclose($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 0000000..f932362
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Info.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\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 = array();
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $metric = $parts[0];
+ $value = $parts[1];
+ $count = $parts[2];
+ if (isset($metrics[$metric]) === false) {
+ $metrics[$metric] = array();
+ }
+
+ 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) {
+ $winner = '';
+ $winnerCount = 0;
+ $totalCount = 0;
+ foreach ($values as $value => $count) {
+ $totalCount += $count;
+ if ($count > $winnerCount) {
+ $winner = $value;
+ $winnerCount = $count;
+ }
+ }
+
+ $winPercent = round(($winnerCount / $totalCount * 100), 2);
+ echo "$metric: \033[4m$winner\033[0m [$winnerCount/$totalCount, $winPercent%]".PHP_EOL;
+
+ asort($values);
+ $values = array_reverse($values, true);
+ foreach ($values as $value => $count) {
+ if ($value === $winner) {
+ continue;
+ }
+
+ $percent = round(($count / $totalCount * 100), 2);
+ echo "\t$value => $count ($percent%)".PHP_EOL;
+ }
+
+ 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 0000000..3c41f8e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
@@ -0,0 +1,111 @@
+
+ * @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('\\', '\\\\', $error['message']);
+ $error['message'] = str_replace('"', '\"', $error['message']);
+ $error['message'] = str_replace('/', '\/', $error['message']);
+ $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';
+ }
+
+ $messages .= '{"message":"'.$error['message'].'",';
+ $messages .= '"source":"'.$error['source'].'",';
+ $messages .= '"severity":'.$error['severity'].',';
+ $messages .= '"type":"'.$error['type'].'",';
+ $messages .= '"line":'.$line.',';
+ $messages .= '"column":'.$column.',';
+ $messages .= '"fixable":'.$fixable;
+ $messages .= '},';
+ }//end foreach
+ }//end foreach
+ }//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 "}}";
+
+ }//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 0000000..d69cfce
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
@@ -0,0 +1,130 @@
+
+ * @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']);
+
+ 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 = array();
+ 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 0000000..9600188
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Notifysend.php
@@ -0,0 +1,241 @@
+
+ * @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;
+
+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 = escapeshellcmd($path);
+ }
+
+ $timeout = Config::getConfigData('notifysend_timeout');
+ if ($timeout !== null) {
+ $this->timeout = (int) $timeout;
+ }
+
+ $showOk = Config::getConfigData('notifysend_showok');
+ if ($showOk !== null) {
+ $this->showOk = (boolean) $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 0000000..38f8a62
--- /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 0000000..d50464f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Source.php
@@ -0,0 +1,337 @@
+
+ * @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 = array();
+
+ 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] = array(
+ '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 = array();
+ $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] = array(
+ 'count' => $count,
+ 'fixable' => $fixable,
+ 'parts' => $parts,
+ );
+ } else {
+ $sources[$source]['count'] += $count;
+ }//end if
+
+ $fileLen = strlen($parts[0]);
+ $reportFiles[$parts[0]] = array(
+ 'errors' => $parts[1],
+ 'warnings' => $parts[2],
+ 'strlen' => $fileLen,
+ );
+ }//end foreach
+
+ if ($showSources === true) {
+ $width = min($width, ($maxLength + 11));
+ } else {
+ $width = min($width, ($maxLength + 41));
+ }
+
+ $width = max($width, 70);
+
+ asort($sources);
+ $sources = array_reverse($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 0000000..13589f4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Summary.php
@@ -0,0 +1,162 @@
+
+ * @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 = array();
+ $maxLength = 0;
+
+ foreach ($lines as $line) {
+ $parts = explode('>>', $line);
+ $fileLen = strlen($parts[0]);
+ $reportFiles[$parts[0]] = array(
+ 'errors' => $parts[1],
+ 'warnings' => $parts[2],
+ 'strlen' => $fileLen,
+ );
+
+ $maxLength = max($maxLength, $fileLen);
+ }
+
+ $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 0000000..3c885a3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Svnblame.php
@@ -0,0 +1,72 @@
+
+ * @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 = array();
+ 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
+ */
+ 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);
+ fclose($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 0000000..612f4d5
--- /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 = array();
+ $praiseCache = array();
+ $sourceCache = array();
+
+ 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] = array(
+ '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] = array(
+ '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] = array(
+ '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 = array();
+ $praiseCache = array();
+ $sourceCache = array();
+
+ 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]] = array(
+ '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]] = array();
+ }
+
+ if (isset($sourceCache[$parts[1]][$parts[2]]) === false) {
+ $sourceCache[$parts[1]][$parts[2]] = array(
+ '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 0000000..fb763ab
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Reports/Xml.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\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);
+
+ 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();
+ 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
+ ) {
+ 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 0000000..91a0388
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Ruleset.php
@@ -0,0 +1,1308 @@
+
+ * @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\Util;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+
+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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * 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 = array();
+
+ /**
+ * The directories that the processed rulesets are in.
+ *
+ * @var string[]
+ */
+ protected $rulesetDirs = array();
+
+ /**
+ * 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
+ */
+ public function __construct(Config $config)
+ {
+ // Ignore sniff restrictions if caching is on.
+ $restrictions = array();
+ $exclusions = array();
+ if ($config->cache === false) {
+ $restrictions = $config->sniffs;
+ $exclusions = $config->exclude;
+ }
+
+ $this->config = $config;
+ $sniffs = array();
+
+ $standardPaths = array();
+ 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;
+ $this->paths[] = $standard;
+
+ // 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) {
+ // Unit tests use one standard and one sniff at a time.
+ try {
+ $sniffs = $this->expandRulesetReference($restrictions[0], 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
+
+ $sniffRestrictions = array();
+ foreach ($restrictions as $sniffCode) {
+ $parts = explode('.', strtolower($sniffCode));
+ $sniffName = $parts[0].'\sniffs\\'.$parts[1].'\\'.$parts[2].'sniff';
+ $sniffRestrictions[$sniffName] = true;
+ }
+
+ $sniffExclusions = array();
+ 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 RuntimeException If the ruleset path is invalid.
+ */
+ 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;
+ }
+
+ $ruleset = @simplexml_load_string(file_get_contents($rulesetPath));
+ if ($ruleset === false) {
+ throw new RuntimeException("Ruleset $rulesetPath is not valid");
+ }
+
+ $ownSniffs = array();
+ $includedSniffs = array();
+ $excludedSniffs = array();
+
+ $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);
+ }
+
+ // Included custom autoloaders.
+ foreach ($ruleset->{'autoload'} as $autoload) {
+ if ($this->shouldProcessElement($autoload) === false) {
+ continue;
+ }
+
+ $autoloadPath = (string) $autoload;
+ if (is_file($autoloadPath) === false) {
+ $autoloadPath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
+ }
+
+ if ($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) {
+ $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) === 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($exclude['name'], $rulesetDir, ($depth + 1))
+ );
+ }
+ }//end foreach
+ }//end if
+
+ $this->processRule($rule, $newSniffs, $depth);
+ }//end foreach
+
+ // Process custom command line arguments.
+ $cliArgs = array();
+ 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 = array();
+ foreach ($includedSniffs as $sniff) {
+ if (in_array($sniff, $excludedSniffs) === 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 = array();
+
+ $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 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 array();
+ }
+
+ // 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 array($ref);
+ }
+ } else {
+ // See if this is a whole standard being referenced.
+ $path = Util\Standards::getInstalledStandardPath($ref);
+ if (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 = $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 array($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 RuntimeException If rule settings are invalid.
+ */
+ private function processRule($rule, $newSniffs, $depth=0)
+ {
+ $ref = (string) $rule['ref'];
+ $todo = array($ref);
+
+ $parts = explode('.', $ref);
+ if (count($parts) <= 2) {
+ // We are processing a standard or a category of sniffs.
+ foreach ($newSniffs as $sniffFile) {
+ $parts = explode(DIRECTORY_SEPARATOR, $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] = array();
+ }
+
+ $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] = array();
+ }
+
+ $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] = array();
+ }
+
+ $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] = array(
+ 'properties' => array(),
+ );
+ } else if (isset($this->ruleset[$code]['properties']) === false) {
+ $this->ruleset[$code]['properties'] = array();
+ }
+
+ $name = (string) $prop['name'];
+ if (isset($prop['type']) === true
+ && (string) $prop['type'] === 'array'
+ ) {
+ $value = (string) $prop['value'];
+ $values = array();
+ foreach (explode(',', $value) as $val) {
+ $v = '';
+
+ list($k,$v) = explode('=>', $val.'=>');
+ if ($v !== '') {
+ $values[$k] = $v;
+ } else {
+ $values[] = $k;
+ }
+ }
+
+ $this->ruleset[$code]['properties'][$name] = $values;
+ if (PHP_CODESNIFFER_VERBOSITY > 1) {
+ echo str_repeat("\t", $depth);
+ echo "\t\t=> array property \"$name\" set to \"$value\"";
+ 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] = array();
+ }
+
+ 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] = array();
+ }
+
+ 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 = array();
+
+ 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's for this file.
+ *
+ * @return void
+ * @throws RuntimeException If sniff registration fails.
+ */
+ public function populateTokenListeners()
+ {
+ // Construct a list of listeners indexed by token being listened for.
+ $this->tokenListeners = array();
+
+ 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 = array();
+ $vars = get_class_vars($sniffClass);
+ if (isset($vars['supportedTokenizers']) === true) {
+ foreach ($vars['supportedTokenizers'] as $tokenizer) {
+ $tokenizers[$tokenizer] = $tokenizer;
+ }
+ } else {
+ $tokenizers = array('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 = array();
+ $patterns = $this->getIgnorePatterns($sniffCode);
+ foreach ($patterns as $pattern => $type) {
+ $replacements = array(
+ '\\,' => ',',
+ '*' => '.*',
+ );
+
+ $ignorePatterns[] = strtr($pattern, $replacements);
+ }
+
+ $includePatterns = array();
+ $patterns = $this->getIncludePatterns($sniffCode);
+ foreach ($patterns as $pattern => $type) {
+ $replacements = array(
+ '\\,' => ',',
+ '*' => '.*',
+ );
+
+ $includePatterns[] = strtr($pattern, $replacements);
+ }
+
+ foreach ($tokens as $token) {
+ if (isset($this->tokenListeners[$token]) === false) {
+ $this->tokenListeners[$token] = array();
+ }
+
+ if (isset($this->tokenListeners[$token][$sniffClass]) === false) {
+ $this->tokenListeners[$token][$sniffClass] = array(
+ '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);
+ }
+
+ // Special case for booleans.
+ if ($value === 'true') {
+ $value = true;
+ } else if ($value === 'false') {
+ $value = false;
+ }
+
+ $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 array();
+
+ }//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 array();
+
+ }//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 0000000..8b99568
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Runner.php
@@ -0,0 +1,824 @@
+
+ * @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\FileList;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Files\DummyFile;
+use PHP_CodeSniffer\Util\Cache;
+use PHP_CodeSniffer\Util\Common;
+use PHP_CodeSniffer\Util\Standards;
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Exceptions\DeepExitException;
+
+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 = array($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 = array($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 = array('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();
+
+ // 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 = array('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;
+
+ $numErrors = $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_CodSniffer are not met.
+ *
+ * @return array
+ */
+ 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);
+ }
+
+ if (extension_loaded('tokenizer') === false) {
+ $error = 'ERROR: PHP_CodeSniffer requires the tokenizer extension to be enabled.'.PHP_EOL;
+ throw new DeepExitException($error, 3);
+ }
+
+ }//end checkRequirements()
+
+
+ /**
+ * Init the rulesets and other high-level settings.
+ *
+ * @return void
+ */
+ 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);
+
+ // 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 verbostity flag for deubg 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.
+ */
+ 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(array($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 = array();
+ $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[] = array(
+ 'pid' => $pid,
+ 'out' => $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 = array();
+ ob_start();
+ for ($i = $startAt; $i < $endAt; $i++) {
+ $path = $todo->key();
+ $file = $todo->current();
+
+ if ($file->ignored === true) {
+ 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 = array(
+ '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 = array();
+ 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($pid);
+ }//end if
+ }//end for
+
+ $this->processChildProcs($childProcs);
+ }//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
+ */
+ public function handleErrors($code, $message, $file, $line)
+ {
+ 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
+ */
+ 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 void
+ */
+ private function processChildProcs($childProcs)
+ {
+ $numProcessed = 0;
+ $totalBatches = count($childProcs);
+
+ while (count($childProcs) > 0) {
+ foreach ($childProcs as $key => $procData) {
+ $res = pcntl_waitpid($procData['pid'], $status, WNOHANG);
+ if ($res === $procData['pid']) {
+ if (file_exists($procData['out']) === true) {
+ include $procData['out'];
+ if (isset($childOutput) === true) {
+ $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);
+ }
+ }
+
+ unlink($procData['out']);
+ unset($childProcs[$key]);
+
+ $numProcessed++;
+
+ // Fake a processed file so we can print progress output for the batch.
+ $file = new DummyFile(null, $this->ruleset, $this->config);
+ $file->setErrorCounts(
+ $childOutput['totalErrors'],
+ $childOutput['totalWarnings'],
+ $childOutput['totalFixable'],
+ $childOutput['totalFixed']
+ );
+ $this->printProgress($file, $totalBatches, $numProcessed);
+ }//end if
+ }//end if
+ }//end foreach
+ }//end while
+
+ }//end processChildProcs()
+
+
+ /**
+ * Print progress information for a single processed file.
+ *
+ * @param 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
+ */
+ function printProgress($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) {
+ $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/AbstractPatternSniff.php b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
new file mode 100644
index 0000000..80d909f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractPatternSniff.php
@@ -0,0 +1,939 @@
+
+ * @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\Config;
+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 = array();
+
+ /**
+ * Tokens that this sniff wishes to process outside of the patterns.
+ *
+ * @var int[]
+ * @see registerSupplementary()
+ * @see processSupplementary()
+ */
+ private $supplementaryTokens = array();
+
+ /**
+ * Positions in the stack where errors have occurred.
+ *
+ * @var array
+ */
+ private $errorPos = array();
+
+
+ /**
+ * 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 = array();
+ $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 = array(
+ 'listen_pos' => $pos,
+ 'pattern' => $parsedPattern,
+ 'pattern_code' => $pattern,
+ );
+
+ if (isset($this->parsedPatterns[$tokenType]) === false) {
+ $this->parsedPatterns[$tokenType] = array();
+ }
+
+ $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 = array();
+ 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 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 = array();
+ $this->currFile = $file;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+
+ if (in_array($tokens[$stackPtr]['code'], $this->supplementaryTokens) === 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 = array();
+
+ // 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 = array();
+ $found = '';
+
+ $ignoreTokens = array(T_WHITESPACE);
+ if ($this->ignoreComments === true) {
+ $ignoreTokens
+ = array_merge($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)
+ );
+
+ $diff = ($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 array();
+
+ }//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 = array();
+ $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 = ($i + 2);
+
+ if ($specialPattern['to'] !== 'unknown') {
+ $firstToken++;
+ }
+ } else if (substr($pattern, $i, 3) === 'abc') {
+ $specialPattern = array('type' => 'string');
+ $lastToken = ($i - $firstToken);
+ $firstToken = ($i + 3);
+ $i = ($i + 2);
+ } else if (substr($pattern, $i, 3) === 'EOL') {
+ $specialPattern = array('type' => 'newline');
+ $lastToken = ($i - $firstToken);
+ $firstToken = ($i + 3);
+ $i = ($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 = array('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 = array();
+ foreach ($tokens as $patternInfo) {
+ $patterns[] = array(
+ '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 0000000..be83bed
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php
@@ -0,0 +1,175 @@
+
+ * 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, $)
+ * {
+ * $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 = array();
+
+ /**
+ * The type of scope opener tokens that this test wishes to listen to.
+ *
+ * @var string
+ */
+ private $scopeTokens = array();
+
+ /**
+ * 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.
+ *
+ * @see PHP_CodeSniffer.getValidScopeTokeners()
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified tokens array is empty.
+ */
+ 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
+ * @see processTokenWithinScope()
+ */
+ final public function process(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $foundScope = false;
+ foreach ($tokens[$stackPtr]['conditions'] as $scope => $code) {
+ if (isset($this->scopeTokens[$code]) === true) {
+ $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
+ $foundScope = true;
+ }
+ }
+
+ if ($this->listenOutside === true && $foundScope === false) {
+ $this->processTokenOutsideScope($phpcsFile, $stackPtr);
+ }
+
+ }//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
+ */
+ 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
+ */
+ 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 0000000..ed856c8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractVariableSniff.php
@@ -0,0 +1,208 @@
+
+ * @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\Exceptions\RuntimeException;
+
+abstract class AbstractVariableSniff extends AbstractScopeSniff
+{
+
+ /**
+ * The end token of the current function that we are in.
+ *
+ * @var integer
+ */
+ private $endFunction = -1;
+
+ /**
+ * TRUE if a function is currently open.
+ *
+ * @var boolean
+ */
+ private $functionOpen = false;
+
+ /**
+ * The current PHP_CodeSniffer file that we are processing.
+ *
+ * @var \PHP_CodeSniffer\Files\File
+ */
+ protected $currentFile = null;
+
+
+ /**
+ * Constructs an AbstractVariableTest.
+ */
+ public function __construct()
+ {
+ $scopes = Tokens::$ooScopeTokens;
+
+ $listen = array(
+ T_FUNCTION,
+ T_VARIABLE,
+ T_DOUBLE_QUOTED_STRING,
+ T_HEREDOC,
+ );
+
+ parent::__construct($scopes, $listen, true);
+
+ }//end __construct()
+
+
+ /**
+ * Processes the token in the specified PHP_CodeSniffer_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
+ */
+ final protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope)
+ {
+ if ($this->currentFile !== $phpcsFile) {
+ $this->currentFile = $phpcsFile;
+ $this->functionOpen = false;
+ $this->endFunction = -1;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+
+ if ($stackPtr > $this->endFunction) {
+ $this->functionOpen = false;
+ }
+
+ if ($tokens[$stackPtr]['code'] === T_FUNCTION
+ && $this->functionOpen === false
+ ) {
+ $this->functionOpen = true;
+
+ $methodProps = $phpcsFile->getMethodProperties($stackPtr);
+
+ // If the function is abstract, or is in an interface,
+ // then set the end of the function to it's closing semicolon.
+ if ($methodProps['is_abstract'] === true
+ || $tokens[$currScope]['code'] === T_INTERFACE
+ ) {
+ $this->endFunction
+ = $phpcsFile->findNext(array(T_SEMICOLON), $stackPtr);
+ } else {
+ if (isset($tokens[$stackPtr]['scope_closer']) === false) {
+ $error = 'Possible parse error: non-abstract method defined as abstract';
+ $phpcsFile->addWarning($error, $stackPtr, 'Internal.ParseError.NonAbstractDefinedAbstract');
+ return;
+ }
+
+ $this->endFunction = $tokens[$stackPtr]['scope_closer'];
+ }
+ }//end if
+
+ 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->functionOpen === true) {
+ if ($tokens[$stackPtr]['code'] === T_VARIABLE) {
+ $this->processVariable($phpcsFile, $stackPtr);
+ }
+ } else {
+ // What if we assign a member variable to another?
+ // ie. private $_count = $this->_otherCount + 1;.
+ $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
+ */
+ final protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+ // These variables are not member vars.
+ if ($tokens[$stackPtr]['code'] === T_VARIABLE) {
+ $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
+ */
+ 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
+ */
+ 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
+ */
+ 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 0000000..72512c5
--- /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 int[]
+ * @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 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/Classes/DuplicateClassNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Classes/DuplicateClassNameStandard.xml
new file mode 100644
index 0000000..4b0ec96
--- /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 0000000..6226a3f
--- /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 0000000..9961ea0
--- /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 0000000..c400d75
--- /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 0000000..06f0b7a
--- /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 0000000..f40d94b
--- /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 0000000..50f0782
--- /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 0000000..b2eaabe
--- /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 0000000..8936740
--- /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 0000000..181dff4
--- /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 0000000..ba8bd7e
--- /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 0000000..451e5fb
--- /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 0000000..c9c4fc0
--- /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/InlineControlStructureStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/ControlStructures/InlineControlStructureStandard.xml
new file mode 100644
index 0000000..06ae14b
--- /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 0000000..b57a970
--- /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 0000000..9df9aec
--- /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 0000000..7525e9e
--- /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 0000000..88591f9
--- /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 0000000..aa757ed
--- /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 0000000..227d562
--- /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/InlineHTMLStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Files/InlineHTMLStandard.xml
new file mode 100644
index 0000000..3fbf502
--- /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 0000000..4554d0f
--- /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 0000000..31342e3
--- /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 0000000..a1be34c
--- /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 0000000..7b58576
--- /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 0000000..de97531
--- /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/Formatting/DisallowMultipleStatementsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Formatting/DisallowMultipleStatementsStandard.xml
new file mode 100644
index 0000000..f0d4490
--- /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 0000000..9369eeb
--- /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, $quux);
+ ]]>
+
+
+ = (1 + 2);
+$veryLongVarName = 'string';
+$var = foo($bar, $baz, $quux);
+ ]]>
+
+
+
+
+
+
+
+ += 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 0000000..042e4f8
--- /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 0000000..75eba77
--- /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/Functions/CallTimePassByReferenceStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/Functions/CallTimePassByReferenceStandard.xml
new file mode 100644
index 0000000..738998d
--- /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 0000000..9809844
--- /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 0000000..414dc28
--- /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 0000000..84c2bdd
--- /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 0000000..a928e7d
--- /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 0000000..f66cd92
--- /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/CamelCapsFunctionNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/CamelCapsFunctionNameStandard.xml
new file mode 100644
index 0000000..f5345b7
--- /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 0000000..9dfc175
--- /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/UpperCaseConstantNameStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/NamingConventions/UpperCaseConstantNameStandard.xml
new file mode 100644
index 0000000..6ef61b9
--- /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 0000000..4ebd677
--- /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 0000000..df5a0eb
--- /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 0000000..09afb2d
--- /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 0000000..33b803a
--- /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 0000000..bdfd5dc
--- /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/DisallowShortOpenTagStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/DisallowShortOpenTagStandard.xml
new file mode 100644
index 0000000..8086ea2
--- /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/ForbiddenFunctionsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/ForbiddenFunctionsStandard.xml
new file mode 100644
index 0000000..c0f18b5
--- /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 0000000..ab607c5
--- /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 0000000..965742d
--- /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/NoSilencedErrorsStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/PHP/NoSilencedErrorsStandard.xml
new file mode 100644
index 0000000..df69887
--- /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 0000000..e74005a
--- /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 0000000..2648734
--- /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 0000000..a4c9887
--- /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 0000000..f4f3e19
--- /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/DisallowSpaceIndentStandard.xml b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Docs/WhiteSpace/DisallowSpaceIndentStandard.xml
new file mode 100644
index 0000000..2e399b3
--- /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 0000000..7013ffd
--- /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 0000000..bdd36d4
--- /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/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php
new file mode 100644
index 0000000..cf39925
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php
@@ -0,0 +1,68 @@
+
+ * @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\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DisallowLongArraySyntaxSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ $phpcsFile->recordMetric($stackPtr, 'Short array syntax used', 'no');
+
+ $error = 'Short array syntax must be used to define arrays';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found');
+
+ if ($fix === true) {
+ $tokens = $phpcsFile->getTokens();
+ $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 0000000..54b0bfe
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DisallowShortArraySyntaxSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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 0000000..aa204a6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php
@@ -0,0 +1,116 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DuplicateClassNameSniff implements Sniff
+{
+
+ /**
+ * List of classes that have been found during checking.
+ *
+ * @var array
+ */
+ protected $foundClasses = array();
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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 = array(
+ T_CLASS,
+ T_INTERFACE,
+ 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(
+ array(
+ 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 = array(
+ $type,
+ $name,
+ $file,
+ $line,
+ );
+ $phpcsFile->addWarning($error, $stackPtr, 'Found', $data);
+ } else {
+ $this->foundClasses[$compareName] = array(
+ '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 0000000..39ca8f1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Classes/OpeningBraceSameLineSniff.php
@@ -0,0 +1,123 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class OpeningBraceSameLineSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_CLASS,
+ T_INTERFACE,
+ T_TRAIT,
+ );
+
+ }//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 = array(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 = strlen($tokens[($openingBrace - 1)]['content']);
+ }
+
+ if ($length !== 1) {
+ $error = 'Expected 1 space before opening brace; found %s';
+ $data = array($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 0000000..cea574d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/AssignmentInConditionSniff.php
@@ -0,0 +1,166 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class AssignmentInConditionSniff implements Sniff
+{
+
+
+ /**
+ * Assignment tokens to trigger on.
+ *
+ * Set in the register() method.
+ *
+ * @var array
+ */
+ protected $assignmentTokens = array();
+
+ /**
+ * The tokens that indicate the start of a condition.
+ *
+ * @var array
+ */
+ protected $conditionStartTokens = array();
+
+
+ /**
+ * 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 array(
+ T_IF,
+ T_ELSEIF,
+ T_FOR,
+ T_SWITCH,
+ T_CASE,
+ T_WHILE,
+ );
+
+ }//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) {
+ $phpcsFile->addWarning(
+ 'Variable assignment found within a condition. Did you mean to do a comparison ?',
+ $hasAssignment,
+ 'Found'
+ );
+ }
+
+ $startPos = $hasAssignment;
+ } while ($startPos < $closer);
+
+ }//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 0000000..772c706
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php
@@ -0,0 +1,95 @@
+
+ * 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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(
+ T_CATCH,
+ T_DO,
+ T_ELSE,
+ T_ELSEIF,
+ T_FOR,
+ T_FOREACH,
+ T_IF,
+ T_SWITCH,
+ T_TRY,
+ T_WHILE,
+ );
+
+ }//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'.$name, array($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 0000000..bfe59fd
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(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 = array(
+ 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 0000000..8845919
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(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 0000000..4877c9b
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class JumbledIncrementerSniff implements Sniff
+{
+
+
+ /**
+ * Registers the tokens that this sniff wants to listen for.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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 = array(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 array();
+ }
+
+ $start = ++$token['parenthesis_opener'];
+ $end = --$token['parenthesis_closer'];
+
+ $incrementers = array();
+ $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 0000000..a381985
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(
+ 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 for-loop 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 0000000..862e32e
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(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 0000000..eb2719c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
@@ -0,0 +1,176 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UnusedFunctionParameterSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ 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();
+ $token = $tokens[$stackPtr];
+
+ // Skip broken function declarations.
+ if (isset($token['scope_opener']) === false || isset($token['parenthesis_opener']) === false) {
+ return;
+ }
+
+ $params = array();
+ foreach ($phpcsFile->getMethodParameters($stackPtr) as $param) {
+ $params[$param['name']] = $stackPtr;
+ }
+
+ $next = ++$token['scope_opener'];
+ $end = --$token['scope_closer'];
+
+ $foundContent = false;
+ $validTokens = array(
+ 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) {
+ 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) {
+ return;
+ }
+
+ // There is a return.
+ if ($tokens[$tmp]['code'] === T_SEMICOLON) {
+ return;
+ }
+
+ $tmp = $phpcsFile->findNext(Tokens::$emptyTokens, ($tmp + 1), null, true);
+ if ($tmp !== false && $tokens[$tmp]['code'] === T_SEMICOLON) {
+ // 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) {
+ foreach ($params as $paramName => $position) {
+ $error = 'The method parameter %s is never used';
+ $data = array($paramName);
+ $phpcsFile->addWarning($error, $position, 'Found', $data);
+ }
+ }
+
+ }//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 0000000..06f50f8
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(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 = array();
+ 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 = array('');
+ $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 0000000..6fddeee
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Commenting/DocCommentSniff.php
@@ -0,0 +1,339 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DocCommentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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();
+ $commentStart = $stackPtr;
+ $commentEnd = $tokens[$stackPtr]['comment_closer'];
+
+ $empty = array(
+ 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');
+ return;
+ }
+
+ // 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
+
+ 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)) {
+ $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 = array();
+ $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
+ && empty($tagGroups[$groupid]) === false)
+ || ($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;
+ }
+ } else if ($groupid === $paramGroupid) {
+ $error = 'Tag cannot be grouped with parameter tags in a doc comment';
+ $phpcsFile->addError($error, $tag, 'NonParamGroup');
+ }//end if
+
+ $tagGroups[$groupid][] = $tag;
+ }//end foreach
+
+ foreach ($tagGroups as $group) {
+ $maxLength = 0;
+ $paddings = array();
+ foreach ($group as $pos => $tag) {
+ $tagLength = strlen($tokens[$tag]['content']);
+ 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] = strlen($tokens[($tag + 1)]['content']);
+ }
+ }
+
+ // 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(array(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 - strlen($tokens[$tag]['content']) + 1);
+
+ if ($padding !== $required) {
+ $error = 'Tag value indented incorrectly; expected %s spaces but found %s';
+ $data = array(
+ $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 = array();
+ 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 0000000..2d2ad40
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class FixmeSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$commentTokens;
+
+ }//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 = array();
+ 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 = array($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 0000000..41746cc
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class TodoSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return Tokens::$commentTokens;
+
+ }//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 = array();
+ 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 = array($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/InlineControlStructureSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php
new file mode 100644
index 0000000..a222d81
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php
@@ -0,0 +1,302 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class InlineControlStructureSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ '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 array(
+ 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) {
+ // This could be from a DO WHILE, which doesn't have an opening brace.
+ $lastContent = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
+ if ($tokens[$lastContent]['code'] === T_CLOSE_CURLY_BRACKET) {
+ $brace = $tokens[$lastContent];
+ if (isset($brace['scope_condition']) === true) {
+ $condition = $tokens[$brace['scope_condition']];
+ if ($condition['code'] === T_DO) {
+ 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 ($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
+
+ // 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
+ && 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) {
+ $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 DO... WHILE conditions.
+ if ($type === T_DO && $nextType === T_WHILE) {
+ $end = $phpcsFile->findNext(T_SEMICOLON, ($next + 1));
+ }
+
+ // Account for TRY... CATCH statements.
+ if ($type === T_TRY && $nextType === T_CATCH) {
+ $end = $tokens[$next]['scope_closer'];
+ }
+ }//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;
+ }
+
+ $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($end + 1), null, true);
+
+ if ($next === false || $tokens[$next]['line'] !== $tokens[$end]['line']) {
+ // Looks for completely empty statements.
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($closer + 1), ($end + 1), true);
+
+ // 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) {
+ $endLine = $end;
+ }
+ } else {
+ $next = ($end + 1);
+ $endLine = $end;
+ }
+
+ if ($next !== $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 ($first === 1
+ || $tokens[($first - 1)]['line'] !== $tokens[$first]['line']
+ ) {
+ 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 ($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 0000000..c21c97a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php
@@ -0,0 +1,95 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+class CSSLintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array('CSS');
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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 = 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 = array();
+ $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 0000000..bf10365
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
@@ -0,0 +1,116 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+class ClosureLinterSniff implements Sniff
+{
+
+ /**
+ * A list of error codes that should show errors.
+ *
+ * All other error codes will show warnings.
+ *
+ * @var integer
+ */
+ public $errorCodes = array();
+
+ /**
+ * A list of error codes to ignore.
+ *
+ * @var integer
+ */
+ public $ignoreCodes = array();
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array('JS');
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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 = escapeshellcmd($lintPath);
+ $cmd = '$lintPath --nosummary --notime --unix_mode '.escapeshellarg($fileName);
+ $msg = exec($cmd, $output, $retval);
+
+ if (is_array($output) === false) {
+ return;
+ }
+
+ foreach ($output as $finding) {
+ $matches = array();
+ $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 = array(
+ $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 0000000..19cdc32
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+class ESLintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array('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 array(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 = array('--format json');
+ if (empty($configFile) === false) {
+ $eslintOptions[] = '--config '.escapeshellarg($configFile);
+ }
+
+ $cmd = 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 0000000..0728e65
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Debug/JSHintSniff.php
@@ -0,0 +1,86 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+class JSHintSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array('JS');
+
+
+ /**
+ * Returns the token types that this sniff is interested in.
+ *
+ * @return int[]
+ */
+ public function register()
+ {
+ return array(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();
+
+ $rhinoPath = escapeshellcmd($rhinoPath);
+ $jshintPath = escapeshellcmd($jshintPath);
+
+ $cmd = "$rhinoPath \"$jshintPath\" ".escapeshellarg($fileName);
+ $msg = exec($cmd, $output, $retval);
+
+ if (is_array($output) === true) {
+ foreach ($output as $finding) {
+ $matches = array();
+ $numMatches = preg_match('/^(.+)\(.+:([0-9]+).*:[0-9]+\)$/', $finding, $matches);
+ if ($numMatches === 0) {
+ continue;
+ }
+
+ $line = (int) $matches[2];
+ $message = 'jshint says: '.trim($matches[1]);
+ $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 0000000..831f471
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class ByteOrderMarkSniff implements Sniff
+{
+
+ /**
+ * List of supported BOM definitions.
+ *
+ * Use encoding names as keys and hex BOM representations as values.
+ *
+ * @var array
+ */
+ protected $bomDefinitions = array(
+ '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 array(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 = array($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 0000000..4a6740d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNewlineSniff.php
@@ -0,0 +1,81 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class EndFileNewlineSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ 'CSS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ // 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 0000000..6a68633
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/EndFileNoNewlineSniff.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\Files;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class EndFileNoNewlineSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ 'CSS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ // 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) {
+ $newContent = substr($tokens[$stackPtr]['content'], 0, ($eolCharLen * -1));
+ $phpcsFile->fixer->replaceToken($stackPtr, $newContent);
+ }
+ }
+
+ // 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 0000000..523982e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/InlineHTMLSniff.php
@@ -0,0 +1,56 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class InlineHTMLSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ // 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 0000000..341eb06
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
@@ -0,0 +1,136 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class LineEndingsSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ '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 array(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)
+ {
+ $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 = array(
+ $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)]) === false
+ || $tokens[($i + 1)]['line'] > $tokens[$i]['line']
+ ) {
+ // Token is the last on a line.
+ if (isset($tokens[$i]['orig_content']) === true) {
+ $tokenContent = $tokens[$i]['orig_content'];
+ } else {
+ $tokenContent = $tokens[$i]['content'];
+ }
+
+ $newContent = rtrim($tokenContent, "\r\n");
+ $newContent .= $eolChar;
+ $phpcsFile->fixer->replaceToken($i, $newContent);
+ }
+ }
+ }//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 0000000..2a77045
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LineLengthSniff.php
@@ -0,0 +1,176 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+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 comment lines.
+ *
+ * @var boolean
+ */
+ public $ignoreComments = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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 null|false
+ */
+ 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--;
+ }
+
+ $lineLength = ($tokens[$stackPtr]['column'] + $tokens[$stackPtr]['length'] - 1);
+
+ // 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 ($tokens[$stackPtr]['code'] === T_COMMENT
+ || $tokens[$stackPtr]['code'] === T_DOC_COMMENT_STRING
+ ) {
+ if ($this->ignoreComments === true) {
+ return;
+ }
+
+ // 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 = array(
+ $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 = array(
+ $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 0000000..c693069
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/LowercasedFilenameSniff.php
@@ -0,0 +1,67 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class LowercasedFilenameSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ $filename = $phpcsFile->getFilename();
+ if ($filename === 'STDIN') {
+ return;
+ }
+
+ $filename = basename($filename);
+ $lowercaseFilename = strtolower($filename);
+ if ($filename !== $lowercaseFilename) {
+ $data = array(
+ $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 0000000..1b79ff8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneClassPerFileSniff.php
@@ -0,0 +1,51 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class OneClassPerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
+ 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 0000000..14957c8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneInterfacePerFileSniff.php
@@ -0,0 +1,51 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class OneInterfacePerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ $nextInterface = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
+ 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 0000000..f6f058f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneObjectStructurePerFileSniff.php
@@ -0,0 +1,55 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class OneObjectStructurePerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_CLASS,
+ T_INTERFACE,
+ 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)
+ {
+ $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
+ 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 0000000..d5b7da6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Files/OneTraitPerFileSniff.php
@@ -0,0 +1,51 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class OneTraitPerFileSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1));
+ 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 0000000..1cb5e9c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/DisallowMultipleStatementsSniff.php
@@ -0,0 +1,89 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DisallowMultipleStatementsSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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();
+
+ $prev = $phpcsFile->findPrevious(array(T_SEMICOLON, T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO), ($stackPtr - 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;
+ }
+
+ // Ignore multiple statements in a FOR condition.
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
+ foreach ($tokens[$stackPtr]['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';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'SameLine');
+ 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 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 0000000..a096369
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php
@@ -0,0 +1,319 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class MultipleStatementAlignmentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ '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;
+
+
+ /**
+ * 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)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ // Ignore assignments used in a condition, like an IF or FOR.
+ if (isset($tokens[$stackPtr]['nested_parenthesis']) === true) {
+ foreach ($tokens[$stackPtr]['nested_parenthesis'] as $start => $end) {
+ if (isset($tokens[$start]['parenthesis_owner']) === true) {
+ return;
+ }
+ }
+ }
+
+ $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.
+ *
+ * @return int
+ */
+ public function checkAlignment($phpcsFile, $stackPtr)
+ {
+ $tokens = $phpcsFile->getTokens();
+
+ $assignments = array();
+ $prevAssign = null;
+ $lastLine = $tokens[$stackPtr]['line'];
+ $maxPadding = null;
+ $stopped = null;
+ $lastCode = $stackPtr;
+ $lastSemi = null;
+
+ $find = Tokens::$assignmentTokens;
+ unset($find[T_DOUBLE_ARROW]);
+
+ for ($assign = $stackPtr; $assign < $phpcsFile->numTokens; $assign++) {
+ 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) {
+ if (($tokens[$assign]['line'] - $tokens[$lastCode]['line']) > 1) {
+ break;
+ }
+
+ $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 {
+ // 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) {
+ // Has to be nested inside the same conditions as the first assignment.
+ if ($tokens[$assign]['conditions'] !== $tokens[$stackPtr]['conditions']) {
+ break;
+ }
+
+ // Make sure it is not assigned inside a condition (eg. IF, FOR).
+ if (isset($tokens[$assign]['nested_parenthesis']) === true) {
+ 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 ($assign !== $stackPtr) {
+ 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] = array(
+ '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 = array(
+ $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 $assignment;
+ }
+
+ }//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 0000000..1e0e576
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php
@@ -0,0 +1,58 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 0000000..3aec9c6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php
@@ -0,0 +1,69 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class SpaceAfterCastSniff 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) {
+ $error = 'A cast statement must be followed by a single space';
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NoSpace');
+ if ($fix === true) {
+ $phpcsFile->fixer->addContent($stackPtr, ' ');
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', 0);
+ return;
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Spacing after cast statement', $tokens[($stackPtr + 1)]['length']);
+
+ if ($tokens[($stackPtr + 1)]['length'] !== 1) {
+ $error = 'A cast statement must be followed 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/Formatting/SpaceAfterNotSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.php
new file mode 100644
index 0000000..d61879b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Formatting/SpaceAfterNotSniff.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\Formatting;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class SpaceAfterNotSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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();
+
+ $spacing = 0;
+ if ($tokens[($stackPtr + 1)]['code'] === T_WHITESPACE) {
+ $spacing = $tokens[($stackPtr + 1)]['length'];
+ }
+
+ if ($spacing === 1) {
+ return;
+ }
+
+ $message = 'There must be a single space after a NOT operator; %s found';
+ $fix = $phpcsFile->addFixableError($message, $stackPtr, 'Incorrect', array($spacing));
+
+ if ($fix === true) {
+ if ($spacing === 0) {
+ $phpcsFile->fixer->addContent($stackPtr, ' ');
+ } else {
+ $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 0000000..2e64e0b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php
@@ -0,0 +1,147 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(
+ 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 = array_merge(
+ Tokens::$emptyTokens,
+ array(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 = array(
+ 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;
+ }
+
+ // Checking this: $value = my_function(...[*]$arg...).
+ $tokenBefore = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($nextSeparator - 1),
+ null,
+ true
+ );
+
+ if ($tokens[$tokenBefore]['code'] === T_BITWISE_AND) {
+ // Checking this: $value = my_function(...[*]&$arg...).
+ $tokenBefore = $phpcsFile->findPrevious(
+ Tokens::$emptyTokens,
+ ($tokenBefore - 1),
+ null,
+ true
+ );
+
+ // We have to exclude all uses of T_BITWISE_AND that are not
+ // references. We use a blacklist approach as we prefer false
+ // positives to not identifying a pass-by-reference call at all.
+ $tokenCode = $tokens[$tokenBefore]['code'];
+ if ($tokenCode === T_VARIABLE
+ || $tokenCode === T_CLOSE_PARENTHESIS
+ || $tokenCode === T_CLOSE_SQUARE_BRACKET
+ || $tokenCode === T_LNUMBER
+ || isset(Tokens::$assignmentTokens[$tokenCode]) === 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 0000000..01063a1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php
@@ -0,0 +1,173 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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()
+ {
+ $tokens = Tokens::$functionNameTokens;
+
+ $tokens[] = T_VARIABLE;
+ $tokens[] = T_CLOSE_CURLY_BRACKET;
+ $tokens[] = T_CLOSE_PARENTHESIS;
+
+ 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 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 cant 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;
+ }
+
+ $closeBracket = $tokens[$openBracket]['parenthesis_closer'];
+ $nextSeparator = $openBracket;
+
+ $find = array(
+ T_COMMA,
+ T_VARIABLE,
+ T_CLOSURE,
+ T_OPEN_SHORT_ARRAY,
+ );
+
+ while (($nextSeparator = $phpcsFile->findNext($find, ($nextSeparator + 1), $closeBracket)) !== false) {
+ if ($tokens[$nextSeparator]['code'] === T_CLOSURE) {
+ // 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 function call';
+ $fix = $phpcsFile->addFixableError($error, $nextSeparator, 'SpaceBeforeComma');
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($nextSeparator - 1), '');
+ }
+ }
+ }
+
+ if ($tokens[($nextSeparator + 1)]['code'] !== T_WHITESPACE) {
+ $error = 'No space found after comma in function call';
+ $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 = strlen($tokens[($nextSeparator + 1)]['content']);
+ if ($space > 1) {
+ $error = 'Expected 1 space after comma in function call; %s found';
+ $data = array($space);
+ $fix = $phpcsFile->addFixableError($error, $nextSeparator, 'TooMuchSpaceAfterComma', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken(($nextSeparator + 1), ' ');
+ }
+ }
+ }
+ }//end if
+ } else {
+ // Token is a variable.
+ $nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($nextSeparator + 1), $closeBracket, true);
+ if ($nextToken !== false) {
+ if ($tokens[$nextToken]['code'] === T_EQUAL) {
+ if (($tokens[($nextToken - 1)]['code']) !== T_WHITESPACE) {
+ $error = 'Expected 1 space before = sign of default value';
+ $fix = $phpcsFile->addFixableError($error, $nextToken, 'NoSpaceBeforeEquals');
+ if ($fix === true) {
+ $phpcsFile->fixer->addContentBefore($nextToken, ' ');
+ }
+ }
+
+ if ($tokens[($nextToken + 1)]['code'] !== T_WHITESPACE) {
+ $error = 'Expected 1 space after = sign of default value';
+ $fix = $phpcsFile->addFixableError($error, $nextToken, 'NoSpaceAfterEquals');
+ if ($fix === true) {
+ $phpcsFile->fixer->addContent($nextToken, ' ');
+ }
+ }
+ }
+ }
+ }//end if
+ }//end while
+
+ }//end process()
+
+
+}//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 0000000..caf5a38
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php
@@ -0,0 +1,175 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+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 void
+ */
+ public function register()
+ {
+ return array(
+ 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'];
+ }
+ }
+
+ $functionLine = $tokens[$closeBracket]['line'];
+ $braceLine = $tokens[$openingBrace]['line'];
+
+ $lineDifference = ($braceLine - $functionLine);
+
+ if ($lineDifference === 0) {
+ $error = 'Opening brace should be on a new line';
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceOnSameLine');
+ if ($fix === true) {
+ $phpcsFile->fixer->beginChangeset();
+ $indent = $phpcsFile->findFirstOnLine(array(), $openingBrace);
+ if ($tokens[$indent]['code'] === T_WHITESPACE) {
+ $phpcsFile->fixer->addContentBefore($openingBrace, $tokens[$indent]['content']);
+ }
+
+ $phpcsFile->fixer->addNewlineBefore($openingBrace);
+ $phpcsFile->fixer->endChangeset();
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'Function 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 = array(($lineDifference - 1));
+ $fix = $phpcsFile->addFixableError($error, $openingBrace, 'BraceSpacing', $data);
+ if ($fix === true) {
+ for ($i = ($tokens[$stackPtr]['parenthesis_closer'] + 1); $i < $openingBrace; $i++) {
+ if ($tokens[$i]['line'] === $braceLine) {
+ $phpcsFile->fixer->addNewLineBefore($i);
+ break;
+ }
+
+ $phpcsFile->fixer->replaceToken($i, '');
+ }
+ }
+ }//end if
+
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($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 = array(
+ $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, 'Function 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 0000000..fe1bfcd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php
@@ -0,0 +1,173 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+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 array(
+ 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'];
+ }
+ }
+
+ $functionLine = $tokens[$closeBracket]['line'];
+ $braceLine = $tokens[$openingBrace]['line'];
+
+ $lineDifference = ($braceLine - $functionLine);
+
+ if ($lineDifference > 0) {
+ $phpcsFile->recordMetric($stackPtr, 'Function 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 preceeded 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
+ }//end if
+
+ $phpcsFile->recordMetric($stackPtr, 'Function opening brace placement', 'same 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 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)]['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 = array($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 0000000..86ed2a4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php
@@ -0,0 +1,115 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+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 array(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)
+ {
+ $this->currentFile = $phpcsFile;
+
+ $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 = array(
+ T_CASE => true,
+ T_DEFAULT => true,
+ T_CATCH => true,
+ T_IF => true,
+ T_FOR => true,
+ T_FOREACH => true,
+ T_WHILE => true,
+ T_DO => true,
+ T_ELSEIF => 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 = array(
+ $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 = array(
+ $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 0000000..fc5ed39
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+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 array(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 = array(
+ $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 = array(
+ $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/CamelCapsFunctionNameSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
new file mode 100644
index 0000000..008be8c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/CamelCapsFunctionNameSniff.php
@@ -0,0 +1,203 @@
+
+ * @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\Sniffs\AbstractScopeSniff;
+use PHP_CodeSniffer\Util\Common;
+use PHP_CodeSniffer\Util\Tokens;
+use PHP_CodeSniffer\Files\File;
+
+class CamelCapsFunctionNameSniff extends AbstractScopeSniff
+{
+
+ /**
+ * A list of all PHP magic methods.
+ *
+ * @var array
+ */
+ protected $magicMethods = array(
+ 'construct' => true,
+ 'destruct' => true,
+ 'call' => true,
+ 'callstatic' => true,
+ 'get' => true,
+ 'set' => true,
+ 'isset' => true,
+ 'unset' => true,
+ 'sleep' => true,
+ 'wakeup' => true,
+ 'tostring' => true,
+ 'set_state' => true,
+ 'clone' => true,
+ 'invoke' => 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 = array(
+ 'soapcall' => true,
+ 'getlastrequest' => true,
+ 'getlastresponse' => true,
+ 'getlastrequestheaders' => true,
+ 'getlastresponseheaders' => true,
+ 'getfunctions' => true,
+ 'gettypes' => true,
+ 'dorequest' => true,
+ 'setcookie' => true,
+ 'setlocation' => true,
+ 'setsoapheaders' => true,
+ );
+
+ /**
+ * A list of all PHP magic functions.
+ *
+ * @var array
+ */
+ protected $magicFunctions = array('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, array(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)
+ {
+ $methodName = $phpcsFile->getDeclarationName($stackPtr);
+ if ($methodName === null) {
+ // Ignore closures.
+ return;
+ }
+
+ $className = $phpcsFile->getDeclarationName($currScope);
+ $errorData = array($className.'::'.$methodName);
+
+ // Is this a magic method. i.e., is prefixed with "__" ?
+ if (preg_match('|^__[^_]|', $methodName) !== 0) {
+ $magicPart = strtolower(substr($methodName, 2));
+ if (isset($this->magicMethods[$magicPart]) === false
+ && isset($this->methodsDoubleUnderscore[$magicPart]) === false
+ ) {
+ $error = 'Method name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
+ $phpcsFile->addError($error, $stackPtr, 'MethodDoubleUnderscore', $errorData);
+ }
+
+ return;
+ }
+
+ // PHP4 constructors are allowed to break our rules.
+ if ($methodName === $className) {
+ return;
+ }
+
+ // PHP4 destructors are allowed to break our rules.
+ if ($methodName === '_'.$className) {
+ 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 = array(
+ 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 = array($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]) === false) {
+ $error = 'Function name "%s" is invalid; only PHP magic methods should be prefixed with a double underscore';
+ $phpcsFile->addError($error, $stackPtr, 'FunctionDoubleUnderscore', $errorData);
+ }
+
+ return;
+ }
+
+ // 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 0000000..27b8011
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php
@@ -0,0 +1,146 @@
+
+ * @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\Sniffs\AbstractScopeSniff;
+use PHP_CodeSniffer\Files\File;
+
+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 = array();
+
+
+ /**
+ * Constructs the test with the tokens it wishes to listen for.
+ */
+ public function __construct()
+ {
+ parent::__construct(array(T_CLASS, T_ANON_CLASS, T_INTERFACE), array(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)
+ {
+ $className = $phpcsFile->getDeclarationName($currScope);
+ if ($className !== $this->currentClass) {
+ $this->loadFunctionNamesInScope($phpcsFile, $currScope);
+ $this->currentClass = $className;
+ }
+
+ $methodName = $phpcsFile->getDeclarationName($stackPtr);
+
+ if (strcasecmp($methodName, $className) === 0) {
+ if (in_array('__construct', $this->functionList) === false) {
+ $error = 'PHP4 style constructors are not allowed; use "__construct()" instead';
+ $phpcsFile->addError($error, $stackPtr, 'OldStyle');
+ }
+ } else if (strcasecmp($methodName, '__construct') !== 0) {
+ // Not a constructor.
+ return;
+ }
+
+ $tokens = $phpcsFile->getTokens();
+
+ $parentClassName = $phpcsFile->findExtendedClassName($currScope);
+ if ($parentClassName === false) {
+ return;
+ }
+
+ // Stop if the constructor doesn't have a body, like when it is abstract.
+ if (isset($tokens[$stackPtr]['scope_closer']) === 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
+ && $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 = array();
+ $tokens = $phpcsFile->getTokens();
+
+ for ($i = ($tokens[$currScope]['scope_opener'] + 1); $i < $tokens[$currScope]['scope_closer']; $i++) {
+ if ($tokens[$i]['code'] !== T_FUNCTION) {
+ continue;
+ }
+
+ $next = $phpcsFile->findNext(T_STRING, $i);
+ $this->functionList[] = trim($tokens[$next]['content']);
+ }
+
+ }//end loadFunctionNamesInScope()
+
+
+}//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 0000000..adeb126
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.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\Standards\Generic\Sniffs\NamingConventions;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class UpperCaseConstantNameSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_STRING);
+
+ }//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();
+ $constName = $tokens[$stackPtr]['content'];
+
+ // If this token is in a heredoc, ignore it.
+ if ($phpcsFile->hasCondition($stackPtr, T_START_HEREDOC) === true) {
+ return;
+ }
+
+ // Special case for PHP 5.5 class name resolution.
+ if (strtolower($constName) === 'class'
+ && $tokens[($stackPtr - 1)]['code'] === T_DOUBLE_COLON
+ ) {
+ return;
+ }
+
+ // Special case for PHPUnit.
+ if ($constName === 'PHPUnit_MAIN_METHOD') {
+ return;
+ }
+
+ // If the next non-whitespace token after this token
+ // is not an opening parenthesis then it is not a function call.
+ for ($openBracket = ($stackPtr + 1); $openBracket < $phpcsFile->numTokens; $openBracket++) {
+ if ($tokens[$openBracket]['code'] !== T_WHITESPACE) {
+ break;
+ }
+ }
+
+ if ($openBracket === $phpcsFile->numTokens) {
+ return;
+ }
+
+ if ($tokens[$openBracket]['code'] !== T_OPEN_PARENTHESIS) {
+ $functionKeyword = $phpcsFile->findPrevious(
+ array(
+ T_WHITESPACE,
+ T_COMMA,
+ T_COMMENT,
+ T_STRING,
+ T_NS_SEPARATOR,
+ ),
+ ($stackPtr - 1),
+ null,
+ true
+ );
+
+ if ($tokens[$functionKeyword]['code'] !== T_CONST) {
+ return;
+ }
+
+ // This is a class constant.
+ if (strtoupper($constName) !== $constName) {
+ if (strtolower($constName) === $constName) {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'lower');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'mixed');
+ }
+
+ $error = 'Class constants must be uppercase; expected %s but found %s';
+ $data = array(
+ strtoupper($constName),
+ $constName,
+ );
+ $phpcsFile->addError($error, $stackPtr, 'ClassConstantNotUpperCase', $data);
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'Constant name case', 'upper');
+ }
+
+ return;
+ }//end if
+
+ if (strtolower($constName) !== 'define') {
+ return;
+ }
+
+ /*
+ This may be a "define" function call.
+ */
+
+ // 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
+ ) {
+ 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 namesspace 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 = array(
+ $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 0000000..7ef4e5d
--- /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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class BacktickOperatorSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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 0000000..4e7296c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/CharacterBeforePHPOpeningTagSniff.php
@@ -0,0 +1,63 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class CharacterBeforePHPOpeningTagSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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 void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $expected = 0;
+ if ($stackPtr > 0) {
+ // Allow a shebang line.
+ $tokens = $phpcsFile->getTokens();
+ if (substr($tokens[0]['content'], 0, 2) === '#!') {
+ $expected = 1;
+ }
+ }
+
+ 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 0000000..f810812
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ClosingPHPTagSniff.php
@@ -0,0 +1,51 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class ClosingPHPTagSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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 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 0000000..19ca353
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php
@@ -0,0 +1,76 @@
+
+ * @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(string => string|null)
+ */
+ public $forbiddenFunctions = array();
+
+
+ /**
+ * 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 (method_exists($function, 'isDeprecated') === false) {
+ break;
+ }
+
+ 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 = array($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 0000000..b05896a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowAlternativePHPTagsSniff.php
@@ -0,0 +1,254 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+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 = (boolean) ini_get('asp_tags');
+ }
+
+ return array(
+ 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 = array($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 = array(
+ $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.
+ // The "(?:]+)?language=[\'"]?php[\'"]?(?:[^>]+)?>)`i', $content, $match) === 1
+ ) {
+ $error = 'Script style opening tag used; expected "getSnippet($content, $match[1]);
+ $data = array($match[1].$snippet);
+
+ $phpcsFile->addError($error, $stackPtr, 'ScriptOpenTagFound', $data);
+ return;
+ }
+
+ if ($openTag['code'] === T_INLINE_HTML && $this->aspTags === false) {
+ if (strpos($content, '<%=') !== false) {
+ $error = 'Possible use of ASP style short opening tags detected; found: %s';
+ $snippet = $this->getSnippet($content, '<%=');
+ $data = array('<%='.$snippet);
+
+ $phpcsFile->addWarning($error, $stackPtr, 'MaybeASPShortOpenTagFound', $data);
+ } else if (strpos($content, '<%') !== false) {
+ $error = 'Possible use of ASP style opening tags detected; found: %s';
+ $snippet = $this->getSnippet($content, '<%');
+ $data = array('<%'.$snippet);
+
+ $phpcsFile->addWarning($error, $stackPtr, 'MaybeASPOpenTagFound', $data);
+ }
+ }
+
+ }//end process()
+
+
+ /**
+ * Get a snippet from a HTML token.
+ *
+ * @param string $content The content of the HTML token.
+ * @param string $start Partial string to use as a starting point for the snippet.
+ * @param int $length The target length of the snippet to get. Defaults to 40.
+ *
+ * @return string
+ */
+ protected function getSnippet($content, $start='', $length=40)
+ {
+ $startPos = 0;
+
+ if ($start !== '') {
+ $startPos = strpos($content, $start);
+ if ($startPos !== false) {
+ $startPos += strlen($start);
+ }
+ }
+
+ $snippet = substr($content, $startPos, $length);
+ if ((strlen($content) - $startPos) > $length) {
+ $snippet .= '...';
+ }
+
+ return $snippet;
+
+ }//end getSnippet()
+
+
+ /**
+ * Try and find a matching PHP closing tag.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param array $tokens The token stack.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ * @param string $content The expected content of the closing tag to match the opener.
+ *
+ * @return int|false Pointer to the position in the stack for the closing tag or false if not found.
+ */
+ protected function findClosingTag(File $phpcsFile, $tokens, $stackPtr, $content)
+ {
+ $closer = $phpcsFile->findNext(T_CLOSE_TAG, ($stackPtr + 1));
+
+ if ($closer !== false && $content === trim($tokens[$closer]['content'])) {
+ return $closer;
+ }
+
+ return false;
+
+ }//end findClosingTag()
+
+
+ /**
+ * Add a changeset to replace the alternative PHP tags.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
+ * @param array $tokens The token stack.
+ * @param int $openTagPointer Stack pointer to the PHP open tag.
+ * @param int $closeTagPointer Stack pointer to the PHP close tag.
+ * @param bool $echo Whether to add 'echo' or not.
+ *
+ * @return void
+ */
+ protected function addChangeset(File $phpcsFile, $tokens, $openTagPointer, $closeTagPointer, $echo=false)
+ {
+ // Build up the open tag replacement and make sure there's always whitespace behind it.
+ $openReplacement = '', $tokens[$closeTagPointer]['content']);
+
+ $phpcsFile->fixer->beginChangeset();
+ $phpcsFile->fixer->replaceToken($openTagPointer, $openReplacement);
+ $phpcsFile->fixer->replaceToken($closeTagPointer, $closeReplacement);
+ $phpcsFile->fixer->endChangeset();
+
+ }//end addChangeset()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php
new file mode 100644
index 0000000..cc490e1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php
@@ -0,0 +1,168 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class DisallowShortOpenTagSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ $targets = array(
+ T_OPEN_TAG,
+ T_OPEN_TAG_WITH_ECHO,
+ );
+
+ $shortOpenTags = (boolean) ini_get('short_open_tag');
+ if ($shortOpenTags === false) {
+ $targets[] = T_INLINE_HTML;
+ }
+
+ return $targets;
+
+ }//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];
+
+ if ($token['code'] === T_OPEN_TAG && $token['content'] === '') {
+ $error = 'Short PHP opening tag used; expected "addFixableError($error, $stackPtr, 'Found', $data);
+ if ($fix === true) {
+ $correctOpening = 'fixer->replaceToken($stackPtr, $correctOpening);
+ }
+
+ $phpcsFile->recordMetric($stackPtr, 'PHP short open tag used', 'yes');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP short open tag used', 'no');
+ }
+
+ if ($token['code'] === T_OPEN_TAG_WITH_ECHO) {
+ $nextVar = $tokens[$phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true)];
+ $error = 'Short PHP opening tag used with echo; expected "addFixableError($error, $stackPtr, 'EchoFound', $data);
+ if ($fix === true) {
+ if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) {
+ $phpcsFile->fixer->replaceToken($stackPtr, 'fixer->replaceToken($stackPtr, 'numTokens; $i++) {
+ if ($tokens[$i]['code'] !== T_INLINE_HTML) {
+ break;
+ }
+
+ $closerFound = strrpos($tokens[$i]['content'], '?>');
+ if ($closerFound !== false) {
+ if ($i !== $stackPtr) {
+ break;
+ } else if ($closerFound > $openerFound) {
+ break;
+ } else {
+ $closerFound = false;
+ }
+ }
+ }
+
+ if ($closerFound !== false) {
+ $error = 'Possible use of short open tags detected; found: %s';
+ $snippet = $this->getSnippet($content, '');
+ $data = array(''.$snippet);
+
+ $phpcsFile->addWarning($error, $stackPtr, 'PossibleFound', $data);
+
+ // Skip forward to the token containing the closer.
+ if (($i - 1) > $stackPtr) {
+ return $i;
+ }
+ }
+ }//end if
+
+ }//end process()
+
+
+ /**
+ * Get a snippet from a HTML token.
+ *
+ * @param string $content The content of the HTML token.
+ * @param string $start Partial string to use as a starting point for the snippet.
+ * @param int $length The target length of the snippet to get. Defaults to 40.
+ *
+ * @return string
+ */
+ protected function getSnippet($content, $start='', $length=40)
+ {
+ $startPos = 0;
+
+ if ($start !== '') {
+ $startPos = strpos($content, $start);
+ if ($startPos !== false) {
+ $startPos += strlen($start);
+ }
+ }
+
+ $snippet = substr($content, $startPos, $length);
+ if ((strlen($content) - $startPos) > $length) {
+ $snippet .= '...';
+ }
+
+ return $snippet;
+
+ }//end getSnippet()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php
new file mode 100644
index 0000000..7442bdd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.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\Standards\Generic\Sniffs\PHP;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class ForbiddenFunctionsSniff implements Sniff
+{
+
+ /**
+ * 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 = array(
+ 'sizeof' => 'count',
+ 'delete' => 'unset',
+ );
+
+ /**
+ * A cache of forbidden function names, for faster lookups.
+ *
+ * @var string[]
+ */
+ protected $forbiddenFunctionNames = array();
+
+ /**
+ * If true, forbidden functions will be considered regular expressions.
+ *
+ * @var boolean
+ */
+ protected $patternMatch = false;
+
+ /**
+ * 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()
+ {
+ // Everyone has had a chance to figure out what forbidden functions
+ // they want to check for, so now we can cache out the list.
+ $this->forbiddenFunctionNames = array_keys($this->forbiddenFunctions);
+
+ if ($this->patternMatch === true) {
+ foreach ($this->forbiddenFunctionNames as $i => $name) {
+ $this->forbiddenFunctionNames[$i] = '/'.$name.'/i';
+ }
+
+ return array(T_STRING);
+ }
+
+ // If we are not pattern matching, we need to work out what
+ // tokens to listen for.
+ $string = 'forbiddenFunctionNames as $name) {
+ $string .= $name.'();';
+ }
+
+ $register = array();
+
+ $tokens = token_get_all($string);
+ array_shift($tokens);
+ foreach ($tokens as $token) {
+ if (is_array($token) === true) {
+ $register[] = $token[0];
+ }
+ }
+
+ $this->forbiddenFunctionNames = array_map('strtolower', $this->forbiddenFunctionNames);
+ $this->forbiddenFunctions = array_combine($this->forbiddenFunctionNames, $this->forbiddenFunctions);
+
+ return array_unique($register);
+
+ }//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 = array(
+ T_DOUBLE_COLON => true,
+ T_OBJECT_OPERATOR => true,
+ T_FUNCTION => true,
+ T_CONST => true,
+ T_PUBLIC => true,
+ T_PRIVATE => true,
+ T_PROTECTED => true,
+ T_AS => true,
+ T_NEW => true,
+ T_INSTEADOF => true,
+ T_NS_SEPARATOR => true,
+ T_IMPLEMENTS => true,
+ );
+
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
+
+ // If function call is directly preceded by a NS_SEPARATOR it points to the
+ // global namespace, so we should still catch it.
+ if ($tokens[$prevToken]['code'] === T_NS_SEPARATOR) {
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($prevToken - 1), null, true);
+ if ($tokens[$prevToken]['code'] === T_STRING) {
+ // Not in the global namespace.
+ return;
+ }
+ }
+
+ if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
+ // Not a call to a PHP function.
+ return;
+ }
+
+ $nextToken = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ if (isset($ignore[$tokens[$nextToken]['code']]) === true) {
+ // Not a call to a PHP function.
+ return;
+ }
+
+ if ($tokens[$stackPtr]['code'] === T_STRING && $tokens[$nextToken]['code'] !== T_OPEN_PARENTHESIS) {
+ // Not a call to a PHP function.
+ return;
+ }
+
+ $function = strtolower($tokens[$stackPtr]['content']);
+ $pattern = null;
+
+ if ($this->patternMatch === true) {
+ $count = 0;
+ $pattern = preg_replace(
+ $this->forbiddenFunctionNames,
+ $this->forbiddenFunctionNames,
+ $function,
+ 1,
+ $count
+ );
+
+ if ($count === 0) {
+ return;
+ }
+
+ // Remove the pattern delimiters and modifier.
+ $pattern = substr($pattern, 1, -2);
+ } else {
+ if (in_array($function, $this->forbiddenFunctionNames) === false) {
+ return;
+ }
+ }//end if
+
+ $this->addError($phpcsFile, $stackPtr, $tokens[$stackPtr]['content'], $pattern);
+
+ }//end process()
+
+
+ /**
+ * 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 = array($function);
+ $error = 'The use of function %s() is ';
+ if ($this->error === true) {
+ $type = 'Found';
+ $error .= 'forbidden';
+ } else {
+ $type = 'Discouraged';
+ $error .= 'discouraged';
+ }
+
+ if ($pattern === null) {
+ $pattern = strtolower($function);
+ }
+
+ if ($this->forbiddenFunctions[$pattern] !== null
+ && $this->forbiddenFunctions[$pattern] !== 'null'
+ ) {
+ $type .= 'WithAlternative';
+ $data[] = $this->forbiddenFunctions[$pattern];
+ $error .= '; use %s() instead';
+ }
+
+ 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/LowerCaseConstantSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php
new file mode 100644
index 0000000..d18de1a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php
@@ -0,0 +1,83 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class LowerCaseConstantSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_TRUE,
+ T_FALSE,
+ T_NULL,
+ );
+
+ }//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();
+ $keyword = $tokens[$stackPtr]['content'];
+ $expected = strtolower($keyword);
+ if ($keyword !== $expected) {
+ if ($keyword === strtoupper($keyword)) {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'upper');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'mixed');
+ }
+
+ $error = 'TRUE, FALSE and NULL must be lowercase; expected "%s" but found "%s"';
+ $data = array(
+ $expected,
+ $keyword,
+ );
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken($stackPtr, $expected);
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'lower');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php
new file mode 100644
index 0000000..46c80b2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php
@@ -0,0 +1,140 @@
+
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class LowerCaseKeywordSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_HALT_COMPILER,
+ T_ABSTRACT,
+ T_ARRAY,
+ T_ARRAY_HINT,
+ T_AS,
+ T_BREAK,
+ T_CALLABLE,
+ T_CASE,
+ T_CATCH,
+ T_CLASS,
+ T_CLONE,
+ T_CLOSURE,
+ T_CONST,
+ T_CONTINUE,
+ T_DECLARE,
+ T_DEFAULT,
+ T_DO,
+ T_ECHO,
+ T_ELSE,
+ T_ELSEIF,
+ T_EMPTY,
+ T_ENDDECLARE,
+ T_ENDFOR,
+ T_ENDFOREACH,
+ T_ENDIF,
+ T_ENDSWITCH,
+ T_ENDWHILE,
+ T_EVAL,
+ T_EXIT,
+ T_EXTENDS,
+ T_FINAL,
+ T_FINALLY,
+ T_FOR,
+ T_FOREACH,
+ T_FUNCTION,
+ T_GLOBAL,
+ T_GOTO,
+ T_IF,
+ T_IMPLEMENTS,
+ T_INCLUDE,
+ T_INCLUDE_ONCE,
+ T_INSTANCEOF,
+ T_INSTEADOF,
+ T_INTERFACE,
+ T_ISSET,
+ T_LIST,
+ T_LOGICAL_AND,
+ T_LOGICAL_OR,
+ T_LOGICAL_XOR,
+ T_NAMESPACE,
+ T_NEW,
+ T_PARENT,
+ T_PRINT,
+ T_PRIVATE,
+ T_PROTECTED,
+ T_PUBLIC,
+ T_REQUIRE,
+ T_REQUIRE_ONCE,
+ T_RETURN,
+ T_SELF,
+ T_STATIC,
+ T_SWITCH,
+ T_THROW,
+ T_TRAIT,
+ T_TRY,
+ T_UNSET,
+ T_USE,
+ T_VAR,
+ T_WHILE,
+ T_YIELD,
+ T_YIELD_FROM,
+ );
+
+ }//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();
+ $keyword = $tokens[$stackPtr]['content'];
+ if (strtolower($keyword) !== $keyword) {
+ if ($keyword === strtoupper($keyword)) {
+ $phpcsFile->recordMetric($stackPtr, 'PHP keyword case', 'upper');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP keyword case', 'mixed');
+ }
+
+ $error = 'PHP keywords must be lowercase; expected "%s" but found "%s"';
+ $data = array(
+ strtolower($keyword),
+ $keyword,
+ );
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken($stackPtr, strtolower($keyword));
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP keyword case', 'lower');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/NoSilencedErrorsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/NoSilencedErrorsSniff.php
new file mode 100644
index 0000000..c900218
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/NoSilencedErrorsSniff.php
@@ -0,0 +1,68 @@
+
+ * if (@in_array($array, $needle))
+ * {
+ * doSomething();
+ * }
+ *
+ *
+ * @author Andy Brockhurst
+ * @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\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class NoSilencedErrorsSniff implements Sniff
+{
+
+ /**
+ * If true, an error will be thrown; otherwise a warning.
+ *
+ * @var boolean
+ */
+ public $error = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_ASPERAND);
+
+ }//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)
+ {
+ $error = 'Silencing errors is forbidden';
+ if ($this->error === true) {
+ $error = 'Silencing errors is forbidden';
+ $phpcsFile->addError($error, $stackPtr, 'Forbidden');
+ } else {
+ $error = 'Silencing errors is discouraged';
+ $phpcsFile->addWarning($error, $stackPtr, 'Discouraged');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SAPIUsageSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SAPIUsageSniff.php
new file mode 100644
index 0000000..983c31b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SAPIUsageSniff.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\Sniffs\PHP;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class SAPIUsageSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_STRING);
+
+ }//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 = array(
+ T_DOUBLE_COLON => true,
+ T_OBJECT_OPERATOR => true,
+ T_FUNCTION => true,
+ T_CONST => true,
+ );
+
+ $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
+ if (isset($ignore[$tokens[$prevToken]['code']]) === true) {
+ // Not a call to a PHP function.
+ return;
+ }
+
+ $function = strtolower($tokens[$stackPtr]['content']);
+ if ($function === 'php_sapi_name') {
+ $error = 'Use the PHP_SAPI constant instead of calling php_sapi_name()';
+ $phpcsFile->addError($error, $stackPtr, 'FunctionFound');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php
new file mode 100644
index 0000000..f559e18
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php
@@ -0,0 +1,84 @@
+
+ * @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\Sniffs\PHP;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Config;
+
+class SyntaxSniff implements Sniff
+{
+
+ /**
+ * The path to the PHP version we are checking with.
+ *
+ * @var string
+ */
+ private $phpPath = null;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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)
+ {
+ if ($this->phpPath === null) {
+ $this->phpPath = Config::getExecutablePath('php');
+ if ($this->phpPath === null) {
+ // PHP_BINARY is available in PHP 5.4+.
+ if (defined('PHP_BINARY') === true) {
+ $this->phpPath = PHP_BINARY;
+ } else {
+ return;
+ }
+ }
+ }
+
+ $fileName = escapeshellarg($phpcsFile->getFilename());
+ if (defined('HHVM_VERSION') === false) {
+ $cmd = escapeshellcmd($this->phpPath)." -l -d error_prepend_string='' $fileName 2>&1";
+ } else {
+ $cmd = escapeshellcmd($this->phpPath)." -l $fileName 2>&1";
+ }
+
+ $output = shell_exec($cmd);
+ $matches = array();
+ if (preg_match('/^.*error:(.*) in .* on line ([0-9]+)/m', trim($output), $matches) === 1) {
+ $error = trim($matches[1]);
+ $line = (int) $matches[2];
+ $phpcsFile->addErrorOnLine("PHP syntax error: $error", $line, 'PHPSyntax');
+ }
+
+ // 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/PHP/UpperCaseConstantSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/UpperCaseConstantSniff.php
new file mode 100644
index 0000000..d8d2003
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/UpperCaseConstantSniff.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\PHP;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class UpperCaseConstantSniff implements Sniff
+{
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_TRUE,
+ T_FALSE,
+ T_NULL,
+ );
+
+ }//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();
+ $keyword = $tokens[$stackPtr]['content'];
+ $expected = strtoupper($keyword);
+ if ($keyword !== $expected) {
+ if ($keyword === strtolower($keyword)) {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'lower');
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'mixed');
+ }
+
+ $error = 'TRUE, FALSE and NULL must be uppercase; expected "%s" but found "%s"';
+ $data = array(
+ $expected,
+ $keyword,
+ );
+
+ $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Found', $data);
+ if ($fix === true) {
+ $phpcsFile->fixer->replaceToken($stackPtr, $expected);
+ }
+ } else {
+ $phpcsFile->recordMetric($stackPtr, 'PHP constant case', 'upper');
+ }
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php
new file mode 100644
index 0000000..52d973d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php
@@ -0,0 +1,125 @@
+
+ * @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\Strings;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+
+class UnnecessaryStringConcatSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+ /**
+ * If true, an error will be thrown; otherwise a warning.
+ *
+ * @var boolean
+ */
+ public $error = true;
+
+ /**
+ * If true, strings concatenated over multiple lines are allowed.
+ *
+ * Useful if you break strings over multiple lines to work
+ * within a max line length.
+ *
+ * @var boolean
+ */
+ public $allowMultiline = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(
+ T_STRING_CONCAT,
+ T_PLUS,
+ );
+
+ }//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)
+ {
+ // Work out which type of file this is for.
+ $tokens = $phpcsFile->getTokens();
+ if ($tokens[$stackPtr]['code'] === T_STRING_CONCAT) {
+ if ($phpcsFile->tokenizerType === 'JS') {
+ return;
+ }
+ } else {
+ if ($phpcsFile->tokenizerType === 'PHP') {
+ return;
+ }
+ }
+
+ $prev = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
+ $next = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
+ if ($prev === false || $next === false) {
+ return;
+ }
+
+ if (isset(Tokens::$stringTokens[$tokens[$prev]['code']]) === true
+ && isset(Tokens::$stringTokens[$tokens[$next]['code']]) === true
+ ) {
+ if ($tokens[$prev]['content'][0] === $tokens[$next]['content'][0]) {
+ // Before we throw an error for PHP, allow strings to be
+ // combined if they would have < and ? next to each other because
+ // this trick is sometimes required in PHP strings.
+ if ($phpcsFile->tokenizerType === 'PHP') {
+ $prevChar = substr($tokens[$prev]['content'], -2, 1);
+ $nextChar = $tokens[$next]['content'][1];
+ $combined = $prevChar.$nextChar;
+ if ($combined === '?'.'>' || $combined === '<'.'?') {
+ return;
+ }
+ }
+
+ if ($this->allowMultiline === true
+ && $tokens[$prev]['line'] !== $tokens[$next]['line']
+ ) {
+ return;
+ }
+
+ $error = 'String concat is not required here; use a single string instead';
+ if ($this->error === true) {
+ $phpcsFile->addError($error, $stackPtr, 'Found');
+ } else {
+ $phpcsFile->addWarning($error, $stackPtr, 'Found');
+ }
+ }//end if
+ }//end if
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/VersionControl/SubversionPropertiesSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/VersionControl/SubversionPropertiesSniff.php
new file mode 100644
index 0000000..3007de8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/VersionControl/SubversionPropertiesSniff.php
@@ -0,0 +1,188 @@
+
+ * @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\VersionControl;
+
+use PHP_CodeSniffer\Exceptions\RuntimeException;
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class SubversionPropertiesSniff implements Sniff
+{
+
+ /**
+ * The Subversion properties that should be set.
+ *
+ * Key of array is the SVN property and the value is the
+ * exact value the property should have or NULL if the
+ * property should just be set but the value is not fixed.
+ *
+ * @var array
+ */
+ protected $properties = array(
+ 'svn:keywords' => 'Author Id Revision',
+ 'svn:eol-style' => 'native',
+ );
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(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();
+
+ $path = $phpcsFile->getFileName();
+ $properties = $this->getProperties($path);
+ if ($properties === null) {
+ // Not under version control.
+ return ($phpcsFile->numTokens + 1);
+ }
+
+ $allProperties = ($properties + $this->properties);
+ foreach ($allProperties as $key => $value) {
+ if (isset($properties[$key]) === true
+ && isset($this->properties[$key]) === false
+ ) {
+ $error = 'Unexpected Subversion property "%s" = "%s"';
+ $data = array(
+ $key,
+ $properties[$key],
+ );
+ $phpcsFile->addError($error, $stackPtr, 'Unexpected', $data);
+ continue;
+ }
+
+ if (isset($properties[$key]) === false
+ && isset($this->properties[$key]) === true
+ ) {
+ $error = 'Missing Subversion property "%s" = "%s"';
+ $data = array(
+ $key,
+ $this->properties[$key],
+ );
+ $phpcsFile->addError($error, $stackPtr, 'Missing', $data);
+ continue;
+ }
+
+ if ($properties[$key] !== null
+ && $properties[$key] !== $this->properties[$key]
+ ) {
+ $error = 'Subversion property "%s" = "%s" does not match "%s"';
+ $data = array(
+ $key,
+ $properties[$key],
+ $this->properties[$key],
+ );
+ $phpcsFile->addError($error, $stackPtr, 'NoMatch', $data);
+ }
+ }//end foreach
+
+ // Ignore the rest of the file.
+ return ($phpcsFile->numTokens + 1);
+
+ }//end process()
+
+
+ /**
+ * Returns the Subversion properties which are actually set on a path.
+ *
+ * Returns NULL if the file is not under version control.
+ *
+ * @param string $path The path to return Subversion properties on.
+ *
+ * @return array
+ * @throws \PHP_CodeSniffer\Exceptions\RuntimeException If Subversion properties file could
+ * not be opened.
+ */
+ protected function getProperties($path)
+ {
+ $properties = array();
+
+ $paths = array();
+ $paths[] = dirname($path).'/.svn/props/'.basename($path).'.svn-work';
+ $paths[] = dirname($path).'/.svn/prop-base/'.basename($path).'.svn-base';
+
+ $foundPath = false;
+ foreach ($paths as $path) {
+ if (file_exists($path) === true) {
+ $foundPath = true;
+
+ $handle = fopen($path, 'r');
+ if ($handle === false) {
+ $error = 'Error opening file; could not get Subversion properties';
+ throw new RuntimeException($error);
+ }
+
+ while (feof($handle) === false) {
+ // Read a key length line. Might be END, though.
+ $buffer = trim(fgets($handle));
+
+ // Check for the end of the hash.
+ if ($buffer === 'END') {
+ break;
+ }
+
+ // Now read that much into a buffer.
+ $key = fread($handle, substr($buffer, 2));
+
+ // Suck up extra newline after key data.
+ fgetc($handle);
+
+ // Read a value length line.
+ $buffer = trim(fgets($handle));
+
+ // Now read that much into a buffer.
+ $length = substr($buffer, 2);
+ if ($length === '0') {
+ // Length of value is ZERO characters, so
+ // value is actually empty.
+ $value = '';
+ } else {
+ $value = fread($handle, $length);
+ }
+
+ // Suck up extra newline after value data.
+ fgetc($handle);
+
+ $properties[$key] = $value;
+ }//end while
+
+ fclose($handle);
+ }//end if
+ }//end foreach
+
+ if ($foundPath === false) {
+ return null;
+ }
+
+ return $properties;
+
+ }//end getProperties()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php
new file mode 100644
index 0000000..7bc4a2c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php
@@ -0,0 +1,192 @@
+
+ * @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\WhiteSpace;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DisallowSpaceIndentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ 'CSS',
+ );
+
+ /**
+ * The --tab-width CLI value that is being used.
+ *
+ * @var integer
+ */
+ private $tabWidth = null;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_OPEN_TAG);
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile All the tokens found in the document.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ if ($this->tabWidth === null) {
+ if (isset($phpcsFile->config->tabWidth) === false || $phpcsFile->config->tabWidth === 0) {
+ // We have no idea how wide tabs are, so assume 4 spaces for fixing.
+ // It shouldn't really matter because indent checks elsewhere in the
+ // standard should fix things up.
+ $this->tabWidth = 4;
+ } else {
+ $this->tabWidth = $phpcsFile->config->tabWidth;
+ }
+ }
+
+ $checkTokens = array(
+ T_WHITESPACE => true,
+ T_INLINE_HTML => true,
+ T_DOC_COMMENT_WHITESPACE => true,
+ );
+
+ $tokens = $phpcsFile->getTokens();
+ for ($i = ($stackPtr + 1); $i < $phpcsFile->numTokens; $i++) {
+ if ($tokens[$i]['column'] !== 1 || isset($checkTokens[$tokens[$i]['code']]) === false) {
+ continue;
+ }
+
+ // If tabs are being converted to spaces by the tokeniser, the
+ // original content should be checked instead of the converted content.
+ if (isset($tokens[$i]['orig_content']) === true) {
+ $content = $tokens[$i]['orig_content'];
+ } else {
+ $content = $tokens[$i]['content'];
+ }
+
+ $recordMetrics = true;
+
+ // If this is an inline HTML token, split the content into
+ // indentation whitespace and the actual HTML/text.
+ $nonWhitespace = '';
+ if ($tokens[$i]['code'] === T_INLINE_HTML && preg_match('`^(\s*)(\S.*)`s', $content, $matches) > 0) {
+ if (isset($matches[1]) === true) {
+ $content = $matches[1];
+ }
+
+ if (isset($matches[2]) === true) {
+ $nonWhitespace = $matches[2];
+ }
+ } else if (isset($tokens[($i + 1)]) === true
+ && $tokens[$i]['line'] < $tokens[($i + 1)]['line']
+ ) {
+ // There is no content after this whitespace except for a newline.
+ $content = rtrim($content, "\r\n");
+ $nonWhitespace = $phpcsFile->eolChar;
+
+ // Don't record metrics for empty lines.
+ $recordMetrics = false;
+ }
+
+ $hasSpaces = strpos($content, ' ');
+ $hasTabs = strpos($content, "\t");
+
+ if ($hasSpaces === false && $hasTabs === false) {
+ // Empty line.
+ continue;
+ }
+
+ if ($hasSpaces === false && $hasTabs !== false) {
+ // All ok, nothing to do.
+ if ($recordMetrics === true) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'tabs');
+ }
+
+ continue;
+ }
+
+ if ($tokens[$i]['code'] === T_DOC_COMMENT_WHITESPACE && $content === ' ') {
+ // Ignore file/class-level docblocks, especially for recording metrics.
+ continue;
+ }
+
+ // OK, by now we know there will be spaces.
+ // We just don't know yet whether they need to be replaced or
+ // are precision indentation, nor whether they are correctly
+ // placed at the end of the whitespace.
+ $trimmed = str_replace(' ', '', $content);
+ $numSpaces = (strlen($content) - strlen($trimmed));
+ $numTabs = (int) floor($numSpaces / $this->tabWidth);
+ $tabAfterSpaces = strpos($content, "\t", $hasSpaces);
+
+ if ($hasTabs === false) {
+ if ($recordMetrics === true) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'spaces');
+ }
+
+ if ($numTabs === 0) {
+ // Ignore: precision indentation.
+ continue;
+ }
+ } else {
+ if ($numTabs === 0) {
+ // Precision indentation.
+ if ($recordMetrics === true) {
+ if ($tabAfterSpaces !== false) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'mixed');
+ } else {
+ $phpcsFile->recordMetric($i, 'Line indent', 'tabs');
+ }
+ }
+
+ if ($tabAfterSpaces === false) {
+ // Ignore: precision indentation is already at the
+ // end of the whitespace.
+ continue;
+ }
+ } else if ($recordMetrics === true) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'mixed');
+ }
+ }//end if
+
+ $error = 'Tabs must be used to indent lines; spaces are not allowed';
+ $fix = $phpcsFile->addFixableError($error, $i, 'SpacesUsed');
+ if ($fix === true) {
+ $remaining = ($numSpaces % $this->tabWidth);
+ $padding = str_repeat("\t", $numTabs);
+ $padding .= str_repeat(' ', $remaining);
+ $phpcsFile->fixer->replaceToken($i, $trimmed.$padding.$nonWhitespace);
+ }
+ }//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/WhiteSpace/DisallowTabIndentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php
new file mode 100644
index 0000000..c2ab0dd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.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\WhiteSpace;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+
+class DisallowTabIndentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ 'CSS',
+ );
+
+ /**
+ * The --tab-width CLI value that is being used.
+ *
+ * @var integer
+ */
+ private $tabWidth = null;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ return array(T_OPEN_TAG);
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile All the tokens found in the document.
+ * @param int $stackPtr The position of the current token in
+ * the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ if ($this->tabWidth === null) {
+ if (isset($phpcsFile->config->tabWidth) === false || $phpcsFile->config->tabWidth === 0) {
+ // We have no idea how wide tabs are, so assume 4 spaces for metrics.
+ $this->tabWidth = 4;
+ } else {
+ $this->tabWidth = $phpcsFile->config->tabWidth;
+ }
+ }
+
+ $tokens = $phpcsFile->getTokens();
+ $error = 'Spaces must be used to indent lines; tabs are not allowed';
+ $errorCode = 'TabsUsed';
+
+ $checkTokens = array(
+ T_WHITESPACE => true,
+ T_INLINE_HTML => true,
+ T_DOC_COMMENT_WHITESPACE => true,
+ T_DOC_COMMENT_STRING => true,
+ );
+
+ for ($i = ($stackPtr + 1); $i < $phpcsFile->numTokens; $i++) {
+ if (isset($checkTokens[$tokens[$i]['code']]) === false) {
+ continue;
+ }
+
+ // If tabs are being converted to spaces by the tokeniser, the
+ // original content should be checked instead of the converted content.
+ if (isset($tokens[$i]['orig_content']) === true) {
+ $content = $tokens[$i]['orig_content'];
+ } else {
+ $content = $tokens[$i]['content'];
+ }
+
+ if ($content === '') {
+ continue;
+ }
+
+ if ($tokens[$i]['code'] === T_DOC_COMMENT_WHITESPACE && $content === ' ') {
+ // Ignore file/class-level DocBlock, especially for recording metrics.
+ continue;
+ }
+
+ $recordMetrics = true;
+ if (isset($tokens[($i + 1)]) === true
+ && $tokens[$i]['line'] < $tokens[($i + 1)]['line']
+ ) {
+ // Don't record metrics for empty lines.
+ $recordMetrics = false;
+ }
+
+ $tabFound = false;
+ if ($tokens[$i]['column'] === 1) {
+ if ($content[0] === "\t") {
+ $tabFound = true;
+ if ($recordMetrics === true) {
+ $spacePosition = strpos($content, ' ');
+ $tabAfterSpaces = strpos($content, "\t", $spacePosition);
+ if ($spacePosition !== false && $tabAfterSpaces !== false) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'mixed');
+ } else {
+ // Check for use of precision spaces.
+ $trimmed = str_replace(' ', '', $content);
+ $numSpaces = (strlen($content) - strlen($trimmed));
+ $numTabs = (int) floor($numSpaces / $this->tabWidth);
+ if ($numTabs === 0) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'tabs');
+ } else {
+ $phpcsFile->recordMetric($i, 'Line indent', 'mixed');
+ }
+ }
+ }
+ } else if ($content[0] === ' ') {
+ if (strpos($content, "\t") !== false) {
+ if ($recordMetrics === true) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'mixed');
+ }
+
+ $tabFound = true;
+ } else if ($recordMetrics === true) {
+ $phpcsFile->recordMetric($i, 'Line indent', 'spaces');
+ }
+ }//end if
+ } else {
+ // Look for tabs so we can report and replace, but don't
+ // record any metrics about them because they aren't
+ // line indent tokens.
+ if (strpos($content, "\t") !== false) {
+ $tabFound = true;
+ $error = 'Spaces must be used for alignment; tabs are not allowed';
+ $errorCode = 'NonIndentTabsUsed';
+ }
+ }//end if
+
+ if ($tabFound === false) {
+ continue;
+ }
+
+ $fix = $phpcsFile->addFixableError($error, $i, $errorCode);
+ if ($fix === true) {
+ if (isset($tokens[$i]['orig_content']) === true) {
+ // Use the replacement that PHPCS has already done.
+ $phpcsFile->fixer->replaceToken($i, $tokens[$i]['content']);
+ } else {
+ // Replace tabs with spaces, using an indent of 4 spaces.
+ // Other sniffs can then correct the indent if they need to.
+ $newContent = str_replace("\t", ' ', $tokens[$i]['content']);
+ $phpcsFile->fixer->replaceToken($i, $newContent);
+ }
+ }
+ }//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/WhiteSpace/ScopeIndentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
new file mode 100644
index 0000000..bdb1b2f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
@@ -0,0 +1,1296 @@
+
+ * @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\WhiteSpace;
+
+use PHP_CodeSniffer\Sniffs\Sniff;
+use PHP_CodeSniffer\Files\File;
+use PHP_CodeSniffer\Util\Tokens;
+use PHP_CodeSniffer\Config;
+
+class ScopeIndentSniff implements Sniff
+{
+
+ /**
+ * A list of tokenizers this sniff supports.
+ *
+ * @var array
+ */
+ public $supportedTokenizers = array(
+ 'PHP',
+ 'JS',
+ );
+
+ /**
+ * The number of spaces code should be indented.
+ *
+ * @var integer
+ */
+ public $indent = 4;
+
+ /**
+ * Does the indent need to be exactly right?
+ *
+ * If TRUE, indent needs to be exactly $indent spaces. If FALSE,
+ * indent needs to be at least $indent spaces (but can be more).
+ *
+ * @var boolean
+ */
+ public $exact = false;
+
+ /**
+ * Should tabs be used for indenting?
+ *
+ * If TRUE, fixes will be made using tabs instead of spaces.
+ * The size of each tab is important, so it should be specified
+ * using the --tab-width CLI argument.
+ *
+ * @var boolean
+ */
+ public $tabIndent = false;
+
+ /**
+ * The --tab-width CLI value that is being used.
+ *
+ * @var integer
+ */
+ private $tabWidth = null;
+
+ /**
+ * List of tokens not needing to be checked for indentation.
+ *
+ * Useful to allow Sniffs based on this to easily ignore/skip some
+ * tokens from verification. For example, inline HTML sections
+ * or PHP open/close tags can escape from here and have their own
+ * rules elsewhere.
+ *
+ * @var int[]
+ */
+ public $ignoreIndentationTokens = array();
+
+ /**
+ * List of tokens not needing to be checked for indentation.
+ *
+ * This is a cached copy of the public version of this var, which
+ * can be set in a ruleset file, and some core ignored tokens.
+ *
+ * @var int[]
+ */
+ private $ignoreIndentation = array();
+
+ /**
+ * Any scope openers that should not cause an indent.
+ *
+ * @var int[]
+ */
+ protected $nonIndentingScopes = array();
+
+ /**
+ * Show debug output for this sniff.
+ *
+ * @var boolean
+ */
+ private $debug = false;
+
+
+ /**
+ * Returns an array of tokens this test wants to listen for.
+ *
+ * @return array
+ */
+ public function register()
+ {
+ if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
+ $this->debug = false;
+ }
+
+ return array(T_OPEN_TAG);
+
+ }//end register()
+
+
+ /**
+ * Processes this test, when one of its tokens is encountered.
+ *
+ * @param \PHP_CodeSniffer\Files\File $phpcsFile All the tokens found in the document.
+ * @param int $stackPtr The position of the current token
+ * in the stack passed in $tokens.
+ *
+ * @return void
+ */
+ public function process(File $phpcsFile, $stackPtr)
+ {
+ $debug = Config::getConfigData('scope_indent_debug');
+ if ($debug !== null) {
+ $this->debug = (bool) $debug;
+ }
+
+ if ($this->tabWidth === null) {
+ if (isset($phpcsFile->config->tabWidth) === false || $phpcsFile->config->tabWidth === 0) {
+ // We have no idea how wide tabs are, so assume 4 spaces for fixing.
+ // It shouldn't really matter because indent checks elsewhere in the
+ // standard should fix things up.
+ $this->tabWidth = 4;
+ } else {
+ $this->tabWidth = $phpcsFile->config->tabWidth;
+ }
+ }
+
+ $currentIndent = 0;
+ $lastOpenTag = $stackPtr;
+ $lastCloseTag = null;
+ $openScopes = array();
+ $adjustments = array();
+ $setIndents = array();
+
+ $tokens = $phpcsFile->getTokens();
+ $first = $phpcsFile->findFirstOnLine(T_INLINE_HTML, $stackPtr);
+ $trimmed = ltrim($tokens[$first]['content']);
+ if ($trimmed === '') {
+ $currentIndent = ($tokens[$stackPtr]['column'] - 1);
+ } else {
+ $currentIndent = (strlen($tokens[$first]['content']) - strlen($trimmed));
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$stackPtr]['line'];
+ echo "Start with token $stackPtr on line $line with indent $currentIndent".PHP_EOL;
+ }
+
+ if (empty($this->ignoreIndentation) === true) {
+ $this->ignoreIndentation = array(T_INLINE_HTML => true);
+ foreach ($this->ignoreIndentationTokens as $token) {
+ if (is_int($token) === false) {
+ if (defined($token) === false) {
+ continue;
+ }
+
+ $token = constant($token);
+ }
+
+ $this->ignoreIndentation[$token] = true;
+ }
+ }//end if
+
+ $this->exact = (bool) $this->exact;
+ $this->tabIndent = (bool) $this->tabIndent;
+
+ for ($i = ($stackPtr + 1); $i < $phpcsFile->numTokens; $i++) {
+ if ($i === false) {
+ // Something has gone very wrong; maybe a parse error.
+ break;
+ }
+
+ $checkToken = null;
+ $checkIndent = null;
+
+ $exact = (bool) $this->exact;
+ if ($exact === true && isset($tokens[$i]['nested_parenthesis']) === true) {
+ // Don't check indents exactly between parenthesis as they
+ // tend to have custom rules, such as with multi-line function calls
+ // and control structure conditions.
+ $exact = false;
+ }
+
+ // Detect line changes and figure out where the indent is.
+ if ($tokens[$i]['column'] === 1) {
+ $trimmed = ltrim($tokens[$i]['content']);
+ if ($trimmed === '') {
+ if (isset($tokens[($i + 1)]) === true
+ && $tokens[$i]['line'] === $tokens[($i + 1)]['line']
+ ) {
+ $checkToken = ($i + 1);
+ $tokenIndent = ($tokens[($i + 1)]['column'] - 1);
+ }
+ } else {
+ $checkToken = $i;
+ $tokenIndent = (strlen($tokens[$i]['content']) - strlen($trimmed));
+ }
+ }
+
+ // Closing parenthesis should just be indented to at least
+ // the same level as where they were opened (but can be more).
+ if (($checkToken !== null
+ && $tokens[$checkToken]['code'] === T_CLOSE_PARENTHESIS
+ && isset($tokens[$checkToken]['parenthesis_opener']) === true)
+ || ($tokens[$i]['code'] === T_CLOSE_PARENTHESIS
+ && isset($tokens[$i]['parenthesis_opener']) === true)
+ ) {
+ if ($checkToken !== null) {
+ $parenCloser = $checkToken;
+ } else {
+ $parenCloser = $i;
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Closing parenthesis found on line $line".PHP_EOL;
+ }
+
+ $parenOpener = $tokens[$parenCloser]['parenthesis_opener'];
+ if ($tokens[$parenCloser]['line'] !== $tokens[$parenOpener]['line']) {
+ $parens = 0;
+ if (isset($tokens[$parenCloser]['nested_parenthesis']) === true
+ && empty($tokens[$parenCloser]['nested_parenthesis']) === false
+ ) {
+ end($tokens[$parenCloser]['nested_parenthesis']);
+ $parens = key($tokens[$parenCloser]['nested_parenthesis']);
+ if ($this->debug === true) {
+ $line = $tokens[$parens]['line'];
+ echo "\t* token has nested parenthesis $parens on line $line *".PHP_EOL;
+ }
+ }
+
+ $condition = 0;
+ if (isset($tokens[$parenCloser]['conditions']) === true
+ && empty($tokens[$parenCloser]['conditions']) === false
+ ) {
+ end($tokens[$parenCloser]['conditions']);
+ $condition = key($tokens[$parenCloser]['conditions']);
+ if ($this->debug === true) {
+ $line = $tokens[$condition]['line'];
+ $type = $tokens[$condition]['type'];
+ echo "\t* token is inside condition $condition ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ if ($parens > $condition) {
+ if ($this->debug === true) {
+ echo "\t* using parenthesis *".PHP_EOL;
+ }
+
+ $parenOpener = $parens;
+ $condition = 0;
+ } else if ($condition > 0) {
+ if ($this->debug === true) {
+ echo "\t* using condition *".PHP_EOL;
+ }
+
+ $parenOpener = $condition;
+ $parens = 0;
+ }
+
+ $exact = false;
+
+ $lastOpenTagConditions = array_keys($tokens[$lastOpenTag]['conditions']);
+ $lastOpenTagCondition = array_pop($lastOpenTagConditions);
+
+ if ($condition > 0 && $lastOpenTagCondition === $condition) {
+ if ($this->debug === true) {
+ echo "\t* open tag is inside condition; using open tag *".PHP_EOL;
+ }
+
+ $checkIndent = ($tokens[$lastOpenTag]['column'] - 1);
+ if (isset($adjustments[$condition]) === true) {
+ $checkIndent += $adjustments[$condition];
+ }
+
+ $currentIndent = $checkIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$lastOpenTag]['type'];
+ echo "\t=> checking indent of $checkIndent; main indent set to $currentIndent by token $lastOpenTag ($type)".PHP_EOL;
+ }
+ } else if ($condition > 0
+ && isset($tokens[$condition]['scope_opener']) === true
+ && isset($setIndents[$tokens[$condition]['scope_opener']]) === true
+ ) {
+ $checkIndent = $setIndents[$tokens[$condition]['scope_opener']];
+ if (isset($adjustments[$condition]) === true) {
+ $checkIndent += $adjustments[$condition];
+ }
+
+ $currentIndent = $checkIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$condition]['type'];
+ echo "\t=> checking indent of $checkIndent; main indent set to $currentIndent by token $condition ($type)".PHP_EOL;
+ }
+ } else {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $parenOpener, true);
+
+ $checkIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $checkIndent += $adjustments[$first];
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* first token on line $line is $first ($type) *".PHP_EOL;
+ }
+
+ if ($first === $tokens[$parenCloser]['parenthesis_opener']) {
+ // This is unlikely to be the start of the statement, so look
+ // back further to find it.
+ $first--;
+ }
+
+ $prev = $phpcsFile->findStartOfStatement($first, T_COMMA);
+ if ($prev !== $first) {
+ // This is not the start of the statement.
+ if ($this->debug === true) {
+ $line = $tokens[$prev]['line'];
+ $type = $tokens[$prev]['type'];
+ echo "\t* previous is $type on line $line *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ $prev = $phpcsFile->findStartOfStatement($first, T_COMMA);
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* amended first token is $first ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ if (isset($tokens[$first]['scope_closer']) === true
+ && $tokens[$first]['scope_closer'] === $first
+ ) {
+ if ($this->debug === true) {
+ echo "\t* first token is a scope closer *".PHP_EOL;
+ }
+
+ if (isset($tokens[$first]['scope_condition']) === true) {
+ $scopeCloser = $first;
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['scope_condition'], true);
+
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ if ($tokens[$tokens[$scopeCloser]['scope_condition']]['code'] !== T_CLOSURE) {
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ }
+
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+ }//end if
+ } else {
+ // Don't force current indent to divisible because there could be custom
+ // rules in place between parenthesis, such as with arrays.
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> checking indent of $checkIndent; main indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+ }//end if
+ }//end if
+ } else if ($this->debug === true) {
+ echo "\t * ignoring single-line definition *".PHP_EOL;
+ }//end if
+ }//end if
+
+ // Closing short array bracket should just be indented to at least
+ // the same level as where it was opened (but can be more).
+ if ($tokens[$i]['code'] === T_CLOSE_SHORT_ARRAY
+ || ($checkToken !== null
+ && $tokens[$checkToken]['code'] === T_CLOSE_SHORT_ARRAY)
+ ) {
+ if ($checkToken !== null) {
+ $arrayCloser = $checkToken;
+ } else {
+ $arrayCloser = $i;
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$arrayCloser]['line'];
+ echo "Closing short array bracket found on line $line".PHP_EOL;
+ }
+
+ $arrayOpener = $tokens[$arrayCloser]['bracket_opener'];
+ if ($tokens[$arrayCloser]['line'] !== $tokens[$arrayOpener]['line']) {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $arrayOpener, true);
+ $checkIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $checkIndent += $adjustments[$first];
+ }
+
+ $exact = false;
+
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* first token on line $line is $first ($type) *".PHP_EOL;
+ }
+
+ if ($first === $tokens[$arrayCloser]['bracket_opener']) {
+ // This is unlikely to be the start of the statement, so look
+ // back further to find it.
+ $first--;
+ }
+
+ $prev = $phpcsFile->findStartOfStatement($first, array(T_COMMA, T_DOUBLE_ARROW));
+ if ($prev !== $first) {
+ // This is not the start of the statement.
+ if ($this->debug === true) {
+ $line = $tokens[$prev]['line'];
+ $type = $tokens[$prev]['type'];
+ echo "\t* previous is $type on line $line *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ $prev = $phpcsFile->findStartOfStatement($first, array(T_COMMA, T_DOUBLE_ARROW));
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* amended first token is $first ($type) on line $line *".PHP_EOL;
+ }
+ } else if ($tokens[$first]['code'] === T_WHITESPACE) {
+ $first = $phpcsFile->findNext(T_WHITESPACE, ($first + 1), null, true);
+ }
+
+ if (isset($tokens[$first]['scope_closer']) === true
+ && $tokens[$first]['scope_closer'] === $first
+ ) {
+ // The first token is a scope closer and would have already
+ // been processed and set the indent level correctly, so
+ // don't adjust it again.
+ if ($this->debug === true) {
+ echo "\t* first token is a scope closer; ignoring closing short array bracket *".PHP_EOL;
+ }
+
+ if (isset($setIndents[$first]) === true) {
+ $currentIndent = $setIndents[$first];
+ if ($this->debug === true) {
+ echo "\t=> indent reset to $currentIndent".PHP_EOL;
+ }
+ }
+ } else {
+ // Don't force current indent to be divisible because there could be custom
+ // rules in place for arrays.
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> checking indent of $checkIndent; main indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+ }//end if
+ } else if ($this->debug === true) {
+ echo "\t * ignoring single-line definition *".PHP_EOL;
+ }//end if
+ }//end if
+
+ // Adjust lines within scopes while auto-fixing.
+ if ($checkToken !== null
+ && $exact === false
+ && (empty($tokens[$checkToken]['conditions']) === false
+ || (isset($tokens[$checkToken]['scope_opener']) === true
+ && $tokens[$checkToken]['scope_opener'] === $checkToken))
+ ) {
+ if (empty($tokens[$checkToken]['conditions']) === false) {
+ end($tokens[$checkToken]['conditions']);
+ $condition = key($tokens[$checkToken]['conditions']);
+ } else {
+ $condition = $tokens[$checkToken]['scope_condition'];
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $condition, true);
+
+ if (isset($adjustments[$first]) === true
+ && (($adjustments[$first] < 0 && $tokenIndent > $currentIndent)
+ || ($adjustments[$first] > 0 && $tokenIndent < $currentIndent))
+ ) {
+ $padding = ($tokenIndent + $adjustments[$first]);
+ if ($padding > 0) {
+ if ($this->tabIndent === true) {
+ $numTabs = floor($padding / $this->tabWidth);
+ $numSpaces = ($padding - ($numTabs * $this->tabWidth));
+ $padding = str_repeat("\t", $numTabs).str_repeat(' ', $numSpaces);
+ } else {
+ $padding = str_repeat(' ', $padding);
+ }
+ } else {
+ $padding = '';
+ }
+
+ if ($phpcsFile->fixer->enabled === true) {
+ if ($checkToken === $i) {
+ $phpcsFile->fixer->replaceToken($checkToken, $padding.$trimmed);
+ } else {
+ // Easier to just replace the entire indent.
+ $phpcsFile->fixer->replaceToken(($checkToken - 1), $padding);
+ }
+ }
+
+ if ($this->debug === true) {
+ $length = strlen($padding);
+ $line = $tokens[$checkToken]['line'];
+ $type = $tokens[$checkToken]['type'];
+ echo "Indent adjusted to $length for $type on line $line".PHP_EOL;
+ }
+
+ $adjustments[$checkToken] = $adjustments[$first];
+
+ if ($this->debug === true) {
+ $line = $tokens[$checkToken]['line'];
+ $type = $tokens[$checkToken]['type'];
+ echo "\t=> Add adjustment of ".$adjustments[$checkToken]." for token $checkToken ($type) on line $line".PHP_EOL;
+ }
+ }//end if
+ }//end if
+
+ // Scope closers reset the required indent to the same level as the opening condition.
+ if (($checkToken !== null
+ && isset($openScopes[$checkToken]) === true
+ || (isset($tokens[$checkToken]['scope_condition']) === true
+ && isset($tokens[$checkToken]['scope_closer']) === true
+ && $tokens[$checkToken]['scope_closer'] === $checkToken
+ && $tokens[$checkToken]['line'] !== $tokens[$tokens[$checkToken]['scope_opener']]['line']))
+ || ($checkToken === null
+ && isset($openScopes[$i]) === true
+ || (isset($tokens[$i]['scope_condition']) === true
+ && isset($tokens[$i]['scope_closer']) === true
+ && $tokens[$i]['scope_closer'] === $i
+ && $tokens[$i]['line'] !== $tokens[$tokens[$i]['scope_opener']]['line']))
+ ) {
+ if ($this->debug === true) {
+ if ($checkToken === null) {
+ $type = $tokens[$tokens[$i]['scope_condition']]['type'];
+ $line = $tokens[$i]['line'];
+ } else {
+ $type = $tokens[$tokens[$checkToken]['scope_condition']]['type'];
+ $line = $tokens[$checkToken]['line'];
+ }
+
+ echo "Close scope ($type) on line $line".PHP_EOL;
+ }
+
+ $scopeCloser = $checkToken;
+ if ($scopeCloser === null) {
+ $scopeCloser = $i;
+ } else {
+ array_pop($openScopes);
+ }
+
+ if (isset($tokens[$scopeCloser]['scope_condition']) === true) {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['scope_condition'], true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* first token is $first ($type) on line $line *".PHP_EOL;
+ }
+
+ while ($tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
+ && $tokens[($first - 1)]['code'] === T_CONSTANT_ENCAPSED_STRING
+ ) {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, ($first - 1), true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* found multi-line string; amended first token is $first ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ if ($tokens[$tokens[$scopeCloser]['scope_condition']]['code'] !== T_CLOSURE) {
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ }
+
+ $setIndents[$scopeCloser] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$scopeCloser]['type'];
+ echo "\t=> indent set to $currentIndent by token $scopeCloser ($type)".PHP_EOL;
+ }
+
+ // We only check the indent of scope closers if they are
+ // curly braces because other constructs tend to have different rules.
+ if ($tokens[$scopeCloser]['code'] === T_CLOSE_CURLY_BRACKET) {
+ $exact = true;
+ } else {
+ $checkToken = null;
+ }
+ }//end if
+ }//end if
+
+ // Handle scope for JS object notation.
+ if ($phpcsFile->tokenizerType === 'JS'
+ && (($checkToken !== null
+ && $tokens[$checkToken]['code'] === T_CLOSE_OBJECT
+ && $tokens[$checkToken]['line'] !== $tokens[$tokens[$checkToken]['bracket_opener']]['line'])
+ || ($checkToken === null
+ && $tokens[$i]['code'] === T_CLOSE_OBJECT
+ && $tokens[$i]['line'] !== $tokens[$tokens[$i]['bracket_opener']]['line']))
+ ) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Close JS object on line $line".PHP_EOL;
+ }
+
+ $scopeCloser = $checkToken;
+ if ($scopeCloser === null) {
+ $scopeCloser = $i;
+ } else {
+ array_pop($openScopes);
+ }
+
+ $parens = 0;
+ if (isset($tokens[$scopeCloser]['nested_parenthesis']) === true
+ && empty($tokens[$scopeCloser]['nested_parenthesis']) === false
+ ) {
+ end($tokens[$scopeCloser]['nested_parenthesis']);
+ $parens = key($tokens[$scopeCloser]['nested_parenthesis']);
+ if ($this->debug === true) {
+ $line = $tokens[$parens]['line'];
+ echo "\t* token has nested parenthesis $parens on line $line *".PHP_EOL;
+ }
+ }
+
+ $condition = 0;
+ if (isset($tokens[$scopeCloser]['conditions']) === true
+ && empty($tokens[$scopeCloser]['conditions']) === false
+ ) {
+ end($tokens[$scopeCloser]['conditions']);
+ $condition = key($tokens[$scopeCloser]['conditions']);
+ if ($this->debug === true) {
+ $line = $tokens[$condition]['line'];
+ $type = $tokens[$condition]['type'];
+ echo "\t* token is inside condition $condition ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ if ($parens > $condition) {
+ if ($this->debug === true) {
+ echo "\t* using parenthesis *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $parens, true);
+ $condition = 0;
+ } else if ($condition > 0) {
+ if ($this->debug === true) {
+ echo "\t* using condition *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $condition, true);
+ $parens = 0;
+ } else {
+ if ($this->debug === true) {
+ $line = $tokens[$tokens[$scopeCloser]['bracket_opener']]['line'];
+ echo "\t* token is not in parenthesis or condition; using opener on line $line *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $tokens[$scopeCloser]['bracket_opener'], true);
+ }//end if
+
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ if ($parens > 0 || $condition > 0) {
+ $checkIndent = ($tokens[$first]['column'] - 1);
+ if (isset($adjustments[$first]) === true) {
+ $checkIndent += $adjustments[$first];
+ }
+
+ if ($condition > 0) {
+ $checkIndent += $this->indent;
+ $currentIndent += $this->indent;
+ $exact = true;
+ }
+ } else {
+ $checkIndent = $currentIndent;
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ $checkIndent = (int) (ceil($checkIndent / $this->indent) * $this->indent);
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> checking indent of $checkIndent; main indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+ }//end if
+
+ if ($checkToken !== null
+ && isset(Tokens::$scopeOpeners[$tokens[$checkToken]['code']]) === true
+ && in_array($tokens[$checkToken]['code'], $this->nonIndentingScopes) === false
+ && isset($tokens[$checkToken]['scope_opener']) === true
+ ) {
+ $exact = true;
+
+ $lastOpener = null;
+ if (empty($openScopes) === false) {
+ end($openScopes);
+ $lastOpener = current($openScopes);
+ }
+
+ // A scope opener that shares a closer with another token (like multiple
+ // CASEs using the same BREAK) needs to reduce the indent level so its
+ // indent is checked correctly. It will then increase the indent again
+ // (as all openers do) after being checked.
+ if ($lastOpener !== null
+ && isset($tokens[$lastOpener]['scope_closer']) === true
+ && $tokens[$lastOpener]['level'] === $tokens[$checkToken]['level']
+ && $tokens[$lastOpener]['scope_closer'] === $tokens[$checkToken]['scope_closer']
+ ) {
+ $currentIndent -= $this->indent;
+ $setIndents[$lastOpener] = $currentIndent;
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ $type = $tokens[$lastOpener]['type'];
+ echo "Shared closer found on line $line".PHP_EOL;
+ echo "\t=> indent set to $currentIndent by token $lastOpener ($type)".PHP_EOL;
+ }
+ }
+
+ if ($tokens[$checkToken]['code'] === T_CLOSURE
+ && $tokenIndent > $currentIndent
+ ) {
+ // The opener is indented more than needed, which is fine.
+ // But just check that it is divisible by our expected indent.
+ $checkIndent = (int) (ceil($tokenIndent / $this->indent) * $this->indent);
+ $exact = false;
+
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Closure found on line $line".PHP_EOL;
+ echo "\t=> checking indent of $checkIndent; main indent remains at $currentIndent".PHP_EOL;
+ }
+ }
+ }//end if
+
+ // Method prefix indentation has to be exact or else if will break
+ // the rest of the function declaration, and potentially future ones.
+ if ($checkToken !== null
+ && isset(Tokens::$methodPrefixes[$tokens[$checkToken]['code']]) === true
+ && $tokens[($checkToken + 1)]['code'] !== T_DOUBLE_COLON
+ ) {
+ $exact = true;
+ }
+
+ // JS property indentation has to be exact or else if will break
+ // things like function and object indentation.
+ if ($checkToken !== null && $tokens[$checkToken]['code'] === T_PROPERTY) {
+ $exact = true;
+ }
+
+ // PHP tags needs to be indented to exact column positions
+ // so they don't cause problems with indent checks for the code
+ // within them, but they don't need to line up with the current indent.
+ if ($checkToken !== null
+ && ($tokens[$checkToken]['code'] === T_OPEN_TAG
+ || $tokens[$checkToken]['code'] === T_OPEN_TAG_WITH_ECHO
+ || $tokens[$checkToken]['code'] === T_CLOSE_TAG)
+ ) {
+ $exact = true;
+ $checkIndent = ($tokens[$checkToken]['column'] - 1);
+ $checkIndent = (int) (ceil($checkIndent / $this->indent) * $this->indent);
+ }
+
+ // Special case for ELSE statements that are not on the same
+ // line as the previous IF statements closing brace. They still need
+ // to have the same indent or it will break code after the block.
+ if ($checkToken !== null && $tokens[$checkToken]['code'] === T_ELSE) {
+ $exact = true;
+ }
+
+ if ($checkIndent === null) {
+ $checkIndent = $currentIndent;
+ }
+
+ /*
+ The indent of the line is checked by the following IF block.
+
+ Up until now, we've just been figuring out what the indent
+ of this line should be.
+
+ After this IF block, we adjust the indent again for
+ the checking of future line.
+ */
+
+ $adjusted = false;
+ if ($checkToken !== null
+ && isset($this->ignoreIndentation[$tokens[$checkToken]['code']]) === false
+ && (($tokenIndent !== $checkIndent && $exact === true)
+ || ($tokenIndent < $checkIndent && $exact === false))
+ ) {
+ $type = 'IncorrectExact';
+ $error = 'Line indented incorrectly; expected ';
+ if ($exact === false) {
+ $error .= 'at least ';
+ $type = 'Incorrect';
+ }
+
+ if ($this->tabIndent === true) {
+ $error .= '%s tabs, found %s';
+ $data = array(
+ floor($checkIndent / $this->tabWidth),
+ floor($tokenIndent / $this->tabWidth),
+ );
+ } else {
+ $error .= '%s spaces, found %s';
+ $data = array(
+ $checkIndent,
+ $tokenIndent,
+ );
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$checkToken]['line'];
+ $message = vsprintf($error, $data);
+ echo "[Line $line] $message".PHP_EOL;
+ }
+
+ $fix = $phpcsFile->addFixableError($error, $checkToken, $type, $data);
+ if ($fix === true || $this->debug === true) {
+ $padding = '';
+ if ($this->tabIndent === true) {
+ $numTabs = floor($checkIndent / $this->tabWidth);
+ if ($numTabs > 0) {
+ $numSpaces = ($checkIndent - ($numTabs * $this->tabWidth));
+ $padding = str_repeat("\t", $numTabs).str_repeat(' ', $numSpaces);
+ }
+ } else if ($checkIndent > 0) {
+ $padding = str_repeat(' ', $checkIndent);
+ }
+
+ if ($checkToken === $i) {
+ $accepted = $phpcsFile->fixer->replaceToken($checkToken, $padding.$trimmed);
+ } else {
+ // Easier to just replace the entire indent.
+ $accepted = $phpcsFile->fixer->replaceToken(($checkToken - 1), $padding);
+ }
+
+ if ($accepted === true) {
+ $adjustments[$checkToken] = ($checkIndent - $tokenIndent);
+ if ($this->debug === true) {
+ $line = $tokens[$checkToken]['line'];
+ $type = $tokens[$checkToken]['type'];
+ echo "\t=> Add adjustment of ".$adjustments[$checkToken]." for token $checkToken ($type) on line $line".PHP_EOL;
+ }
+ }
+ } else {
+ // Assume the change would be applied and continue
+ // checking indents under this assumption. This gives more
+ // technically accurate error messages.
+ $adjustments[$checkToken] = ($checkIndent - $tokenIndent);
+ }//end if
+ }//end if
+
+ if ($checkToken !== null) {
+ $i = $checkToken;
+ }
+
+ // Completely skip here/now docs as the indent is a part of the
+ // content itself.
+ if ($tokens[$i]['code'] === T_START_HEREDOC
+ || $tokens[$i]['code'] === T_START_NOWDOC
+ ) {
+ $i = $phpcsFile->findNext(array(T_END_HEREDOC, T_END_NOWDOC), ($i + 1));
+ continue;
+ }
+
+ // Completely skip multi-line strings as the indent is a part of the
+ // content itself.
+ if ($tokens[$i]['code'] === T_CONSTANT_ENCAPSED_STRING
+ || $tokens[$i]['code'] === T_DOUBLE_QUOTED_STRING
+ ) {
+ $i = $phpcsFile->findNext($tokens[$i]['code'], ($i + 1), null, true);
+ $i--;
+ continue;
+ }
+
+ // Completely skip doc comments as they tend to have complex
+ // indentation rules.
+ if ($tokens[$i]['code'] === T_DOC_COMMENT_OPEN_TAG) {
+ $i = $tokens[$i]['comment_closer'];
+ continue;
+ }
+
+ // Open tags reset the indent level.
+ if ($tokens[$i]['code'] === T_OPEN_TAG
+ || $tokens[$i]['code'] === T_OPEN_TAG_WITH_ECHO
+ ) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Open PHP tag found on line $line".PHP_EOL;
+ }
+
+ if ($checkToken === null) {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $i, true);
+ $currentIndent = (strlen($tokens[$first]['content']) - strlen(ltrim($tokens[$first]['content'])));
+ } else {
+ $currentIndent = ($tokens[$i]['column'] - 1);
+ }
+
+ $lastOpenTag = $i;
+
+ if (isset($adjustments[$i]) === true) {
+ $currentIndent += $adjustments[$i];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ $setIndents[$i] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$i]['type'];
+ echo "\t=> indent set to $currentIndent by token $i ($type)".PHP_EOL;
+ }
+
+ continue;
+ }//end if
+
+ // Close tags reset the indent level, unless they are closing a tag
+ // opened on the same line.
+ if ($tokens[$i]['code'] === T_CLOSE_TAG) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Close PHP tag found on line $line".PHP_EOL;
+ }
+
+ if ($tokens[$lastOpenTag]['line'] !== $tokens[$i]['line']) {
+ $currentIndent = ($tokens[$i]['column'] - 1);
+ $lastCloseTag = $i;
+ } else {
+ if ($lastCloseTag === null) {
+ $currentIndent = 0;
+ } else {
+ $currentIndent = ($tokens[$lastCloseTag]['column'] - 1);
+ }
+ }
+
+ if (isset($adjustments[$i]) === true) {
+ $currentIndent += $adjustments[$i];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ $setIndents[$i] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$i]['type'];
+ echo "\t=> indent set to $currentIndent by token $i ($type)".PHP_EOL;
+ }
+
+ continue;
+ }//end if
+
+ // Anon classes and functions set the indent based on their own indent level.
+ if ($tokens[$i]['code'] === T_CLOSURE || $tokens[$i]['code'] === T_ANON_CLASS) {
+ $closer = $tokens[$i]['scope_closer'];
+ if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
+ if ($this->debug === true) {
+ $type = str_replace('_', ' ', strtolower(substr($tokens[$i]['type'], 2)));
+ $line = $tokens[$i]['line'];
+ echo "* ignoring single-line $type on line $line".PHP_EOL;
+ }
+
+ $i = $closer;
+ continue;
+ }
+
+ if ($this->debug === true) {
+ $type = str_replace('_', ' ', strtolower(substr($tokens[$i]['type'], 2)));
+ $line = $tokens[$i]['line'];
+ echo "Open $type on line $line".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $i, true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* first token is $first ($type) on line $line *".PHP_EOL;
+ }
+
+ while ($tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
+ && $tokens[($first - 1)]['code'] === T_CONSTANT_ENCAPSED_STRING
+ ) {
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, ($first - 1), true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* found multi-line string; amended first token is $first ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ $currentIndent = (($tokens[$first]['column'] - 1) + $this->indent);
+ $openScopes[$tokens[$i]['scope_closer']] = $tokens[$i]['scope_condition'];
+
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (floor($currentIndent / $this->indent) * $this->indent);
+ $i = $tokens[$i]['scope_opener'];
+ $setIndents[$i] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$i]['type'];
+ echo "\t=> indent set to $currentIndent by token $i ($type)".PHP_EOL;
+ }
+
+ continue;
+ }//end if
+
+ // Scope openers increase the indent level.
+ if (isset($tokens[$i]['scope_condition']) === true
+ && isset($tokens[$i]['scope_opener']) === true
+ && $tokens[$i]['scope_opener'] === $i
+ ) {
+ $closer = $tokens[$i]['scope_closer'];
+ if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ $type = $tokens[$i]['type'];
+ echo "* ignoring single-line $type on line $line".PHP_EOL;
+ }
+
+ $i = $closer;
+ continue;
+ }
+
+ $condition = $tokens[$tokens[$i]['scope_condition']]['code'];
+ if (isset(Tokens::$scopeOpeners[$condition]) === true
+ && in_array($condition, $this->nonIndentingScopes) === false
+ ) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ $type = $tokens[$tokens[$i]['scope_condition']]['type'];
+ echo "Open scope ($type) on line $line".PHP_EOL;
+ }
+
+ $currentIndent += $this->indent;
+ $setIndents[$i] = $currentIndent;
+ $openScopes[$tokens[$i]['scope_closer']] = $tokens[$i]['scope_condition'];
+
+ if ($this->debug === true) {
+ $type = $tokens[$i]['type'];
+ echo "\t=> indent set to $currentIndent by token $i ($type)".PHP_EOL;
+ }
+
+ continue;
+ }
+ }//end if
+
+ // JS objects set the indent level.
+ if ($phpcsFile->tokenizerType === 'JS'
+ && $tokens[$i]['code'] === T_OBJECT
+ ) {
+ $closer = $tokens[$i]['bracket_closer'];
+ if ($tokens[$i]['line'] === $tokens[$closer]['line']) {
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "* ignoring single-line JS object on line $line".PHP_EOL;
+ }
+
+ $i = $closer;
+ continue;
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$i]['line'];
+ echo "Open JS object on line $line".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $i, true);
+ $currentIndent = (($tokens[$first]['column'] - 1) + $this->indent);
+ if (isset($adjustments[$first]) === true) {
+ $currentIndent += $adjustments[$first];
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+
+ continue;
+ }//end if
+
+ // Closing an anon class or function.
+ if (isset($tokens[$i]['scope_condition']) === true
+ && $tokens[$i]['scope_closer'] === $i
+ && ($tokens[$tokens[$i]['scope_condition']]['code'] === T_CLOSURE
+ || $tokens[$tokens[$i]['scope_condition']]['code'] === T_ANON_CLASS)
+ ) {
+ if ($this->debug === true) {
+ $type = str_replace('_', ' ', strtolower(substr($tokens[$tokens[$i]['scope_condition']]['type'], 2)));
+ $line = $tokens[$i]['line'];
+ echo "Close $type on line $line".PHP_EOL;
+ }
+
+ $prev = false;
+
+ $object = 0;
+ if ($phpcsFile->tokenizerType === 'JS') {
+ $conditions = $tokens[$i]['conditions'];
+ krsort($conditions, SORT_NUMERIC);
+ foreach ($conditions as $token => $condition) {
+ if ($condition === T_OBJECT) {
+ $object = $token;
+ break;
+ }
+ }
+
+ if ($this->debug === true && $object !== 0) {
+ $line = $tokens[$object]['line'];
+ echo "\t* token is inside JS object $object on line $line *".PHP_EOL;
+ }
+ }
+
+ $parens = 0;
+ if (isset($tokens[$i]['nested_parenthesis']) === true
+ && empty($tokens[$i]['nested_parenthesis']) === false
+ ) {
+ end($tokens[$i]['nested_parenthesis']);
+ $parens = key($tokens[$i]['nested_parenthesis']);
+ if ($this->debug === true) {
+ $line = $tokens[$parens]['line'];
+ echo "\t* token has nested parenthesis $parens on line $line *".PHP_EOL;
+ }
+ }
+
+ $condition = 0;
+ if (isset($tokens[$i]['conditions']) === true
+ && empty($tokens[$i]['conditions']) === false
+ ) {
+ end($tokens[$i]['conditions']);
+ $condition = key($tokens[$i]['conditions']);
+ if ($this->debug === true) {
+ $line = $tokens[$condition]['line'];
+ $type = $tokens[$condition]['type'];
+ echo "\t* token is inside condition $condition ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ if ($parens > $object && $parens > $condition) {
+ if ($this->debug === true) {
+ echo "\t* using parenthesis *".PHP_EOL;
+ }
+
+ $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($parens - 1), null, true);
+ $object = 0;
+ $condition = 0;
+ } else if ($object > 0 && $object >= $condition) {
+ if ($this->debug === true) {
+ echo "\t* using object *".PHP_EOL;
+ }
+
+ $prev = $object;
+ $parens = 0;
+ $condition = 0;
+ } else if ($condition > 0) {
+ if ($this->debug === true) {
+ echo "\t* using condition *".PHP_EOL;
+ }
+
+ $prev = $condition;
+ $object = 0;
+ $parens = 0;
+ }//end if
+
+ if ($prev === false) {
+ $prev = $phpcsFile->findPrevious(array(T_EQUAL, T_RETURN), ($tokens[$i]['scope_condition'] - 1), null, false, null, true);
+ if ($prev === false) {
+ $prev = $i;
+ if ($this->debug === true) {
+ echo "\t* could not find a previous T_EQUAL or T_RETURN token; will use current token *".PHP_EOL;
+ }
+ }
+ }
+
+ if ($this->debug === true) {
+ $line = $tokens[$prev]['line'];
+ $type = $tokens[$prev]['type'];
+ echo "\t* previous token is $type on line $line *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* first token on line $line is $first ($type) *".PHP_EOL;
+ }
+
+ $prev = $phpcsFile->findStartOfStatement($first);
+ if ($prev !== $first) {
+ // This is not the start of the statement.
+ if ($this->debug === true) {
+ $line = $tokens[$prev]['line'];
+ $type = $tokens[$prev]['type'];
+ echo "\t* amended previous is $type on line $line *".PHP_EOL;
+ }
+
+ $first = $phpcsFile->findFirstOnLine(T_WHITESPACE, $prev, true);
+ if ($this->debug === true) {
+ $line = $tokens[$first]['line'];
+ $type = $tokens[$first]['type'];
+ echo "\t* amended first token is $first ($type) on line $line *".PHP_EOL;
+ }
+ }
+
+ $currentIndent = ($tokens[$first]['column'] - 1);
+ if ($object > 0 || $condition > 0) {
+ $currentIndent += $this->indent;
+ }
+
+ if (isset($tokens[$first]['scope_closer']) === true
+ && $tokens[$first]['scope_closer'] === $first
+ ) {
+ if ($this->debug === true) {
+ echo "\t* first token is a scope closer *".PHP_EOL;
+ }
+
+ if ($condition === 0 || $tokens[$condition]['scope_opener'] < $first) {
+ $currentIndent = $setIndents[$first];
+ } else if ($this->debug === true) {
+ echo "\t* ignoring scope closer *".PHP_EOL;
+ }
+ }
+
+ // Make sure it is divisible by our expected indent.
+ $currentIndent = (int) (ceil($currentIndent / $this->indent) * $this->indent);
+ $setIndents[$first] = $currentIndent;
+
+ if ($this->debug === true) {
+ $type = $tokens[$first]['type'];
+ echo "\t=> indent set to $currentIndent by token $first ($type)".PHP_EOL;
+ }
+ }//end if
+ }//end for
+
+ // Don't process the rest of the file.
+ return $phpcsFile->numTokens;
+
+ }//end process()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.inc
new file mode 100644
index 0000000..a82199e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowLongArraySyntaxUnitTest.inc
@@ -0,0 +1,23 @@
+
+ * @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\Arrays;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowLongArraySyntaxUnitTest 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 array(
+ 2 => 1,
+ 4 => 1,
+ 6 => 1,
+ 7 => 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
+ */
+ public function getWarningList()
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowShortArraySyntaxUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowShortArraySyntaxUnitTest.inc
new file mode 100644
index 0000000..bee39c3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Arrays/DisallowShortArraySyntaxUnitTest.inc
@@ -0,0 +1,12 @@
+
+ * @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\Arrays;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowShortArraySyntaxUnitTest 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 array(
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ 8 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc
new file mode 100644
index 0000000..1b4be0b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc
new file mode 100644
index 0000000..f5af896
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.3.inc
new file mode 100644
index 0000000..7959895
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.3.inc
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.4.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.4.inc
new file mode 100644
index 0000000..1909375
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.4.inc
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.5.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.5.inc
new file mode 100644
index 0000000..e52aaff
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.5.inc
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.6.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.6.inc
new file mode 100644
index 0000000..43c9197
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.6.inc
@@ -0,0 +1,12 @@
+
+ some html here
+
+ * @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\Classes;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DuplicateClassNameUnitTest 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 array();
+
+ }//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 'DuplicateClassNameUnitTest.1.inc':
+ return array(
+ 6 => 1,
+ 7 => 1,
+ );
+ break;
+ case 'DuplicateClassNameUnitTest.2.inc':
+ return array(
+ 2 => 1,
+ 3 => 1,
+ );
+ break;
+ case 'DuplicateClassNameUnitTest.5.inc':
+ return array(
+ 3 => 1,
+ 7 => 1,
+ );
+ break;
+ case 'DuplicateClassNameUnitTest.6.inc':
+ return array(10 => 1);
+ break;
+ default:
+ return array();
+ break;
+ }//end switch
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc
new file mode 100644
index 0000000..8147b4c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.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\Classes;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OpeningBraceSameLineUnitTest 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 array(
+ 19 => 2,
+ 23 => 1,
+ 28 => 2,
+ 34 => 1,
+ 38 => 1,
+ 41 => 1,
+ 44 => 1,
+ 47 => 1,
+ 70 => 1,
+ 79 => 1,
+ 90 => 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 array(51 => 1);
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.inc
new file mode 100644
index 0000000..a560194
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.inc
@@ -0,0 +1,93 @@
+ 'a', 2 => 'b' ) ) ) {}
+
+switch ( $a === $b ) {}
+switch ( true ) {
+ case $sample == 'something':
+ break;
+}
+
+for ( $i = 0; $i == 100; $i++ ) {}
+for ( $i = 0; $i >= 100; $i++ ) {}
+for ( $i = 0; ; $i++ ) {}
+for (;;) {}
+
+do {
+} while ( $sample == false );
+
+while ( $sample === false ) {}
+
+ // Silly, but not an assignment.
+if (123 = $a) {}
+if (strtolower($b) = $b) {}
+if (array( 1 => 'a', 2 => 'b' ) = $b) {}
+
+if (SOME_CONSTANT = 123) {
+} else if(self::SOME_CONSTANT -= 10) {}
+
+if ( $a() = 123 ) {
+} else if ( $b->something() = 123 ) {
+} elseif ( $c::something() = 123 ) {}
+
+switch ( true ) {
+ case 'something' = $sample:
+ break;
+}
+
+// Assignments in condition.
+if ($a = 123) {
+} elseif ($a = 'abc') {
+} else if( $a += 10 ) {
+} else if($a -= 10) {
+} else if($a *= 10) {
+} else if($a **= 10) {
+} else if($a /= 10) {
+} else if($a .= strtolower($b)) {
+} else if($a %= SOME_CONSTANT) {
+} else if($a &= 2) {
+} else if($a |= 2) {
+} else if($a ^= 2) {
+} else if($a <<= 2) {
+} else if($a >>= 2) {
+} else if($a ??= $b) {
+} elseif( $a = 'abc' && $b = 'def' ) {
+} elseif(
+ $a = 'abc'
+ && $a .= 'def'
+) {}
+
+if ($a[] = 123) {
+} elseif ($a['something'] = 123) {
+} elseif (self::$a = 123) {
+} elseif (parent::$a *= 123) {
+} elseif (static::$a = 123) {
+} elseif (MyClass::$a .= 'abc') {
+} else if( $this->something += 10 ) {}
+
+switch ( $a = $b ) {}
+switch ( true ) {
+ case $sample = 'something':
+ break;
+
+ case $sample = 'something' && $a = $b:
+ break;
+}
+
+for ( $i = 0; $i = 100; $i++ ) {}
+for ( $i = 0; $i = 100 && $b = false; $i++ ) {}
+
+do {
+} while ( $sample = false );
+
+while ( $sample = false ) {}
+
+if ($a = 123) :
+endif;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php
new file mode 100644
index 0000000..eb13d5c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php
@@ -0,0 +1,82 @@
+
+ * @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\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class AssignmentInConditionUnitTest 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 array();
+
+ }//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 array(
+ 46 => 1,
+ 47 => 1,
+ 48 => 1,
+ 49 => 1,
+ 50 => 1,
+ 51 => 1,
+ 52 => 1,
+ 53 => 1,
+ 54 => 1,
+ 55 => 1,
+ 56 => 1,
+ 57 => 1,
+ 58 => 1,
+ 59 => 1,
+ 60 => 1,
+ 61 => 2,
+ 63 => 1,
+ 64 => 1,
+ 67 => 1,
+ 68 => 1,
+ 69 => 1,
+ 70 => 1,
+ 71 => 1,
+ 72 => 1,
+ 73 => 1,
+ 75 => 1,
+ 77 => 1,
+ 80 => 2,
+ 84 => 1,
+ 85 => 2,
+ 88 => 1,
+ 90 => 1,
+ 92 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc
new file mode 100644
index 0000000..83780bc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc
@@ -0,0 +1,72 @@
+getTraceAsString();
+ }
+}
+
+try {
+ throw Exception('Error...');
+} catch (Exception $e) {}
+
+try {
+ throw Exception('Error...');
+} catch (Exception $e) {
+ // TODO: Handle this exception later :-)
+}
+
+if (true) {} elseif (false) {}
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php
new file mode 100644
index 0000000..3bd4992
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php
@@ -0,0 +1,62 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class EmptyStatementUnitTest 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 array(
+ 3 => 1,
+ 15 => 1,
+ 17 => 1,
+ 19 => 1,
+ 30 => 1,
+ 35 => 1,
+ 41 => 1,
+ 47 => 1,
+ 52 => 1,
+ 55 => 1,
+ 64 => 1,
+ 68 => 1,
+ 72 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.inc
new file mode 100644
index 0000000..6b65e62
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.inc
@@ -0,0 +1,13 @@
+valid();) {
+ $it->next();
+}
+
+for (;(($it1->valid() && $foo) || (!$it2->value && ($bar || false)));/*Could be ingored*/) {
+ $it1->next();
+ $it2->next();
+}
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php
new file mode 100644
index 0000000..03018c1
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ForLoopShouldBeWhileLoopUnitTest 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 array();
+
+ }//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 array(
+ 6 => 1,
+ 10 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.inc
new file mode 100644
index 0000000..ef51b5a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.inc
@@ -0,0 +1,15 @@
+rewind(); $it->valid(); $it->next()) {
+ echo $it->current();
+}
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php
new file mode 100644
index 0000000..d3474ee
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ForLoopWithTestFunctionCallUnitTest 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 array();
+
+ }//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 array(
+ 4 => 1,
+ 13 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.inc
new file mode 100644
index 0000000..dc7b88e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.inc
@@ -0,0 +1,25 @@
+ 3; $i++) {
+
+ }
+ }
+}
+
+for ($i = 0; $i < 20; $i++) {
+ for ($j = 0; $j < 5; $j += 2) {
+ for ($k = 0; $k > 3; $k++) {
+
+ }
+ }
+}
+
+for ($i = 0; $i < 20; $i++) {
+ for ($j = 0; $j < 5; $j += 2) {
+ for ($k = 0; $k > 3; $j++) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php
new file mode 100644
index 0000000..c431f2e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php
@@ -0,0 +1,52 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class JumbledIncrementerUnitTest 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 array();
+
+ }//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 array(
+ 3 => 2,
+ 4 => 1,
+ 20 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.inc
new file mode 100644
index 0000000..1d980ae
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.inc
@@ -0,0 +1,13 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UnconditionalIfStatementUnitTest 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 array();
+
+ }//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 array(
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.inc
new file mode 100644
index 0000000..9e8ad1a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.inc
@@ -0,0 +1,24 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UnnecessaryFinalModifierUnitTest 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 array();
+
+ }//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 array(
+ 11 => 1,
+ 14 => 1,
+ 17 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc
new file mode 100644
index 0000000..0f112af
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc
@@ -0,0 +1,80 @@
+
+$parameter
+HTML;
+}
+
+print foo( 'PARAMETER' );
+print "\n";
+
+function foo($bar)
+{
+ print "${bar} things\n";
+}
+
+function bar($x)
+{
+ return 2 * ${x};
+}
+
+function ($a, $b) {
+ return $a * 2;
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php
new file mode 100644
index 0000000..a306af4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php
@@ -0,0 +1,52 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UnusedFunctionParameterUnitTest 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 array();
+
+ }//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 array(
+ 3 => 1,
+ 7 => 1,
+ 78 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.inc
new file mode 100644
index 0000000..f9fe67c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.inc
@@ -0,0 +1,25 @@
+
+ * @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\Tests\CodeAnalysis;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UselessOverridingMethodUnitTest 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 array();
+
+ }//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 array(
+ 4 => 1,
+ 16 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.inc
new file mode 100644
index 0000000..cf99734
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.inc
@@ -0,0 +1,194 @@
+
+ * @author Marc McIntyre
+ * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ * @link http://pear.php.net/package/PHP_CodeSniffer
+ */
+
+/**
+ * Comment
+ *
+ * @one
+ * @two
+ * @one
+ *
+ * @two something
+ * here
+ * @two foo
+ * @three something
+ * here
+ * @three bar
+ */
+
+/**
+ * @ var Comment
+ */
+
+/** @var Database $mockedDatabase */
+/** @var Container $mockedContainer */
+
+/**
+ * è¿æ¯ä¸æ¡æµè¯è¯è®º.
+ */
+
+/**
+ * I'm a function short-description
+ * @return boolean
+ */
+
+/**
+ * this is a test
+ * @author test
+ * @param boolean $foo blah
+ * @return boolean
+ * @param boolean $bar Blah.
+ */
+
+/**
+ * étude des ...
+ */
+
+/**doc comment */
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.js
new file mode 100644
index 0000000..d6d865d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.js
@@ -0,0 +1,194 @@
+
+/**
+ * Short description.
+ *
+ * Long description
+ * over multiple lines.
+ *
+ * @tag1 one
+ * @tag2 two
+ * @tag3 three
+ */
+
+/**
+ * short description
+ *
+ * long description
+ * over multiple lines.
+ * @tag1 one
+ */
+
+/**
+ *
+ * Short description
+ *
+ *
+ * Long description
+ * over multiple lines
+ *
+ *
+ * @tag1 one
+ *
+ */
+
+/*
+ This is not a doc block.
+ */
+
+/** Short description.
+ *
+ * @tag one
+ * @tag2 two
+ * @tagThree three
+ * @tagFour four
+ */
+
+/**
+ * Short description.
+ *
+ * @tag one
+ *
+ * @param
+ * @param
+ *
+ */
+
+/**
+ * Short description.
+ * @param
+ * @param
+ * @tag one
+ */
+
+/**
+ * Short description.
+ *
+ *
+ * @param
+ *
+ * @param
+ *
+ *
+ * @tag one
+ */
+
+ /**
+ * Short description.
+ *
+ * @param
+ *
+ * @tag one
+ * @param
+ */
+
+/**
+ * Short description.
+ *
+ * @groupOne one
+ * @groupOne two
+ *
+ * @group2 one
+ * @group2 two
+ *
+ *
+ * @g3
+ * @g3 two
+ */
+
+ /**
+ * Short description
+ * over multiple lines.
+ *
+ * Long descrption.
+ *
+ * @param
+ *
+ * @tag one
+ */
+
+/**
+ * Short description.
+ *
+ * @tag1 one some comment across
+ * multiple lines
+ * @tag1 two some comment across
+ * multiple lines
+ * @tag1 three some comment across
+ * multiple lines
+ */
+
+ /**
+ * Returns true if the specified string is in the camel caps format.
+ *
+ * @param boolean $classFormat If true, check to see if the string is in the
+ * class format. Class format strings must start
+ * with a capital letter and contain no
+ * underscores.
+ * @param boolean $strict If true, the string must not have two capital
+ * letters next to each other. If false, a
+ * relaxed camel caps policy is used to allow
+ * for acronyms.
+ *
+ * @return boolean
+ */
+
+ /**
+ * Verifies that a @throws tag exists for a function that throws exceptions.
+ * Verifies the number of @throws tags and the number of throw tokens matches.
+ * Verifies the exception type.
+ *
+ * PHP version 5
+ *
+ * @category PHP
+ * @package PHP_CodeSniffer
+ * @author Greg Sherwood
+ * @author Marc McIntyre
+ * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ * @link http://pear.php.net/package/PHP_CodeSniffer
+ */
+
+ /**
+ * Comment
+ *
+ * @one
+ * @two
+ * @one
+ *
+ * @two something
+ * here
+ * @two foo
+ * @three something
+ * here
+ * @three bar
+ */
+
+ /**
+ * @ var Comment
+ */
+
+/** @var Database $mockedDatabase */
+/** @var Container $mockedContainer */
+
+/**
+ * è¿æ¯ä¸æ¡æµè¯è¯è®º.
+ */
+
+/**
+ * I'm a function short-description
+ * @return boolean
+ */
+
+/**
+ * this is a test
+ * @author test
+ * @param boolean $foo blah
+ * @return boolean
+ * @param boolean $bar Blah.
+ */
+
+/**
+ * étude des ...
+ */
+
+/**doc comment */
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.php
new file mode 100644
index 0000000..02030de
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/DocCommentUnitTest.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\Standards\Generic\Tests\Commenting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DocCommentUnitTest 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(int => int)
+ */
+ public function getErrorList()
+ {
+ return array(
+ 14 => 1,
+ 16 => 1,
+ 18 => 1,
+ 23 => 1,
+ 26 => 1,
+ 30 => 1,
+ 32 => 1,
+ 38 => 2,
+ 40 => 1,
+ 41 => 1,
+ 51 => 1,
+ 54 => 1,
+ 58 => 1,
+ 60 => 2,
+ 67 => 1,
+ 69 => 2,
+ 80 => 1,
+ 81 => 2,
+ 88 => 1,
+ 91 => 1,
+ 95 => 1,
+ 156 => 1,
+ 158 => 1,
+ 170 => 3,
+ 171 => 3,
+ 179 => 1,
+ 183 => 1,
+ 184 => 1,
+ 185 => 2,
+ 186 => 1,
+ 187 => 2,
+ 191 => 1,
+ 194 => 4,
+ );
+
+ }//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(int => int)
+ */
+ public function getWarningList()
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/FixmeUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/FixmeUnitTest.inc
new file mode 100644
index 0000000..69ab337
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/FixmeUnitTest.inc
@@ -0,0 +1,23 @@
+
+ * @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\Tests\Commenting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class FixmeUnitTest 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='FixmeUnitTest.inc')
+ {
+ return array(
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ 10 => 1,
+ 13 => 1,
+ 16 => 1,
+ 18 => 1,
+ 21 => 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.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getWarningList($testFile='FixmeUnitTest.inc')
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/TodoUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/TodoUnitTest.inc
new file mode 100644
index 0000000..64c624c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Commenting/TodoUnitTest.inc
@@ -0,0 +1,23 @@
+
+ * @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\Commenting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class TodoUnitTest 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='TodoUnitTest.inc')
+ {
+ return array();
+
+ }//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='TodoUnitTest.inc')
+ {
+ return array(
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ 10 => 1,
+ 13 => 1,
+ 16 => 1,
+ 18 => 1,
+ 21 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.inc
new file mode 100644
index 0000000..1742a53
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.inc
@@ -0,0 +1,208 @@
+ 0; $i--) echo 'hello';
+
+while ($something) echo 'hello';
+
+do {
+ $i--;
+} while ($something);
+
+if(true)
+ $someObject->{$name};
+
+if (true) :
+ $foo = true;
+endif;
+
+while (true) :
+ $foo = true;
+endwhile;
+
+for ($i; $i > 0; $i--) :
+ echo 'hello';
+endfor;
+
+foreach ($array as $element) :
+ echo 'hello';
+endforeach;
+
+while (!$this->readLine($tokens, $tag));
+while (!$this->readLine($tokens, $tag)); //skip to end of file
+
+foreach ($cookies as $cookie)
+ if ($cookie->match($uri, $matchSessionCookies, $now))
+ $ret[] = $cookie;
+
+foreach ($stringParade as $hit)
+ $hitParade[] = $hit + 0; //cast to integer
+
+if ($foo) :
+ echo 'true';
+elseif ($something) :
+ echo 'foo';
+else:
+ echo 'false';
+endif;
+
+function test()
+{
+ if ($a)
+ $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : ''));
+}
+
+if ($a)
+ foreach ($b as $c) {
+ if ($d) {
+ $e=$f;
+ $g=$h;
+ } elseif ($i==0) {
+ $j=$k;
+ }
+ }
+
+?>
+
+ scenario == 'simple') $widget->renderPager() ?>
+
+
+error):
+ case Shop_Customer :: ERROR_INVALID_GENDER: ?>
+ Ungültiges Geschlecht!
+
+ Die eingetragene E-Mail-Adresse ist bereits registriert.
+ allowShopping !== true):
+ if ($this->status != Shop_Cart :: OK):
+ switch ($this->status):
+ case Shop_Cart :: NOT_FOUND:
+ echo 'foo';
+ endswitch;
+ endif;
+else:
+ echo 'foo';
+endif;
+
+// ELSE IF split over multiple lines (not inline)
+if ($test) {
+} else
+ if ($test) {
+ } else {
+ }
+
+switch($response = \Bar::baz('bat', function ($foo) {
+ return 'bar';
+})) {
+ case 1:
+ return 'test';
+
+ case 2:
+ return 'other';
+}
+
+$stuff = [1,2,3];
+foreach($stuff as $num)
+ if ($num %2 ) {
+ echo "even";
+ } else {
+ echo "odd";
+ }
+
+$i = 0;
+foreach($stuff as $num)
+ do {
+ echo $i;
+ $i++;
+ } while ($i < 5);
+
+foreach($stuff as $num)
+ if (true) {
+ echo "true1\n";
+ }
+ if (true) {
+ echo "true2\n";
+ }
+
+if ($foo) echo 'foo';
+elseif ($bar) echo 'bar';
+else echo 'baz';
+
+switch ($type) {
+ case 1:
+ if ($foo) {
+ return true;
+ } elseif ($baz)
+ return true;
+ else {
+ echo 'else';
+ }
+ break;
+}
+
+foreach ($sql as $s)
+ if (!$this->execute) echo "",$s.";\n
";
+ else {
+ $ok = $this->connDest->Execute($s);
+ if (!$ok)
+ if ($this->neverAbort) $ret = false;
+ else return false;
+ }
+
+if ($bar)
+ if ($foo) echo 'hi'; // lol
+
+if ($level == 'district')
+ \DB::update(<< 0; $i--) { echo 'hello';
+}
+
+while ($something) { echo 'hello';
+}
+
+do {
+ $i--;
+} while ($something);
+
+if(true) {
+ $someObject->{$name};
+}
+
+if (true) :
+ $foo = true;
+endif;
+
+while (true) :
+ $foo = true;
+endwhile;
+
+for ($i; $i > 0; $i--) :
+ echo 'hello';
+endfor;
+
+foreach ($array as $element) :
+ echo 'hello';
+endforeach;
+
+while (!$this->readLine($tokens, $tag)) {}
+while (!$this->readLine($tokens, $tag)) {
+//skip to end of file
+}
+foreach ($cookies as $cookie) {
+ if ($cookie->match($uri, $matchSessionCookies, $now)) {
+ $ret[] = $cookie;
+ }
+}
+
+foreach ($stringParade as $hit) {
+ $hitParade[] = $hit + 0; //cast to integer
+}
+
+if ($foo) :
+ echo 'true';
+elseif ($something) :
+ echo 'foo';
+else:
+ echo 'false';
+endif;
+
+function test()
+{
+ if ($a) {
+ $a.=' '.($b ? 'b' : ($c ? ($d ? 'd' : 'c') : ''));
+ }
+}
+
+if ($a) {
+ foreach ($b as $c) {
+ if ($d) {
+ $e=$f;
+ $g=$h;
+ } elseif ($i==0) {
+ $j=$k;
+ }
+ }
+}
+
+?>
+
+ scenario == 'simple') { $widget->renderPager(); } ?>
+
+
+error):
+ case Shop_Customer :: ERROR_INVALID_GENDER: ?>
+ Ungültiges Geschlecht!
+
+ Die eingetragene E-Mail-Adresse ist bereits registriert.
+ allowShopping !== true):
+ if ($this->status != Shop_Cart :: OK):
+ switch ($this->status):
+ case Shop_Cart :: NOT_FOUND:
+ echo 'foo';
+ endswitch;
+ endif;
+else:
+ echo 'foo';
+endif;
+
+// ELSE IF split over multiple lines (not inline)
+if ($test) {
+} else
+ if ($test) {
+ } else {
+ }
+
+switch($response = \Bar::baz('bat', function ($foo) {
+ return 'bar';
+})) {
+ case 1:
+ return 'test';
+
+ case 2:
+ return 'other';
+}
+
+$stuff = [1,2,3];
+foreach($stuff as $num) {
+ if ($num %2 ) {
+ echo "even";
+ } else {
+ echo "odd";
+ }
+}
+
+$i = 0;
+foreach($stuff as $num) {
+ do {
+ echo $i;
+ $i++;
+ } while ($i < 5);
+}
+
+foreach($stuff as $num) {
+ if (true) {
+ echo "true1\n";
+ }
+}
+ if (true) {
+ echo "true2\n";
+ }
+
+if ($foo) { echo 'foo';
+} elseif ($bar) { echo 'bar';
+} else { echo 'baz';
+}
+
+switch ($type) {
+ case 1:
+ if ($foo) {
+ return true;
+ } elseif ($baz) {
+ return true;
+ } else {
+ echo 'else';
+ }
+ break;
+}
+
+foreach ($sql as $s) {
+ if (!$this->execute) { echo "",$s.";\n
";
+ } else {
+ $ok = $this->connDest->Execute($s);
+ if (!$ok) {
+ if ($this->neverAbort) { $ret = false;
+ } else { return false;
+ }
+ }
+ }
+}
+
+if ($bar) {
+ if ($foo) { echo 'hi'; // lol
+ }
+}
+
+if ($level == 'district') {
+ \DB::update(<< 0; i--) print 'hello';
+
+while (something) print 'hello';
+
+do {
+ i--;
+} while (something);
+
+do i++; while (i < 5);
+
+SomeClass.prototype.switch = function() {
+ // do something
+};
+
+if ($("#myid").rotationDegrees()=='90')
+ $('.modal').css({'transform': 'rotate(90deg)'});
+
+if ($("#myid").rotationDegrees()=='90')
+ $foo = {'transform': 'rotate(90deg)'};
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.js.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.js.fixed
new file mode 100644
index 0000000..8f0c413
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.js.fixed
@@ -0,0 +1,39 @@
+
+
+if (something) { print 'hello';
+}
+
+if (something) {
+ print 'hello';
+} else { print 'hi';
+}
+
+if (something) {
+ print 'hello';
+} else if (something) { print 'hi';
+}
+
+for (i; i > 0; i--) { print 'hello';
+}
+
+while (something) { print 'hello';
+}
+
+do {
+ i--;
+} while (something);
+
+do { i++;
+} while (i < 5);
+
+SomeClass.prototype.switch = function() {
+ // do something
+};
+
+if ($("#myid").rotationDegrees()=='90') {
+ $('.modal').css({'transform': 'rotate(90deg)'});
+}
+
+if ($("#myid").rotationDegrees()=='90') {
+ $foo = {'transform': 'rotate(90deg)'};
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php
new file mode 100644
index 0000000..87439ae
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php
@@ -0,0 +1,106 @@
+
+ * @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\ControlStructures;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class InlineControlStructureUnitTest 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='InlineControlStructureUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'InlineControlStructureUnitTest.inc':
+ return array(
+ 3 => 1,
+ 7 => 1,
+ 11 => 1,
+ 13 => 1,
+ 15 => 1,
+ 17 => 1,
+ 23 => 1,
+ 42 => 1,
+ 43 => 1,
+ 45 => 1,
+ 46 => 1,
+ 49 => 1,
+ 62 => 1,
+ 66 => 1,
+ 78 => 1,
+ 120 => 1,
+ 128 => 1,
+ 134 => 1,
+ 142 => 1,
+ 143 => 1,
+ 144 => 1,
+ 150 => 1,
+ 158 => 1,
+ 159 => 1,
+ 162 => 1,
+ 163 => 1,
+ 164 => 1,
+ 167 => 1,
+ 168 => 1,
+ 170 => 1,
+ 178 => 1,
+ 185 => 1,
+ 188 => 2,
+ 191 => 1,
+ 195 => 1,
+ 198 => 1,
+ );
+ break;
+ case 'InlineControlStructureUnitTest.js':
+ return array(
+ 3 => 1,
+ 7 => 1,
+ 11 => 1,
+ 13 => 1,
+ 15 => 1,
+ 21 => 1,
+ 27 => 1,
+ 30 => 1,
+ );
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc
new file mode 100644
index 0000000..dc3bf59
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc
@@ -0,0 +1,3 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php
new file mode 100644
index 0000000..1ee3614
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ByteOrderMarkUnitTest 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 array(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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.css
new file mode 100644
index 0000000..2127f8e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.css
@@ -0,0 +1,3 @@
+
+#login-container {}
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.inc
new file mode 100644
index 0000000..ca2a749
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNewlineUnitTest.1.inc
@@ -0,0 +1,3 @@
+
+ * @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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class EndFileNewlineUnitTest 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 'EndFileNewlineUnitTest.3.inc':
+ case 'EndFileNewlineUnitTest.3.js':
+ case 'EndFileNewlineUnitTest.3.css':
+ return array(2 => 1);
+ case 'EndFileNewlineUnitTest.4.inc':
+ // HHVM just removes the entire comment token, as if it was never there.
+ if (defined('HHVM_VERSION') === true) {
+ return array();
+ }
+ return array(2 => 1);
+ default:
+ return array();
+ }//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='')
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.css
new file mode 100644
index 0000000..2127f8e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.css
@@ -0,0 +1,3 @@
+
+#login-container {}
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.inc
new file mode 100644
index 0000000..ca2a749
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.1.inc
@@ -0,0 +1,3 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.2.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.2.js
new file mode 100644
index 0000000..d1ff76b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.2.js
@@ -0,0 +1,2 @@
+
+alert('hi);
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.css
new file mode 100644
index 0000000..5f15bde
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.css
@@ -0,0 +1,2 @@
+
+#login-container {}
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.inc
new file mode 100644
index 0000000..360abcc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.3.inc
@@ -0,0 +1,2 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.5.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.5.inc
new file mode 100644
index 0000000..3219393
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/EndFileNoNewlineUnitTest.5.inc
@@ -0,0 +1,2 @@
+
+ * @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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class EndFileNoNewlineUnitTest 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 'EndFileNoNewlineUnitTest.1.inc':
+ case 'EndFileNoNewlineUnitTest.1.css':
+ case 'EndFileNoNewlineUnitTest.1.js':
+ case 'EndFileNoNewlineUnitTest.2.inc':
+ return array(3 => 1);
+ case 'EndFileNoNewlineUnitTest.2.css':
+ case 'EndFileNoNewlineUnitTest.2.js':
+ return array(2 => 1);
+ case 'EndFileNoNewlineUnitTest.5.inc':
+ // HHVM just removes the entire comment token, as if it was never there.
+ if (defined('HHVM_VERSION') === true) {
+ return array(1 => 1);
+ }
+ return array();
+ case 'EndFileNoNewlineUnitTest.6.inc':
+ // HHVM just removes the entire comment token, as if it was never there.
+ if (defined('HHVM_VERSION') === true) {
+ return array(1 => 1);
+ }
+ return array(2 => 1);
+ default:
+ return array();
+ }//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='')
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.1.inc
new file mode 100644
index 0000000..ca2a749
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.1.inc
@@ -0,0 +1,3 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.3.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.3.inc
new file mode 100644
index 0000000..08a3995
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.3.inc
@@ -0,0 +1,6 @@
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.5.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.5.inc
new file mode 100644
index 0000000..d027e91
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/InlineHTMLUnitTest.5.inc
@@ -0,0 +1,3 @@
+#!/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
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class InlineHTMLUnitTest 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 'InlineHTMLUnitTest.3.inc':
+ return array(4 => 1);
+ break;
+ case 'InlineHTMLUnitTest.4.inc':
+ return array(1 => 1);
+ break;
+ default:
+ return array();
+ 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.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getWarningList($testFile='')
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.css
new file mode 100644
index 0000000..c182ac4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.css
@@ -0,0 +1,3 @@
+#login-container {
+ margin-left: -225px;
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc
new file mode 100644
index 0000000..b143fb4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc
@@ -0,0 +1,18 @@
+
+
+
+
+
+group('a.id,
+ uc.name,
+ ag.title,
+ ua.name'
+ );
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc.fixed
new file mode 100644
index 0000000..b143fb4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc.fixed
@@ -0,0 +1,18 @@
+
+
+
+
+
+group('a.id,
+ uc.name,
+ ag.title,
+ ua.name'
+ );
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.js
new file mode 100644
index 0000000..0260099
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.js
@@ -0,0 +1,2 @@
+alert('hi');
+alert('hi');
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.php
new file mode 100644
index 0000000..e73e3f3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineEndingsUnitTest.php
@@ -0,0 +1,63 @@
+
+ * @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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LineEndingsUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Get a list of CLI values to set before the file is tested.
+ *
+ * @param string $testFile The name of the file being tested.
+ * @param \PHP_CodeSniffer\Config $config The config data for the test run.
+ *
+ * @return void
+ */
+ public function setCliValues($testFile, $config)
+ {
+ $config->tabWidth = 4;
+
+ }//end setCliValues()
+
+
+ /**
+ * 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 array(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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineLengthUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineLengthUnitTest.1.inc
new file mode 100644
index 0000000..9800ae9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LineLengthUnitTest.1.inc
@@ -0,0 +1,76 @@
+
+Hellob>
+
+
+
+ * @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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LineLengthUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Get a list of CLI values to set before the file is tested.
+ *
+ * @param string $testFile The name of the file being tested.
+ * @param \PHP_CodeSniffer\Config $config The config data for the test run.
+ *
+ * @return void
+ */
+ public function setCliValues($testFile, $config)
+ {
+ $config->tabWidth = 4;
+
+ }//end setCliValues()
+
+
+ /**
+ * 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 'LineLengthUnitTest.1.inc':
+ return array(
+ 31 => 1,
+ 34 => 1,
+ 45 => 1,
+ );
+ break;
+ case 'LineLengthUnitTest.2.inc':
+ case 'LineLengthUnitTest.3.inc':
+ return array(7 => 1);
+ break;
+ default:
+ return array();
+ 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.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getWarningList($testFile='')
+ {
+ switch ($testFile) {
+ case 'LineLengthUnitTest.1.inc':
+ return array(
+ 9 => 1,
+ 15 => 1,
+ 21 => 1,
+ 24 => 1,
+ 29 => 1,
+ 37 => 1,
+ 63 => 1,
+ 73 => 1,
+ 75 => 1,
+ );
+ break;
+ case 'LineLengthUnitTest.2.inc':
+ case 'LineLengthUnitTest.3.inc':
+ return array(6 => 1);
+ break;
+ case 'LineLengthUnitTest.4.inc':
+ return array(10 => 1);
+ break;
+ default:
+ return array();
+ break;
+ }//end switch
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.inc
new file mode 100644
index 0000000..38c99bd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.inc
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php
new file mode 100644
index 0000000..781db1e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php
@@ -0,0 +1,48 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class LowercasedFilenameUnitTest 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 array(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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.inc
new file mode 100644
index 0000000..12a71e4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.inc
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.php
new file mode 100644
index 0000000..24502c3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneClassPerFileUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OneClassPerFileUnitTest 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 array(
+ 6 => 1,
+ 10 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.inc
new file mode 100644
index 0000000..bfc0a74
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.inc
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.php
new file mode 100644
index 0000000..e86174a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneInterfacePerFileUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OneInterfacePerFileUnitTest 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 array(
+ 6 => 1,
+ 10 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.inc
new file mode 100644
index 0000000..94cebb4
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.inc
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.php
new file mode 100644
index 0000000..7592676
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneObjectStructurePerFileUnitTest.php
@@ -0,0 +1,53 @@
+
+ * @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\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OneObjectStructurePerFileUnitTest 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 array(
+ 6 => 1,
+ 10 => 1,
+ 14 => 1,
+ 18 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.inc
new file mode 100644
index 0000000..43be165
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.inc
@@ -0,0 +1,17 @@
+trait;
+echo Something::$trait;
+echo $trait;
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.php
new file mode 100644
index 0000000..a124ebc
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Files/OneTraitPerFileUnitTest.php
@@ -0,0 +1,63 @@
+
+ * @copyright 2010-2014 Alexander Obuhovich
+ * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
+ */
+
+namespace PHP_CodeSniffer\Standards\Generic\Tests\Files;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OneTraitPerFileUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Should this test be skipped for some reason.
+ *
+ * @return bool
+ */
+ protected function shouldSkipTest()
+ {
+ return (PHP_VERSION_ID < 50400);
+
+ }//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(int => int)
+ */
+ public function getErrorList()
+ {
+ return array(
+ 6 => 1,
+ 10 => 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(int => int)
+ */
+ public function getWarningList()
+ {
+ return array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.inc
new file mode 100644
index 0000000..7fafb56
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.inc
@@ -0,0 +1,13 @@
+wizardid = 10; $this->paint(); echo 'x';
+?>
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.php
new file mode 100644
index 0000000..54eb107
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.php
@@ -0,0 +1,53 @@
+
+ * @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\Formatting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowMultipleStatementsUnitTest 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 array(
+ 2 => 1,
+ 6 => 1,
+ 7 => 1,
+ 8 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc
new file mode 100644
index 0000000..1b838d0
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc
@@ -0,0 +1,234 @@
+findPrevious();
+$commentEnd = $this->_phpcsFile;
+$expected .= '...';
+
+// Invalid
+$this->okButton = new Button();
+$content = new MyClass();
+
+
+$GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array();
+
+class MyClass
+{
+ const MODE_DEBUG = 'debug';
+ const MODE_DEBUG2 = 'debug';
+
+ $array[$test] = 'anything';
+ $var = 'anything';
+
+ const MODE_DEBUG2 = 'debug';
+ $array[$test] = 'anything';
+ $var = 'anything';
+ $array[($test + 1)] = 'anything';
+ $array[($blah + (10 - $test))] = 'anything';
+}
+
+function myFunction($var=true)
+{
+ if ($strict === true) {
+ $length = strlen($string);
+ $lastCharWasCaps = ($classFormat === false) ? false : true;
+
+ for ($i = 1; $i < $length; $i++) {
+ $isCaps = (strtoupper($string{$i}) === $string{$i}) ? true : false;
+ if ($isCaps === true && $lastCharWasCaps === true) {
+ return false;
+ }
+
+ $lastCharWasCaps = $isCaps;
+ }
+ }
+}
+
+// Valid
+for ($i = 0; $i < 10; $i += 2) {
+ $i = ($i - 1);
+}
+
+// Invalid
+foreach ($files as $file) {
+ $saves[$file] = array();
+ $contents = stripslashes(file_get_contents($file));
+ list($assetid, $time, $content) = explode("\n", $contents);
+ $saves[$file]['assetid'] = $assetid;
+}
+
+$i = ($i - 10);
+$ip = ($i - 10);
+for ($i = 0; $i < 10; $i += 2) {
+ $i = ($i - 10);
+}
+
+// Valid
+$variable = 12;
+$var = a_very(long_line('that', 'contains'),
+ a_bunch('of long', 'parameters'),
+ 'that_need to be aligned with the equal sign');
+$var2 = 12;
+
+// Valid
+$variable = 12;
+$var = 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var = a_very(long_line('that', 'contains'),
+ a_bunch('of long', 'parameters'),
+ 'that_need to be aligned with the equal sign');
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var = 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$variable = 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$variable += 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$error = false;
+while (list($h, $f) = each($handle)) {
+ $error = true;
+}
+
+// Valid
+$value = false;
+function blah ($value = true) {
+ $value = false;
+ if ($value === true) {
+ $value = false;
+ }
+}
+
+if (TRUE) {
+ $args = array('foo' => 'foo');
+ $res = 'bar';
+}
+
+// @codingStandardsChangeSetting Generic.Formatting.MultipleStatementAlignment maxPadding 8
+
+$one = 'one';
+$varonetwo = 'two';
+$varonetwothree = 'three';
+$varonetwothreefour = 'four';
+
+$one = 'one';
+$varonetwo .= 'two';
+$varonetwo = 'two';
+$varonetwo .= 'two';
+$varonetwothree = 'three';
+$varonetwothreefour = 'four';
+
+// @codingStandardsChangeSetting Generic.Formatting.MultipleStatementAlignment maxPadding 1000
+
+$filterQuery = SquizRoadmap::getSearchQueryFilter($searchParams);
+Channels::addToBasket('itemid', $filterQuery);
+$query = DAL::getDALQuery('SquizRoadmapItem', 'getItemIds');
+$results = DAL::getAssoc($query, 0);
+
+$path = BaseSystem::getDataDir('SquizRoadmap').'/items/';
+$path .= FileSystem::getHashDir($itemid).'/'.$itemid;
+
+$contents .= 'if (';
+$conditions = array();
+
+$bar = 'hi';
+$foo = $moo = $test;
+$boo = 'boo';
+$foo = $moooo = 'foo';
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc.fixed
new file mode 100644
index 0000000..407788e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc.fixed
@@ -0,0 +1,234 @@
+findPrevious();
+$commentEnd = $this->_phpcsFile;
+$expected .= '...';
+
+// Invalid
+$this->okButton = new Button();
+$content = new MyClass();
+
+
+$GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array();
+
+class MyClass
+{
+ const MODE_DEBUG = 'debug';
+ const MODE_DEBUG2 = 'debug';
+
+ $array[$test] = 'anything';
+ $var = 'anything';
+
+ const MODE_DEBUG2 = 'debug';
+ $array[$test] = 'anything';
+ $var = 'anything';
+ $array[($test + 1)] = 'anything';
+ $array[($blah + (10 - $test))] = 'anything';
+}
+
+function myFunction($var=true)
+{
+ if ($strict === true) {
+ $length = strlen($string);
+ $lastCharWasCaps = ($classFormat === false) ? false : true;
+
+ for ($i = 1; $i < $length; $i++) {
+ $isCaps = (strtoupper($string{$i}) === $string{$i}) ? true : false;
+ if ($isCaps === true && $lastCharWasCaps === true) {
+ return false;
+ }
+
+ $lastCharWasCaps = $isCaps;
+ }
+ }
+}
+
+// Valid
+for ($i = 0; $i < 10; $i += 2) {
+ $i = ($i - 1);
+}
+
+// Invalid
+foreach ($files as $file) {
+ $saves[$file] = array();
+ $contents = stripslashes(file_get_contents($file));
+ list($assetid, $time, $content) = explode("\n", $contents);
+ $saves[$file]['assetid'] = $assetid;
+}
+
+$i = ($i - 10);
+$ip = ($i - 10);
+for ($i = 0; $i < 10; $i += 2) {
+ $i = ($i - 10);
+}
+
+// Valid
+$variable = 12;
+$var = a_very(long_line('that', 'contains'),
+ a_bunch('of long', 'parameters'),
+ 'that_need to be aligned with the equal sign');
+$var2 = 12;
+
+// Valid
+$variable = 12;
+$var = 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var = a_very(long_line('that', 'contains'),
+ a_bunch('of long', 'parameters'),
+ 'that_need to be aligned with the equal sign');
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var = 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$variable = 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$variable += 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Invalid
+$variable = 12;
+$var .= 'a very long line of text that contains '
+ .$someVar
+ .' and some other stuff that is too long to fit on one line';
+$var2 = 12;
+
+// Valid
+$error = false;
+while (list($h, $f) = each($handle)) {
+ $error = true;
+}
+
+// Valid
+$value = false;
+function blah ($value = true) {
+ $value = false;
+ if ($value === true) {
+ $value = false;
+ }
+}
+
+if (TRUE) {
+ $args = array('foo' => 'foo');
+ $res = 'bar';
+}
+
+// @codingStandardsChangeSetting Generic.Formatting.MultipleStatementAlignment maxPadding 8
+
+$one = 'one';
+$varonetwo = 'two';
+$varonetwothree = 'three';
+$varonetwothreefour = 'four';
+
+$one = 'one';
+$varonetwo .= 'two';
+$varonetwo = 'two';
+$varonetwo .= 'two';
+$varonetwothree = 'three';
+$varonetwothreefour = 'four';
+
+// @codingStandardsChangeSetting Generic.Formatting.MultipleStatementAlignment maxPadding 1000
+
+$filterQuery = SquizRoadmap::getSearchQueryFilter($searchParams);
+Channels::addToBasket('itemid', $filterQuery);
+$query = DAL::getDALQuery('SquizRoadmapItem', 'getItemIds');
+$results = DAL::getAssoc($query, 0);
+
+$path = BaseSystem::getDataDir('SquizRoadmap').'/items/';
+$path .= FileSystem::getHashDir($itemid).'/'.$itemid;
+
+$contents .= 'if (';
+$conditions = array();
+
+$bar = 'hi';
+$foo = $moo = $test;
+$boo = 'boo';
+$foo = $moooo = 'foo';
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js
new file mode 100644
index 0000000..c55cdce
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js
@@ -0,0 +1,110 @@
+
+
+// Valid
+var1 = 'var1';
+var10 = 'var1';
+var100 = 'var1';
+var1000 = 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 = 'var1';
+var100 = 'var1';
+var1000 = 'var1';
+
+// Valid
+var1 = 'var1';
+var10 = 'var1';
+
+var100 = 'var1';
+var1000 = 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 = 'var1';
+
+var100 = 'var1';
+var1000 = 'var1';
+
+// Valid
+var1 += 'var1';
+var10 += 'var1';
+var100 += 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 += 'var1';
+var10+= 'var1';
+var100 += 'var1';
+var1000 += 'var1';
+
+// Valid
+var1 = 'var1';
+var10 += 'var1';
+var100 = 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 += 'var1';
+var100 = 'var1';
+var1000+= 'var1';
+
+// Valid
+var1 += 'var1';
+var10 += 'var1';
+
+var100 += 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 += 'var1';
+var10 += 'var1';
+
+var100 += 'var1';
+var1000 += 'var1';
+
+// Valid
+var test = 100;
+
+// InValid
+var test = 100;
+
+commentStart = phpcsFile.findPrevious();
+commentEnd = this._phpcsFile;
+expected += '...';
+
+// Invalid
+this.okButton = {};
+content = {};
+
+var buttonid = [this.id, '-positionFormats-add'].join('');
+var buttonWidget = WidgetStore.get(buttonid);
+var spinButtonid = [this.id, '-positionFormats-spinButton'].join('');
+var spinButtonWidget = WidgetStore.get(spinButtonid);
+var position = spinButtonWidget.getValue();
+var posForamatsList = WidgetStore.get([self.id, '-positionFormats-list'].join(''));
+
+dfx.stripTags = function(content, allowedTags)
+{
+ var match;
+ var re = 'blah';
+};
+
+var contents += 'if (';
+var conditions = array();
+
+var foo = {};
+foo.blah = 'blah';
+
+var script = document.createElement('script');
+script.onload = function()
+{
+ clearTimeout(t);
+};
+
+stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/);
+function() {
+ if (condition)
+ foo = .4
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js.fixed
new file mode 100644
index 0000000..36740be
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js.fixed
@@ -0,0 +1,110 @@
+
+
+// Valid
+var1 = 'var1';
+var10 = 'var1';
+var100 = 'var1';
+var1000 = 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 = 'var1';
+var100 = 'var1';
+var1000 = 'var1';
+
+// Valid
+var1 = 'var1';
+var10 = 'var1';
+
+var100 = 'var1';
+var1000 = 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 = 'var1';
+
+var100 = 'var1';
+var1000 = 'var1';
+
+// Valid
+var1 += 'var1';
+var10 += 'var1';
+var100 += 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 += 'var1';
+var10 += 'var1';
+var100 += 'var1';
+var1000 += 'var1';
+
+// Valid
+var1 = 'var1';
+var10 += 'var1';
+var100 = 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 = 'var1';
+var10 += 'var1';
+var100 = 'var1';
+var1000 += 'var1';
+
+// Valid
+var1 += 'var1';
+var10 += 'var1';
+
+var100 += 'var1';
+var1000 += 'var1';
+
+// Invalid
+var1 += 'var1';
+var10 += 'var1';
+
+var100 += 'var1';
+var1000 += 'var1';
+
+// Valid
+var test = 100;
+
+// InValid
+var test = 100;
+
+commentStart = phpcsFile.findPrevious();
+commentEnd = this._phpcsFile;
+expected += '...';
+
+// Invalid
+this.okButton = {};
+content = {};
+
+var buttonid = [this.id, '-positionFormats-add'].join('');
+var buttonWidget = WidgetStore.get(buttonid);
+var spinButtonid = [this.id, '-positionFormats-spinButton'].join('');
+var spinButtonWidget = WidgetStore.get(spinButtonid);
+var position = spinButtonWidget.getValue();
+var posForamatsList = WidgetStore.get([self.id, '-positionFormats-list'].join(''));
+
+dfx.stripTags = function(content, allowedTags)
+{
+ var match;
+ var re = 'blah';
+};
+
+var contents += 'if (';
+var conditions = array();
+
+var foo = {};
+foo.blah = 'blah';
+
+var script = document.createElement('script');
+script.onload = function()
+{
+ clearTimeout(t);
+};
+
+stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/);
+function() {
+ if (condition)
+ foo = .4
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.php
new file mode 100644
index 0000000..71aa577
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.php
@@ -0,0 +1,120 @@
+
+ * @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\Formatting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class MultipleStatementAlignmentUnitTest 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 array();
+
+ }//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='MultipleStatementAlignmentUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'MultipleStatementAlignmentUnitTest.inc':
+ return array(
+ 11 => 1,
+ 12 => 1,
+ 23 => 1,
+ 24 => 1,
+ 26 => 1,
+ 27 => 1,
+ 37 => 1,
+ 38 => 1,
+ 48 => 1,
+ 50 => 1,
+ 51 => 1,
+ 61 => 1,
+ 62 => 1,
+ 64 => 1,
+ 65 => 1,
+ 71 => 1,
+ 78 => 1,
+ 79 => 1,
+ 86 => 1,
+ 92 => 1,
+ 93 => 1,
+ 94 => 1,
+ 95 => 1,
+ 123 => 1,
+ 124 => 1,
+ 126 => 1,
+ 129 => 1,
+ 154 => 1,
+ 161 => 1,
+ 178 => 1,
+ 179 => 1,
+ 182 => 1,
+ 206 => 1,
+ 207 => 1,
+ );
+ break;
+ case 'MultipleStatementAlignmentUnitTest.js':
+ return array(
+ 11 => 1,
+ 12 => 1,
+ 23 => 1,
+ 24 => 1,
+ 26 => 1,
+ 27 => 1,
+ 37 => 1,
+ 38 => 1,
+ 48 => 1,
+ 50 => 1,
+ 51 => 1,
+ 61 => 1,
+ 62 => 1,
+ 64 => 1,
+ 65 => 1,
+ 71 => 1,
+ 78 => 1,
+ 79 => 1,
+ 81 => 1,
+ 82 => 1,
+ 83 => 1,
+ 85 => 1,
+ 86 => 1,
+ 100 => 1,
+ );
+ break;
+ default:
+ return array();
+ break;
+ }//end switch
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc
new file mode 100644
index 0000000..ba3bb43
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc
@@ -0,0 +1,45 @@
+
+ * @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\Formatting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class NoSpaceAfterCastUnitTest 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 array(
+ 3 => 1,
+ 5 => 1,
+ 7 => 1,
+ 9 => 1,
+ 11 => 1,
+ 13 => 1,
+ 15 => 1,
+ 17 => 1,
+ 19 => 1,
+ 21 => 1,
+ 23 => 1,
+ 25 => 1,
+ 27 => 1,
+ 29 => 1,
+ 31 => 1,
+ 33 => 1,
+ 35 => 1,
+ 37 => 1,
+ 39 => 1,
+ 41 => 1,
+ 43 => 1,
+ 45 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc
new file mode 100644
index 0000000..ba3bb43
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc
@@ -0,0 +1,45 @@
+
+ * @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\Formatting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SpaceAfterCastUnitTest 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 array(
+ 4 => 1,
+ 5 => 1,
+ 8 => 1,
+ 9 => 1,
+ 12 => 1,
+ 13 => 1,
+ 16 => 1,
+ 17 => 1,
+ 20 => 1,
+ 21 => 1,
+ 24 => 1,
+ 25 => 1,
+ 28 => 1,
+ 29 => 1,
+ 32 => 1,
+ 33 => 1,
+ 36 => 1,
+ 37 => 1,
+ 40 => 1,
+ 41 => 1,
+ 44 => 1,
+ 45 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc
new file mode 100644
index 0000000..c2dd632
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Formatting/SpaceAfterNotUnitTest.inc
@@ -0,0 +1,5 @@
+
+ * @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\Formatting;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SpaceAfterNotUnitTest 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 array(
+ 2 => 2,
+ 4 => 2,
+ 5 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc
new file mode 100644
index 0000000..640d9fd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc
@@ -0,0 +1,33 @@
+myfunc(&$myvar);
+$this->myfunc($myvar);
+
+myclass::myfunc(&$myvar);
+myclass::myfunc($myvar);
+
+while(testfunc($var1, &$var2, $var3, &$var4) === false) {
+}
+
+sprintf("0%o", 0777 & $p);
+
+$foo(&$myvar);
+
+if (is_array($foo = &$this->bar())) {
+}
+
+Hooks::run( 'SecondaryDataUpdates', [ $title, $old, $recursive, $parserOutput, &$updates ] );
+
+$foo = Bar(&$fooBar);
+
+myfunc($myvar&$myvar);
+myfunc($myvar[0]&$myvar);
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php
new file mode 100644
index 0000000..3778f23
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php
@@ -0,0 +1,55 @@
+
+ * @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\Functions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class CallTimePassByReferenceUnitTest 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 array(
+ 9 => 1,
+ 12 => 1,
+ 15 => 1,
+ 18 => 2,
+ 23 => 1,
+ 30 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc
new file mode 100644
index 0000000..ebd1dc2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc
@@ -0,0 +1,125 @@
+getArray($one, $two,$three),$this->arrayMap);
+$this->error($obj->getCode(),$obj->getMessage(),$obj->getFile(),$obj->getLine());
+
+make_foo($string /*the string*/ , true /*test*/);
+make_foo($string/*the string*/ , /*test*/ true);
+make_foo($string /*the string*/, /*test*/ true);
+
+class MyClass {
+ function myFunction() {
+ blah($foo, "{{$config['host']}}", "{$config}", "hi there{}{}{{{}{}{}}");
+ }
+}
+
+// Function definition, not function call, so should be ignored
+function &myFunction($arg1=1,$arg2=2)
+{
+}
+
+return array_udiff(
+ $foo,
+ $bar,
+ function($a, $b) {
+ $foo='bar';
+ return $foo;
+ }
+);
+
+var_dump(<<{$var}($foo,$bar);
+
+(function ($a, $b) {
+ return function ($c, $d) use ($a, $b) {
+ echo $a, $b, $c, $d;
+ };
+})('a','b')('c','d');
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc.fixed
new file mode 100644
index 0000000..8426b8c
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc.fixed
@@ -0,0 +1,125 @@
+getArray($one, $two, $three), $this->arrayMap);
+$this->error($obj->getCode(), $obj->getMessage(), $obj->getFile(), $obj->getLine());
+
+make_foo($string /*the string*/, true /*test*/);
+make_foo($string/*the string*/, /*test*/ true);
+make_foo($string /*the string*/, /*test*/ true);
+
+class MyClass {
+ function myFunction() {
+ blah($foo, "{{$config['host']}}", "{$config}", "hi there{}{}{{{}{}{}}");
+ }
+}
+
+// Function definition, not function call, so should be ignored
+function &myFunction($arg1=1,$arg2=2)
+{
+}
+
+return array_udiff(
+ $foo,
+ $bar,
+ function($a, $b) {
+ $foo='bar';
+ return $foo;
+ }
+);
+
+var_dump(<<{$var}($foo, $bar);
+
+(function ($a, $b) {
+ return function ($c, $d) use ($a, $b) {
+ echo $a, $b, $c, $d;
+ };
+})('a', 'b')('c', 'd');
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php
new file mode 100644
index 0000000..e5c9d9e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.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\Functions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class FunctionCallArgumentSpacingUnitTest 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 array(
+ 5 => 1,
+ 6 => 1,
+ 7 => 2,
+ 8 => 1,
+ 11 => 2,
+ 12 => 2,
+ 13 => 3,
+ 42 => 3,
+ 43 => 3,
+ 45 => 1,
+ 46 => 2,
+ 79 => 1,
+ 82 => 1,
+ 93 => 1,
+ 105 => 1,
+ 107 => 1,
+ 108 => 2,
+ 114 => 1,
+ 115 => 1,
+ 119 => 1,
+ 125 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceBsdAllmanUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceBsdAllmanUnitTest.inc
new file mode 100644
index 0000000..233a013
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceBsdAllmanUnitTest.inc
@@ -0,0 +1,198 @@
+
+ * @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\Functions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OpeningFunctionBraceBsdAllmanUnitTest 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 array(
+ 4 => 1,
+ 13 => 1,
+ 19 => 1,
+ 24 => 1,
+ 30 => 1,
+ 40 => 1,
+ 44 => 1,
+ 50 => 1,
+ 55 => 1,
+ 67 => 1,
+ 78 => 1,
+ 85 => 1,
+ 91 => 1,
+ 98 => 1,
+ 110 => 1,
+ 115 => 1,
+ 122 => 1,
+ 128 => 1,
+ 155 => 1,
+ 158 => 1,
+ 164 => 1,
+ 168 => 1,
+ 172 => 1,
+ 176 => 1,
+ 196 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.inc
new file mode 100644
index 0000000..e7c988f
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.inc
@@ -0,0 +1,169 @@
+
+ * @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\Functions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class OpeningFunctionBraceKernighanRitchieUnitTest 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 array(
+ 9 => 1,
+ 13 => 1,
+ 17 => 1,
+ 29 => 1,
+ 33 => 1,
+ 37 => 1,
+ 53 => 1,
+ 58 => 1,
+ 63 => 1,
+ 77 => 1,
+ 82 => 1,
+ 87 => 1,
+ 104 => 1,
+ 119 => 1,
+ 123 => 1,
+ 127 => 1,
+ 132 => 1,
+ 137 => 1,
+ 142 => 1,
+ 153 => 1,
+ 158 => 1,
+ 167 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.inc
new file mode 100644
index 0000000..2f270ed
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.inc
@@ -0,0 +1,160 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php
new file mode 100644
index 0000000..993048a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @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\Metrics;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class CyclomaticComplexityUnitTest 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 array(116 => 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 array(
+ 45 => 1,
+ 72 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.inc
new file mode 100644
index 0000000..9708792
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.inc
@@ -0,0 +1,102 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php
new file mode 100644
index 0000000..2c1a7c3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php
@@ -0,0 +1,51 @@
+
+ * @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\Metrics;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class NestingLevelUnitTest 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 array(73 => 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 array(
+ 27 => 1,
+ 46 => 1,
+ );
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc
new file mode 100644
index 0000000..2da4998
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.inc
@@ -0,0 +1,149 @@
+
+ * @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\NamingConventions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class CamelCapsFunctionNameUnitTest 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 = array(
+ 10 => 1,
+ 11 => 1,
+ 12 => 1,
+ 13 => 1,
+ 16 => 1,
+ 17 => 1,
+ 20 => 1,
+ 21 => 1,
+ 24 => 1,
+ 25 => 1,
+ 30 => 1,
+ 31 => 1,
+ 50 => 1,
+ 52 => 1,
+ 53 => 1,
+ 57 => 1,
+ 58 => 1,
+ 59 => 1,
+ 60 => 1,
+ 61 => 1,
+ 62 => 1,
+ 63 => 1,
+ 64 => 1,
+ 65 => 1,
+ 66 => 1,
+ 67 => 1,
+ 68 => 1,
+ 69 => 1,
+ 71 => 1,
+ 72 => 1,
+ 73 => 1,
+ 74 => 1,
+ 118 => 1,
+ 144 => 1,
+ 146 => 1,
+ 147 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc
new file mode 100644
index 0000000..ed839b3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc
@@ -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\NamingConventions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class ConstructorNameUnitTest 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 array(
+ 6 => 1,
+ 11 => 1,
+ 47 => 1,
+ 62 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc
new file mode 100644
index 0000000..0b7c0a5
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc
@@ -0,0 +1,171 @@
+define('bar');
+$foo->getBar()->define('foo');
+
+// This is allowed as it is required for PHPUnit.
+if (PHPUnit_MAIN_METHOD == 'PHP_Shell_AllTests::main') {
+ PHP_Shell_AllTests::main();
+}
+
+class ConstTest {
+ const TESTER = '1';
+ public function __construct() {
+ echo constant('self::TESTER');
+ echo constant('self::tester');
+ }
+}
+
+class A {
+ public static function constant($x) {}
+}
+
+A::constant('anything-not-in-uppercase');
+
+// goto
+goto gotolabel;
+
+gototarget1:
+
+function ConstTest() {
+ gototarget2:
+}
+
+switch($foo)
+{
+ case $bar:
+ gototarget3:
+}
+
+$a = 2 * ${x} - ${minus};
+
+class Object implements IObject
+{
+ use TProperties;
+ use TReflected {
+ TReflected::reflect insteadof TProperties;
+ }
+ use ListenerAggregateTrait, PreLoadUserTrait, PreLoadCompanyTrait {
+ PreloadUserTrait::PreLoadUser as loadUser;
+ PreloadCompanyTrait::PreLoadCompany as loadCompany;
+ }
+}
+
+class MyClass {
+ use Something {
+ delete as protected blah;
+ }
+}
+
+class Foo
+{
+ public function bar()
+ {
+ return Bar::class;
+ }
+}
+
+?>
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php
new file mode 100644
index 0000000..2c5b187
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.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\NamingConventions;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class UpperCaseConstantNameUnitTest 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 array(
+ 8 => 1,
+ 10 => 1,
+ 12 => 1,
+ 14 => 1,
+ 19 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/BacktickOperatorUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/BacktickOperatorUnitTest.inc
new file mode 100644
index 0000000..3355c2d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/BacktickOperatorUnitTest.inc
@@ -0,0 +1,2 @@
+
+ * @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 BacktickOperatorUnitTest 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 array(2 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.1.inc
new file mode 100644
index 0000000..2bcf750
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.1.inc
@@ -0,0 +1,9 @@
+Foo
+
+
+
+
\ No newline at end of file
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.2.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.2.inc
new file mode 100644
index 0000000..5f80ab9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/CharacterBeforePHPOpeningTagUnitTest.2.inc
@@ -0,0 +1,4 @@
+#!/usr/bin/env php
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @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 CharacterBeforePHPOpeningTagUnitTest 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 'CharacterBeforePHPOpeningTagUnitTest.1.inc':
+ return array(2 => 1);
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.inc
new file mode 100644
index 0000000..1037c9e
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/ClosingPHPTagUnitTest.inc
@@ -0,0 +1,10 @@
+
+Bold text
+
+Italic text
+
+ * @copyright 2010-2014 Andy Grunwald
+ * @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 ClosingPHPTagUnitTest 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 array(9 => 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc
new file mode 100644
index 0000000..8b618fb
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.1.inc
@@ -0,0 +1,14 @@
+
+
+Some content here.
+
+
+
+
+
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 0000000..2a695c8
--- /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 0000000..cd5a662
--- /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 0000000..6eafb42
--- /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.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php
new file mode 100644
index 0000000..db3683b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowAlternativePHPTagsUnitTest.php
@@ -0,0 +1,104 @@
+
+ * @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 = array($testFileBase.'1.inc');
+
+ $aspTags = false;
+ if (PHP_VERSION_ID < 70000) {
+ $aspTags = (boolean) ini_get('asp_tags');
+ }
+
+ if ($aspTags === true) {
+ $testFiles[] = $testFileBase.'2.inc';
+ }
+
+ return $testFiles;
+
+ }//end getTestFiles()
+
+
+ /**
+ * Skip this test on HHVM.
+ *
+ * @return bool Whether to skip this test.
+ */
+ protected function shouldSkipTest()
+ {
+ return defined('HHVM_VERSION');
+
+ }//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.
+ *
+ * @param string $testFile The name of the file being tested.
+ *
+ * @return array
+ */
+ public function getErrorList($testFile='')
+ {
+ switch ($testFile) {
+ case 'DisallowAlternativePHPTagsUnitTest.1.inc':
+ return array(
+ 4 => 1,
+ 7 => 1,
+ 8 => 1,
+ 11 => 1,
+ );
+ case 'DisallowAlternativePHPTagsUnitTest.2.inc':
+ return array(
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 5 => 1,
+ );
+ default:
+ return array();
+ }//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 array();
+
+ }//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 0000000..040e62d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.1.inc
@@ -0,0 +1,11 @@
+
+
+Some content here.
+
+= $var; ?>
+Some content = $var ?> Some more content
+=
+$var;
+?>
+=$var; ?>
+
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 0000000..1ea281a
--- /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 0000000..85617de
--- /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 0000000..afe5d8f
--- /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 0000000..9b7ccd6
--- /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.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.inc
new file mode 100644
index 0000000..6ed7dad
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.inc
@@ -0,0 +1,6 @@
+
+
+Some content here.
+= $var; ?>
+ echo $var; ?>
+
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 0000000..a20a50b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php
@@ -0,0 +1,122 @@
+
+ * @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 = array($testFileBase.'1.inc');
+
+ $option = (boolean) ini_get('short_open_tag');
+ if ($option === true || defined('HHVM_VERSION') === 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':
+ if (PHP_VERSION_ID < 50400) {
+ $option = (boolean) ini_get('short_open_tag');
+ if ($option === false) {
+ // Short open tags are off and PHP isn't doing short echo by default.
+ return array();
+ }
+ }
+ return array(
+ 5 => 1,
+ 6 => 1,
+ 7 => 1,
+ 10 => 1,
+ );
+ case 'DisallowShortOpenTagUnitTest.2.inc':
+ return array(
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ );
+ default:
+ return array();
+ }//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':
+ if (PHP_VERSION_ID < 50400) {
+ $option = (boolean) ini_get('short_open_tag');
+ if ($option === false) {
+ // Short open tags are off and PHP isn't doing short echo by default.
+ return array(
+ 5 => 1,
+ 6 => 1,
+ 7 => 1,
+ 10 => 1,
+ );
+ }
+ }
+ return array();
+ case 'DisallowShortOpenTagUnitTest.3.inc':
+ return array(
+ 3 => 1,
+ 6 => 1,
+ 11 => 1,
+ );
+ default:
+ return array();
+ }//end switch
+
+ }//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 0000000..7a63152
--- /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;
+ delete insteadof delete;
+ }
+}
+
+namespace Something\sizeof;
+$var = new Sizeof();
+class SizeOf implements Something {}
+
+function mymodule_form_callback(SizeOf $sizeof) {
+}
+
+?>
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 0000000..52a4578
--- /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 = array(
+ 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 array();
+
+ }//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 0000000..63aea51
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
@@ -0,0 +1,83 @@
+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]);
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 0000000..b3c3d8a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc.fixed
@@ -0,0 +1,83 @@
+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]);
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 0000000..87cfb82
--- /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 0000000..7dbf3ad
--- /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 0000000..749470d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.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\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 array(
+ 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,
+ );
+ break;
+ case 'LowerCaseConstantUnitTest.js':
+ return array(
+ 2 => 1,
+ 3 => 1,
+ 4 => 1,
+ 7 => 1,
+ 8 => 1,
+ 12 => 1,
+ 13 => 1,
+ 14 => 1,
+ );
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//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 0000000..eb31ce2
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc
@@ -0,0 +1,31 @@
+
+ * @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 array(
+ 10 => 3,
+ 11 => 4,
+ 12 => 1,
+ 13 => 3,
+ 14 => 7,
+ 15 => 1,
+ 16 => 1,
+ 19 => 1,
+ 20 => 1,
+ 21 => 1,
+ 25 => 1,
+ 28 => 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 array();
+
+ }//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 0000000..7ff31ba
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc
@@ -0,0 +1,9 @@
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.php
new file mode 100644
index 0000000..fb61d41
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.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 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 array();
+
+ }//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 array(5 => 1);
+
+ }//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 0000000..8f378c8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SAPIUsageUnitTest.inc
@@ -0,0 +1,4 @@
+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 0000000..287db68
--- /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 array(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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.inc
new file mode 100644
index 0000000..4f0d9d8
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.inc
@@ -0,0 +1,4 @@
+
+ * @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\Config;
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class SyntaxUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Should this test be skipped for some reason.
+ *
+ * @return void
+ */
+ protected function shouldSkipTest()
+ {
+ if (defined('PHP_BINARY') === true) {
+ return false;
+ }
+
+ $phpPath = Config::getExecutablePath('php');
+ if ($phpPath === null) {
+ return true;
+ }
+
+ return false;
+
+ }//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 array(3 => 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 array();
+
+ }//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 0000000..e7e496d
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
@@ -0,0 +1,81 @@
+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() {}
\ No newline at end of file
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 0000000..7d8d6b3
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed
@@ -0,0 +1,81 @@
+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() {}
\ No newline at end of file
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 0000000..81d7826
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php
@@ -0,0 +1,63 @@
+
+ * @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 array(
+ 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,
+ );
+
+ }//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 array();
+
+ }//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 0000000..7a2b201
--- /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 0000000..6be7900
--- /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 0000000..58d83fb
--- /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 array(
+ 2 => 1,
+ 6 => 1,
+ 9 => 1,
+ 12 => 1,
+ 19 => 1,
+ 20 => 1,
+ );
+ break;
+ case 'UnnecessaryStringConcatUnitTest.js':
+ return array(
+ 1 => 1,
+ 8 => 1,
+ 11 => 1,
+ 14 => 1,
+ 15 => 1,
+ );
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css
new file mode 100644
index 0000000..8bd566b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css
@@ -0,0 +1,4 @@
+#login-container {
+ margin-left: -225px;
+ width: 450px;
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css.fixed
new file mode 100644
index 0000000..edca8e9
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.css.fixed
@@ -0,0 +1,4 @@
+#login-container {
+ margin-left: -225px;
+ width: 450px;
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.inc
new file mode 100644
index 0000000..9a9a8fd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.inc
@@ -0,0 +1,82 @@
+";
+ 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
+
+
+
+
+
+
+
+ * @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\WhiteSpace;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowSpaceIndentUnitTest 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='DisallowSpaceIndentUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'DisallowSpaceIndentUnitTest.inc':
+ return array(
+ 5 => 1,
+ 9 => 1,
+ 15 => 1,
+ 22 => 1,
+ 24 => 1,
+ 30 => 1,
+ 35 => 1,
+ 50 => 1,
+ 55 => 1,
+ 57 => 1,
+ 58 => 1,
+ 59 => 1,
+ 60 => 1,
+ 65 => 1,
+ 66 => 1,
+ 67 => 1,
+ 68 => 1,
+ 69 => 1,
+ 70 => 1,
+ 73 => 1,
+ 77 => 1,
+ 81 => 1,
+ );
+ break;
+ case 'DisallowSpaceIndentUnitTest.js':
+ return array(3 => 1);
+ break;
+ case 'DisallowSpaceIndentUnitTest.css':
+ return array(2 => 1);
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css
new file mode 100644
index 0000000..80870da
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css
@@ -0,0 +1,5 @@
+#login-container {
+ margin-left: -225px;
+ width: 450px;
+}
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css.fixed
new file mode 100644
index 0000000..a8fa12b
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css.fixed
@@ -0,0 +1,5 @@
+#login-container {
+ margin-left: -225px;
+ width: 450px;
+}
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc
new file mode 100644
index 0000000..8e5bdf6
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc
@@ -0,0 +1,51 @@
+ 'Czech republic',
+ 'România' => 'Romania',
+ 'Magyarország' => 'Hungary',
+);
+
+$var = "$hello $there";
+
+?>
+
+
+ Foo
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc.fixed
new file mode 100644
index 0000000..7607a06
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc.fixed
@@ -0,0 +1,51 @@
+ 'Czech republic',
+ 'România' => 'Romania',
+ 'Magyarország' => 'Hungary',
+);
+
+$var = "$hello $there";
+
+?>
+
+
+ Foo
+
+
+
+
+
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js
new file mode 100644
index 0000000..ca4d67a
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js
@@ -0,0 +1,9 @@
+var x = {
+ abc: 1,
+ zyz: 2,
+ abc: 5,
+ mno: {
+ abc: 4
+ },
+ abc: 5
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js.fixed
new file mode 100644
index 0000000..42a2837
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js.fixed
@@ -0,0 +1,9 @@
+var x = {
+ abc: 1,
+ zyz: 2,
+ abc: 5,
+ mno: {
+ abc: 4
+ },
+ abc: 5
+}
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php
new file mode 100644
index 0000000..61be345
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.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\WhiteSpace;
+
+use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
+
+class DisallowTabIndentUnitTest extends AbstractSniffUnitTest
+{
+
+
+ /**
+ * Get a list of CLI values to set before the file is tested.
+ *
+ * @param string $testFile The name of the file being tested.
+ * @param \PHP_CodeSniffer\Config $config The config data for the test run.
+ *
+ * @return void
+ */
+ public function setCliValues($testFile, $config)
+ {
+ $config->tabWidth = 4;
+
+ }//end setCliValues()
+
+
+ /**
+ * 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='DisallowTabIndentUnitTest.inc')
+ {
+ switch ($testFile) {
+ case 'DisallowTabIndentUnitTest.inc':
+ return array(
+ 5 => 2,
+ 9 => 1,
+ 15 => 1,
+ 20 => 2,
+ 21 => 1,
+ 22 => 2,
+ 23 => 1,
+ 24 => 2,
+ 31 => 1,
+ 32 => 2,
+ 33 => 2,
+ 41 => 1,
+ 42 => 1,
+ 43 => 1,
+ 44 => 1,
+ 45 => 1,
+ 46 => 1,
+ 47 => 1,
+ 48 => 1,
+ );
+ break;
+ case 'DisallowTabIndentUnitTest.js':
+ return array(
+ 3 => 1,
+ 5 => 1,
+ 6 => 1,
+ );
+ break;
+ case 'DisallowTabIndentUnitTest.css':
+ return array(
+ 1 => 1,
+ 2 => 1,
+ );
+ break;
+ default:
+ return array();
+ 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 array();
+
+ }//end getWarningList()
+
+
+}//end class
diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc
new file mode 100644
index 0000000..6d617bd
--- /dev/null
+++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.1.inc
@@ -0,0 +1,1273 @@
+@codingStandardsChangeSetting Generic.WhiteSpace.ScopeIndent tabIndent false
+
+hello();
+ }
+
+ function hello()
+ {
+ echo 'hello';
+}//end hello()
+
+ function hello2()
+ {
+ if (TRUE) {
+ echo 'hello'; // no error here as its more than 4 spaces.
+ } else {
+ echo 'bye';
+ }
+
+ while (TRUE) {
+ echo 'hello';
+ }
+
+ do {
+ echo 'hello';
+ } while (TRUE);
+ }
+
+ function hello3()
+ {
+ switch ($hello) {
+ case 'hello':
+ break;
+ }
+ }
+
+}
+
+?>
+
+
+
+validate()) {
+ $safe = $form->getSubmitValues();
+}
+?>
+
+open(); // error here
+ }
+
+ public function open()
+ {
+ // Some inline stuff that shouldn't error
+ if (TRUE) echo 'hello';
+ foreach ($tokens as $token) echo $token;
+ }
+
+ /**
+ * This is a comment 1.
+ * This is a comment 2.
+ * This is a comment 3.
+ * This is a comment 4.
+ */
+ public function close()
+ {
+ // All ok.
+ if (TRUE) {
+ if (TRUE) {
+ } else if (FALSE) {
+ foreach ($tokens as $token) {
+ switch ($token) {
+ case '1':
+ case '2':
+ if (true) {
+ if (false) {
+ if (false) {
+ if (false) {
+ echo 'hello';
+ }
+ }
+ }
+ }
+ break;
+ case '5':
+ break;
+ }
+ do {
+ while (true) {
+ foreach ($tokens as $token) {
+ for ($i = 0; $i < $token; $i++) {
+ echo 'hello';
+ }
+ }
+ }
+ } while (true);
+ }
+ }
+ }
+ }
+
+ /*
+ This is another c style comment 1.
+ This is another c style comment 2.
+ This is another c style comment 3.
+ This is another c style comment 4.
+ This is another c style comment 5.
+ */
+
+ /* This is a T_COMMENT
+ *
+ *
+ *
+ */
+
+ /** This is a T_DOC_COMMENT
+ */
+
+ /*
+ This T_COMMENT has a newline in it.
+
+ */
+
+ public function read()
+ {
+ echo 'hello';
+
+ // no errors below.
+ $array = array(
+ 'this',
+ 'that' => array(
+ 'hello',
+ 'hello again' => array(
+ 'hello',
+ ),
+ ),
+ );
+ }
+}
+
+abstract class Test3
+{
+ public function parse()
+ {
+
+ foreach ($t as $ndx => $token) {
+ if (is_array($token)) {
+ echo 'here';
+ } else {
+ $ts[] = array("token" => $token, "value" => '');
+
+ $last = count($ts) - 1;
+
+ switch ($token) {
+ case '(':
+
+ if ($last >= 3 &&
+ $ts[0]['token'] != T_CLASS &&
+ $ts[$last - 2]['token'] == T_OBJECT_OPERATOR &&
+ $ts[$last - 3]['token'] == T_VARIABLE ) {
+
+
+ if (true) {
+ echo 'hello';
+ }
+ }
+ array_push($braces, $token);
+ break;
+ }
+ }
+ }
+ }
+}
+
+public function test()
+{
+ $o = <<
+