Permalink
Browse files

[#13684] - PHPCS corrections and license header

  • Loading branch information...
niden committed Dec 23, 2018
1 parent ac0e3e7 commit 74c202325401805167b90ddd1b138b3433f5eba7
@@ -1,71 +1,64 @@
<?php
declare(strict_types=1);
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <team@phalconphp.com>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Zephir\Optimizers\FunctionCall;
use Zephir\Call;
use Zephir\CompilationContext;
use Zephir\CompilerException;
use Zephir\CompiledExpression;
use Zephir\CompilerException;
use Zephir\Optimizers\OptimizerAbstract;
class PhalconCssminOptimizer extends OptimizerAbstract
{
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression|mixed
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*
* @return bool|CompiledExpression|mixed
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_cssmin only accepts one parameter", $expression);
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_cssmin only accepts one parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('phalcon/assets/filters/cssminifier');
$symbolVariable->setDynamicTypes('string');
$context->headersManager->add('phalcon/assets/filters/cssminifier');
$symbolVariable->setDynamicTypes('string');
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
$resolvedParams = $call->getResolvedParams($expression['parameters'], $context, $expression);
$context->codePrinter->output('phalcon_cssmin(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
$context->codePrinter->output('phalcon_cssmin(' . $symbolVariable->getName() . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
}
@@ -1,29 +1,21 @@
<?php
declare(strict_types=1);
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <team@phalconphp.com>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Zephir\Optimizers\FunctionCall;
use Zephir\Call;
use Zephir\CompilationContext;
use Zephir\CompilerException;
use Zephir\CompiledExpression;
use Zephir\CompilerException;
use Zephir\Optimizers\OptimizerAbstract;
/**
@@ -34,9 +26,10 @@
class PhalconEscapeCssOptimizer extends OptimizerAbstract
{
/**
* @param array $expression
* @param Call $call
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*
* @return bool|CompiledExpression
*
* @throws CompilerException
@@ -1,29 +1,21 @@
<?php
declare(strict_types=1);
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <team@phalconphp.com>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Zephir\Optimizers\FunctionCall;
use Zephir\Call;
use Zephir\CompilationContext;
use Zephir\CompilerException;
use Zephir\CompiledExpression;
use Zephir\CompilerException;
use Zephir\Optimizers\OptimizerAbstract;
/**
@@ -34,9 +26,10 @@
class PhalconEscapeJsOptimizer extends OptimizerAbstract
{
/**
* @param array $expression
* @param Call $call
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*
* @return bool|CompiledExpression
*
* @throws CompilerException
@@ -1,72 +1,65 @@
<?php
declare(strict_types=1);
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <team@phalconphp.com>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Zephir\Optimizers\FunctionCall;
use Zephir\Call;
use Zephir\CompilationContext;
use Zephir\CompilerException;
use Zephir\CompiledExpression;
use Zephir\CompilerException;
use Zephir\Optimizers\OptimizerAbstract;
class PhalconFilterAlphanumOptimizer extends OptimizerAbstract
{
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
* @return bool|CompiledExpression
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
/**
* @param array $expression
* @param Call $call
* @param CompilationContext $context
*
* @return bool|CompiledExpression
* @throws CompilerException
*/
public function optimize(array $expression, Call $call, CompilationContext $context)
{
if (!isset($expression['parameters'])) {
return false;
}
if (!isset($expression['parameters'])) {
return false;
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_filter_alphanum only accepts one parameter", $expression);
}
if (count($expression['parameters']) != 1) {
throw new CompilerException("phalcon_filter_alphanum only accepts one parameter", $expression);
}
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->getType() != 'variable') {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('kernel/filter');
$context->headersManager->add('kernel/filter');
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('zephir_filter_alphanum(' . $symbol . ', ' . $resolvedParams[0] . ');');
$symbol = $context->backend->getVariableCode($symbolVariable);
$context->codePrinter->output('zephir_filter_alphanum(' . $symbol . ', ' . $resolvedParams[0] . ');');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
}
Oops, something went wrong.

0 comments on commit 74c2023

Please sign in to comment.