From 2f90fdc80ecbad2b5e76f33f39e60207ad1f8ae9 Mon Sep 17 00:00:00 2001 From: Shea Lewis Date: Tue, 23 Aug 2016 16:00:37 -0700 Subject: [PATCH] Clean things up and update to Laravel 5.3 --- .scrutinizer.yml | 9 --- .travis.yml | 9 --- README.md | 3 +- composer.json | 15 ++--- phpunit.xml | 18 ----- src/ShinobiServiceProvider.php | 21 ------ src/Twig/Node/Twig_Node_Can.php | 51 -------------- src/Twig/Node/Twig_Node_CanAtLeast.php | 51 -------------- src/Twig/Node/Twig_Node_Role.php | 51 -------------- src/Twig/TokenParser/Twig_TokenParser_Can.php | 66 ------------------- .../Twig_TokenParser_CanAtLeast.php | 66 ------------------- .../TokenParser/Twig_TokenParser_Role.php | 66 ------------------- 12 files changed, 7 insertions(+), 419 deletions(-) delete mode 100644 .scrutinizer.yml delete mode 100644 .travis.yml delete mode 100644 phpunit.xml delete mode 100644 src/Twig/Node/Twig_Node_Can.php delete mode 100644 src/Twig/Node/Twig_Node_CanAtLeast.php delete mode 100644 src/Twig/Node/Twig_Node_Role.php delete mode 100644 src/Twig/TokenParser/Twig_TokenParser_Can.php delete mode 100644 src/Twig/TokenParser/Twig_TokenParser_CanAtLeast.php delete mode 100644 src/Twig/TokenParser/Twig_TokenParser_Role.php diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 957d860..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,9 +0,0 @@ -tools: - php_sim: true - php_pdepend: true - php_analyzer: true - external_code_coverage: false -filter: - excluded_paths: - - 'tests/*' - - 'vendor/*' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cb11222..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: php - -php: - - 5.5 - - 5.6 - - hhvm - -before_script: - - composer install --prefer-source --no-interaction --dev \ No newline at end of file diff --git a/README.md b/README.md index 97e9f22..0525256 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ Caffeinated Shinobi =================== -[![Laravel 5.1](https://img.shields.io/badge/Laravel-5.1-orange.svg?style=flat-square)](http://laravel.com) -[![Laravel 5.2](https://img.shields.io/badge/Laravel-5.2-orange.svg?style=flat-square)](http://laravel.com) +[![Laravel 5.3](https://img.shields.io/badge/Laravel-5.3-orange.svg?style=flat-square)](http://laravel.com) [![Source](http://img.shields.io/badge/source-caffeinated/shinobi-blue.svg?style=flat-square)](https://github.com/caffeinated/shinobi) [![Build Status](http://img.shields.io/travis/caffeinated/shinobi/master.svg?style=flat-square)](https://travis-ci.org/caffeinated/shinobi) [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://tldrlegal.com/license/mit-license) diff --git a/composer.json b/composer.json index 46a03f3..00fd3f6 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,11 @@ } ], "require": { - "php": ">=5.5.9", - "illuminate/database": "5.1.*|5.2.*", - "illuminate/support": "5.1.*|5.2.*", - "illuminate/filesystem": "5.1.*|5.2.*", - "illuminate/config": "5.1.*|5.2.*" - }, - "require-dev": { - "mockery/mockery": "~0.9" + "php": ">=5.6.4", + "illuminate/database": "5.3.*", + "illuminate/support": "5.3.*", + "illuminate/filesystem": "5.3.*", + "illuminate/config": "5.3.*" }, "autoload": { "psr-4": { @@ -26,7 +23,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "minimum-stability": "dev" diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index c356c71..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - ./tests/ - - - \ No newline at end of file diff --git a/src/ShinobiServiceProvider.php b/src/ShinobiServiceProvider.php index 849cf0a..656eb3f 100644 --- a/src/ShinobiServiceProvider.php +++ b/src/ShinobiServiceProvider.php @@ -39,8 +39,6 @@ public function register() return new \Caffeinated\Shinobi\Shinobi($auth); }); - - $this->configureTwig(); } /** @@ -84,23 +82,4 @@ public function provides() { return ['shinobi']; } - - /** - * Configure Twig - * - * Registers the necessary Caffeinated Shinobi tags with Twig; - * only if Twig is set as the template engine. - * - * @return null - */ - protected function configureTwig() - { - $engine = $this->app['config']->get('themes.engine'); - - if ($engine == 'twig') { - $this->app['config']->push('sapling.tags', 'Caffeinated\Shinobi\Twig\TokenParser\Twig_TokenParser_Can'); - $this->app['config']->push('sapling.tags', 'Caffeinated\Shinobi\Twig\TokenParser\Twig_TokenParser_CanAtLeast'); - $this->app['config']->push('sapling.tags', 'Caffeinated\Shinobi\Twig\TokenParser\Twig_TokenParser_Role'); - } - } } diff --git a/src/Twig/Node/Twig_Node_Can.php b/src/Twig/Node/Twig_Node_Can.php deleted file mode 100644 index a71b33b..0000000 --- a/src/Twig/Node/Twig_Node_Can.php +++ /dev/null @@ -1,51 +0,0 @@ - $tests, 'else' => $else), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (\\Shinobi::can(') - ; - } else { - $compiler - ->write('if (\\Shinobi::can(') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(")) {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else') && null !== $this->getNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} diff --git a/src/Twig/Node/Twig_Node_CanAtLeast.php b/src/Twig/Node/Twig_Node_CanAtLeast.php deleted file mode 100644 index 26b8dcc..0000000 --- a/src/Twig/Node/Twig_Node_CanAtLeast.php +++ /dev/null @@ -1,51 +0,0 @@ - $tests, 'else' => $else), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (\\Shinobi::canAtLeast(') - ; - } else { - $compiler - ->write('if (\\Shinobi::canAtLeast(') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(")) {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else') && null !== $this->getNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} diff --git a/src/Twig/Node/Twig_Node_Role.php b/src/Twig/Node/Twig_Node_Role.php deleted file mode 100644 index 0bc2c68..0000000 --- a/src/Twig/Node/Twig_Node_Role.php +++ /dev/null @@ -1,51 +0,0 @@ - $tests, 'else' => $else), array(), $lineno, $tag); - } - - public function compile(Twig_Compiler $compiler) - { - $compiler->addDebugInfo($this); - for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { - if ($i > 0) { - $compiler - ->outdent() - ->write('} elseif (\\Shinobi::is(') - ; - } else { - $compiler - ->write('if (\\Shinobi::is(') - ; - } - - $compiler - ->subcompile($this->getNode('tests')->getNode($i)) - ->raw(")) {\n") - ->indent() - ->subcompile($this->getNode('tests')->getNode($i + 1)) - ; - } - - if ($this->hasNode('else') && null !== $this->getNode('else')) { - $compiler - ->outdent() - ->write("} else {\n") - ->indent() - ->subcompile($this->getNode('else')) - ; - } - - $compiler - ->outdent() - ->write("}\n"); - } -} diff --git a/src/Twig/TokenParser/Twig_TokenParser_Can.php b/src/Twig/TokenParser/Twig_TokenParser_Can.php deleted file mode 100644 index da44cf5..0000000 --- a/src/Twig/TokenParser/Twig_TokenParser_Can.php +++ /dev/null @@ -1,66 +0,0 @@ -getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elsecan': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endcan': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elsecan", or "endcan" to close the "if" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Can(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('elsecan', 'else', 'endcan')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endcan')); - } - - public function getTag() - { - return 'can'; - } -} diff --git a/src/Twig/TokenParser/Twig_TokenParser_CanAtLeast.php b/src/Twig/TokenParser/Twig_TokenParser_CanAtLeast.php deleted file mode 100644 index f5e33ad..0000000 --- a/src/Twig/TokenParser/Twig_TokenParser_CanAtLeast.php +++ /dev/null @@ -1,66 +0,0 @@ -getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elsecanatleast': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endcanatleast': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elsecanatleast", or "endcanatleast" to close the "canatleast" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_CanAtLeast(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('elsecanatleast', 'else', 'endcanatleast')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endcanatleast')); - } - - public function getTag() - { - return 'canatleast'; - } -} diff --git a/src/Twig/TokenParser/Twig_TokenParser_Role.php b/src/Twig/TokenParser/Twig_TokenParser_Role.php deleted file mode 100644 index 76d6826..0000000 --- a/src/Twig/TokenParser/Twig_TokenParser_Role.php +++ /dev/null @@ -1,66 +0,0 @@ -getLine(); - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests = array($expr, $body); - $else = null; - - $end = false; - while (!$end) { - switch ($stream->next()->getValue()) { - case 'else': - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $else = $this->parser->subparse(array($this, 'decideIfEnd')); - break; - - case 'elserole': - $expr = $this->parser->getExpressionParser()->parseExpression(); - $stream->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideIfFork')); - $tests[] = $expr; - $tests[] = $body; - break; - - case 'endrole': - $end = true; - break; - - default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elserole", or "endrole" to close the "role" block started at line %d).', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); - } - } - - $stream->expect(Twig_Token::BLOCK_END_TYPE); - - return new Twig_Node_Role(new Twig_Node($tests), $else, $lineno, $this->getTag()); - } - - public function decideIfFork(Twig_Token $token) - { - return $token->test(array('elserole', 'else', 'endrole')); - } - - public function decideIfEnd(Twig_Token $token) - { - return $token->test(array('endrole')); - } - - public function getTag() - { - return 'role'; - } -}