Skip to content
This repository was archived by the owner on Mar 15, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\DependencyInjection;
namespace Profideo\FormulaInterpretorBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand All @@ -18,31 +18,31 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('formula_interpreter');
$rootNode = $treeBuilder->root('formula_interpretor');

$rootNode
->append($this->getFormulaInterpreterExcelNode())
->append($this->getFormulaInterpretorExcelNode())
;

return $treeBuilder;
}

private function getFormulaInterpreterExcelNode()
private function getFormulaInterpretorExcelNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('excel');

$node
->append($this->getFormulaInterpreterExcelConstantsNode())
->append($this->getFormulaInterpreterExcelFunctionsNode())
->append($this->getFormulaInterpreterExcelScopeNode())
->append($this->getFormulaInterpretorExcelConstantsNode())
->append($this->getFormulaInterpretorExcelFunctionsNode())
->append($this->getFormulaInterpretorExcelScopeNode())
->end()
;

return $node;
}

private function getFormulaInterpreterExcelConstantsNode()
private function getFormulaInterpretorExcelConstantsNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('constants');
Expand All @@ -68,7 +68,7 @@ private function getFormulaInterpreterExcelConstantsNode()
return $node;
}

private function getFormulaInterpreterExcelFunctionsNode()
private function getFormulaInterpretorExcelFunctionsNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('functions');
Expand Down Expand Up @@ -121,7 +121,7 @@ private function getFormulaInterpreterExcelFunctionsNode()
return $node;
}

private function getFormulaInterpreterExcelScopeNode()
private function getFormulaInterpretorExcelScopeNode()
{
$treeBuilder = new TreeBuilder();
$node = $treeBuilder->root('scopes');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\DependencyInjection;
namespace Profideo\FormulaInterpretorBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -11,9 +11,9 @@
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

class ProfideoFormulaInterpreterExtension extends Extension
class ProfideoFormulaInterpretorExtension extends Extension
{
private $excelFunctionBaseName = 'profideo.formula_interpreter.excel.function';
private $excelFunctionBaseName = 'profideo.formula_interpretor.excel.function';

/**
* {@inheritdoc}
Expand All @@ -27,7 +27,7 @@ public function load(array $configs, ContainerBuilder $container)
$config = $this->processConfiguration($configuration, $configs);

if (isset($config['excel']) && !empty($config['excel'])) {
$this->buildFormulaInterpreterExcelDefinition($container, $config['excel']);
$this->buildFormulaInterpretorExcelDefinition($container, $config['excel']);
}
}

Expand All @@ -37,7 +37,7 @@ public function load(array $configs, ContainerBuilder $container)
* @param ContainerBuilder $container
* @param $config
*/
private function buildFormulaInterpreterExcelDefinition(ContainerBuilder $container, $config)
private function buildFormulaInterpretorExcelDefinition(ContainerBuilder $container, $config)
{
foreach ($config['scopes'] as $scopeName => $scope) {
$functions = $config['functions'];
Expand Down Expand Up @@ -102,10 +102,10 @@ private function buildFormulaInterpreterExcelDefinition(ContainerBuilder $contai

// Defines ExpressionLanguageProvider service using a list of ExpressionFunction.
$expressionLanguageProvider = new Definition();
$expressionLanguageProvider->setClass($container->getParameter('profideo.formula_interpreter.excel.expression_language_provider.class'));
$expressionLanguageProvider->setClass($container->getParameter('profideo.formula_interpretor.excel.expression_language_provider.class'));
$expressionLanguageProvider->setArguments([$functionDefinitions]);
$expressionLanguageProvider->setPublic(false);
$container->setDefinition("profideo.formula_interpreter.excel.expression_language_provider.$scopeName", $expressionLanguageProvider);
$container->setDefinition("profideo.formula_interpretor.excel.expression_language_provider.$scopeName", $expressionLanguageProvider);

$constantList = $config['constants'];

Expand Down Expand Up @@ -144,26 +144,26 @@ private function buildFormulaInterpreterExcelDefinition(ContainerBuilder $contai
// - start with equal configuration
// - minimum number of functions configuration
$expressionLanguage = new Definition();
$expressionLanguage->setClass($container->getParameter('profideo.formula_interpreter.excel.expression_language.class'));
$expressionLanguage->setClass($container->getParameter('profideo.formula_interpretor.excel.expression_language.class'));
$expressionLanguage->setArguments(array(
null,
[$container->getDefinition("profideo.formula_interpreter.excel.expression_language_provider.$scopeName")],
[$container->getDefinition("profideo.formula_interpretor.excel.expression_language_provider.$scopeName")],
$constants,
$scope['start_with_equal'],
$scope['minimum_number_of_functions'],
));
$expressionLanguage->setPublic(false);
$container->setDefinition("profideo.formula_interpreter.excel.expression_language.$scopeName", $expressionLanguage);
$container->setDefinition("profideo.formula_interpretor.excel.expression_language.$scopeName", $expressionLanguage);

// Defines FormulaInterpreter service using:
// Defines FormulaInterpretor service using:
// - ExpressionLanguage service
$formulaInterpreter = new Definition();
$formulaInterpreter->setClass($container->getParameter('profideo.formula_interpreter.excel.formula_interpreter.class'));
$formulaInterpreter->setArguments(array(
$container->getDefinition("profideo.formula_interpreter.excel.expression_language.$scopeName")
$formulaInterpretor = new Definition();
$formulaInterpretor->setClass($container->getParameter('profideo.formula_interpretor.excel.formula_interpretor.class'));
$formulaInterpretor->setArguments(array(
$container->getDefinition("profideo.formula_interpretor.excel.expression_language.$scopeName")
));
$formulaInterpreter->setPublic(true);
$container->setDefinition("profideo.formula_interpreter.excel.$scopeName", $formulaInterpreter);
$formulaInterpretor->setPublic(true);
$container->setDefinition("profideo.formula_interpretor.excel.$scopeName", $formulaInterpretor);
}
}

Expand All @@ -176,42 +176,42 @@ private function getDefaultExcelFunctions()
{
return array(
'and' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\AndExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\AndExpressionFunction',
'translations' => array('AND', 'ET'),
'services' => array(),
),
'concatenate' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\ConcatenateExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\ConcatenateExpressionFunction',
'translations' => array('CONCATENATE', 'CONCATENER'),
'services' => array(),
),
'if' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\IfExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\IfExpressionFunction',
'translations' => array('IF', 'SI'),
'services' => array(),
),
'max' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\MaxExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\MaxExpressionFunction',
'translations' => array('MAX'),
'services' => array(),
),
'min' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\MinExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\MinExpressionFunction',
'translations' => array('MIN'),
'services' => array(),
),
'or' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\OrExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\OrExpressionFunction',
'translations' => array('OR', 'OU'),
'services' => array(),
),
'pow' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\PowExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\PowExpressionFunction',
'translations' => array('POW', 'PUISSANCE'),
'services' => array(),
),
'round' => array(
'class' => 'Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction\RoundExpressionFunction',
'class' => 'Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction\RoundExpressionFunction',
'translations' => array('ROUND', 'ARRONDI'),
'services' => array(),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

use Profideo\Component\ExpressionLanguage\Lexer;
use Profideo\Component\ExpressionLanguage\SyntaxError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

use Profideo\Component\ExpressionLanguage\Parser;
use Profideo\Component\ExpressionLanguage\Token;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

class ExpressionError extends \LogicException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

use Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionError;
use Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionError;

/**
* Represents the "AND" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

/**
* Represents the "CONCATENATE" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

use Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionError;
use Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionError;
use Profideo\Component\ExpressionLanguage\ExpressionFunction as BaseExpressionFunction;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

/**
* Represents the "IF" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

/**
* Represents the "MAX" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

/**
* Represents the "MIN" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

use Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionError;
use Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionError;

/**
* Represents the "OR" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

/**
* Represents the "POW" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionFunction;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionFunction;

use Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage\ExpressionError;
use Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionError;

/**
* Represents the "ROUND" function that can be used in an expression.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

use Profideo\Component\ExpressionLanguage\Expression;
use Profideo\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

use Profideo\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Excel\ExpressionLanguage;
namespace Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage;

use Profideo\Component\ExpressionLanguage\ParsedExpression;

class FormulaInterpreter
class FormulaInterpretor
{
private $expressionLanguage;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Profideo\FormulaInterpretorBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ProfideoFormulaInterpretorBundle extends Bundle
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
profideo.formula_interpretor.excel.expression_language.class: Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionLanguage
profideo.formula_interpretor.excel.formula_interpretor.class: Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\FormulaInterpretor
profideo.formula_interpretor.excel.expression_language_provider.class: Profideo\FormulaInterpretorBundle\Excel\ExpressionLanguage\ExpressionLanguageProvider
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Profideo\FormulaInterpreterBundle\Tests;
namespace Profideo\FormulaInterpretorBundle\Tests;

use Profideo\FormulaInterpreterBundle\DependencyInjection\ProfideoFormulaInterpreterExtension;
use Profideo\FormulaInterpretorBundle\DependencyInjection\ProfideoFormulaInterpretorExtension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

abstract class AbstractProfideoFormulaInterpreterExtensionTest extends KernelTestCase
abstract class AbstractProfideoFormulaInterpretorExtensionTest extends KernelTestCase
{
/**
* @var ProfideoFormulaInterpreterExtension
* @var ProfideoFormulaInterpretorExtension
*/
protected $extension;

Expand All @@ -20,7 +20,7 @@ abstract class AbstractProfideoFormulaInterpreterExtensionTest extends KernelTes

protected function setUp()
{
$this->extension = new ProfideoFormulaInterpreterExtension();
$this->extension = new ProfideoFormulaInterpretorExtension();

$this->container = new ContainerBuilder();
$this->container->registerExtension($this->extension);
Expand Down
Loading