Skip to content

Commit 427c37b

Browse files
committed
Implement NEON dependencies as DIC extension
1 parent 33e5974 commit 427c37b

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

common.neon

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
services:
2-
integralSolver: Mathematicator\Integral\IntegralSolver
3-
- Mathematicator\Integral\Solver\Solver
1+
extensions:
2+
mathematicator.integralSolver: Mathematicator\Integral\IntegralSolverExtension

src/IntegralSolverExtension.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Mathematicator\Integral;
6+
7+
8+
use Mathematicator\Integral\Solver\Solver;
9+
use Nette\DI\CompilerExtension;
10+
11+
final class IntegralSolverExtension extends CompilerExtension
12+
{
13+
public function beforeCompile(): void
14+
{
15+
$builder = $this->getContainerBuilder();
16+
17+
$builder->addDefinition($this->prefix('integralSolver'))
18+
->setFactory(IntegralSolver::class);
19+
20+
$builder->addDefinition($this->prefix('solver'))
21+
->setFactory(Solver::class);
22+
}
23+
}

src/Solver/Solver.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public function solvePart(array $tokens): string
3232

3333

3434
/**
35-
* @param IToken $token
36-
* @return string
3735
* @throws CanNotSolveException
3836
*/
3937
private function solvePrimitiveIntegral(IToken $token): string
@@ -45,7 +43,6 @@ private function solvePrimitiveIntegral(IToken $token): string
4543

4644
return '';
4745
}
48-
4946
if ($token instanceof VariableToken) {
5047
if (($times = (string) $token->getTimes()) === '1') {
5148
return '(x^2)/2';

0 commit comments

Comments
 (0)