Skip to content

Commit cf63ce5

Browse files
committed
Implement NEON dependencies as DIC extension
1 parent 2a6b041 commit cf63ce5

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

common.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
services:
2-
- Mathematicator\MandelbrotSet\MandelbrotSet(%tempDir%/mandelbrot-set)
1+
extensions:
2+
mathematicator.mandelbrotSet: Mathematicator\MandelbrotSet\MandelbrotSetExtension

src/MandelbrotSet.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ final class MandelbrotSet
1919
private $tempDir;
2020

2121

22-
/**
23-
* @param string $tempDir
24-
*/
2522
public function __construct(string $tempDir)
2623
{
2724
ini_set('max_execution_time', '100000');
@@ -32,9 +29,6 @@ public function __construct(string $tempDir)
3229

3330
/**
3431
* Load image from temp by Request and return as base64 image.
35-
*
36-
* @param MandelbrotSetRequest $request
37-
* @return string
3832
*/
3933
public function loadImage(MandelbrotSetRequest $request): string
4034
{
@@ -48,8 +42,6 @@ public function loadImage(MandelbrotSetRequest $request): string
4842

4943
/**
5044
* Process image by request and save to temp file.
51-
*
52-
* @param MandelbrotSetRequest $request
5345
*/
5446
public function generate(MandelbrotSetRequest $request): void
5547
{

src/MandelbrotSetExtension.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Mathematicator\MandelbrotSet;
6+
7+
8+
use Nette\DI\CompilerExtension;
9+
10+
final class MandelbrotSetExtension extends CompilerExtension
11+
{
12+
public function beforeCompile(): void
13+
{
14+
$builder = $this->getContainerBuilder();
15+
16+
$builder->addDefinition($this->prefix('mandelbrotSet'))
17+
->setFactory(MandelbrotSet::class, [
18+
'tempDir' => '%tempDir%/mandelbrot-set', // TODO: Check it
19+
]);
20+
}
21+
}

0 commit comments

Comments
 (0)