File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 1- services :
2- integralSolver : Mathematicator\Integral\IntegralSolver
3- - Mathematicator\Integral\Solver\Solver
1+ extensions :
2+ mathematicator.integralSolver : Mathematicator\Integral\IntegralSolverExtension
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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 ' ;
You can’t perform that action at this time.
0 commit comments