@@ -30,16 +30,16 @@ |
||
| 30 | 30 | |
| 31 | 31 | abstract class AbstractRequestPlugin extends AbstractPlugin implements CallableRegistryInterface, RequestHandlerInterface |
| 32 | 32 | { |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * @var Target |
| 35 | 35 | */ |
| 36 | - protected $xTarget = null; |
|
| 36 | +protected $xTarget = null; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @inheritDoc |
| 40 | 40 | */ |
| 41 | - public function getTarget(): ?Target |
|
| 42 | - { |
|
| 43 | - return $this->xTarget; |
|
| 44 | - } |
|
| 41 | +public function getTarget(): ?Target |
|
| 42 | +{ |
|
| 43 | +return $this->xTarget; |
|
| 44 | +} |
|
| 45 | 45 | } |
@@ -7,21 +7,21 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | interface RequestHandlerInterface |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * Get the target function or class and method |
| 12 | 12 | * |
| 13 | 13 | * @return Target|null |
| 14 | 14 | */ |
| 15 | - public function getTarget(): ?Target; |
|
| 15 | +public function getTarget(): ?Target; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @param ServerRequestInterface $xRequest |
| 19 | 19 | * |
| 20 | 20 | * @return Target |
| 21 | 21 | */ |
| 22 | - public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 22 | +public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Check if this plugin can process the current request |
| 26 | 26 | * |
| 27 | 27 | * Called by the <Jaxon\Plugin\RequestManager> when a request has been received to determine |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return bool |
| 33 | 33 | */ |
| 34 | - public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 34 | +public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Process the current request |
| 38 | 38 | * |
| 39 | 39 | * Called by the <Jaxon\Plugin\RequestManager> when a request is being processed. |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public function processRequest(): void; |
|
| 45 | +public function processRequest(): void; |
|
| 46 | 46 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | abstract class AbstractAnnotation extends Annotation implements IAnnotationParser |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * Save the annotation value |
| 25 | 25 | * |
| 26 | 26 | * @param Metadata $xMetadata |
@@ -28,5 +28,5 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | - abstract public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void; |
|
| 31 | +abstract public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void; |
|
| 32 | 32 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | function register(): void |
| 31 | 31 | { |
| 32 | 32 | // Do nothing if running in cli. |
| 33 | - if(php_sapi_name() !== 'cli') |
|
| 33 | + if (php_sapi_name() !== 'cli') |
|
| 34 | 34 | { |
| 35 | 35 | _register(); |
| 36 | 36 | }; |
@@ -16,27 +16,27 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function _register(): void |
| 18 | 18 | { |
| 19 | - $di = jaxon()->di(); |
|
| 19 | +$di = jaxon()->di(); |
|
| 20 | 20 | |
| 21 | - $di->set(AnnotationReader::class, function($c) { |
|
| 22 | - $sKey = 'jaxon_annotations_cache_dir'; |
|
| 23 | - $sCacheDir = $c->h($sKey) ? $c->g($sKey) : sys_get_temp_dir(); |
|
| 24 | - $xAnnotationManager = new AnnotationManager(); |
|
| 25 | - $xAnnotationManager->cache = new AnnotationCache($sCacheDir); |
|
| 21 | +$di->set(AnnotationReader::class, function($c) { |
|
| 22 | +$sKey = 'jaxon_annotations_cache_dir'; |
|
| 23 | +$sCacheDir = $c->h($sKey) ? $c->g($sKey) : sys_get_temp_dir(); |
|
| 24 | +$xAnnotationManager = new AnnotationManager(); |
|
| 25 | +$xAnnotationManager->cache = new AnnotationCache($sCacheDir); |
|
| 26 | 26 | |
| 27 | - return new AnnotationReader($xAnnotationManager); |
|
| 28 | - }); |
|
| 27 | +return new AnnotationReader($xAnnotationManager); |
|
| 28 | +}); |
|
| 29 | 29 | |
| 30 | - $di->alias('metadata_reader_annotations', AnnotationReader::class); |
|
| 30 | +$di->alias('metadata_reader_annotations', AnnotationReader::class); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | function register(): void |
| 34 | 34 | { |
| 35 | - // Do nothing if running in cli. |
|
| 36 | - if(php_sapi_name() !== 'cli') |
|
| 37 | - { |
|
| 38 | - _register(); |
|
| 39 | - }; |
|
| 35 | +// Do nothing if running in cli. |
|
| 36 | +if(php_sapi_name() !== 'cli') |
|
| 37 | +{ |
|
| 38 | +_register(); |
|
| 39 | +}; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | register(); |
@@ -10,33 +10,33 @@ |
||
| 10 | 10 | |
| 11 | 11 | final class MinifierTest extends TestCase |
| 12 | 12 | { |
| 13 | - public function testFileNotFound() |
|
| 14 | - { |
|
| 15 | - $sSrcFile = __DIR__ . '/../minifier/nosrc.js'; |
|
| 16 | - $sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 17 | - $xMinifier = new FileMinifier(); |
|
| 18 | - |
|
| 19 | - $this->assertFalse($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public function testFileError() |
|
| 23 | - { |
|
| 24 | - $sSrcFile = __DIR__ . '/../minifier/error.js'; |
|
| 25 | - $sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 26 | - $xMinifier = new FileMinifier(); |
|
| 27 | - |
|
| 28 | - $this->assertFalse($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public function testMinifier() |
|
| 32 | - { |
|
| 33 | - $sSrcFile = __DIR__ . '/../minifier/src.js'; |
|
| 34 | - $sSrcMinFile = __DIR__ . '/../minifier/src.min.js'; |
|
| 35 | - $sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 36 | - $xMinifier = new FileMinifier(); |
|
| 37 | - |
|
| 38 | - $this->assertTrue($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 39 | - $this->assertTrue(file_exists($sDstMinFile)); |
|
| 40 | - $this->assertEquals(filesize($sSrcMinFile), filesize($sDstMinFile)); |
|
| 41 | - } |
|
| 13 | +public function testFileNotFound() |
|
| 14 | +{ |
|
| 15 | +$sSrcFile = __DIR__ . '/../minifier/nosrc.js'; |
|
| 16 | +$sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 17 | +$xMinifier = new FileMinifier(); |
|
| 18 | + |
|
| 19 | +$this->assertFalse($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 20 | +} |
|
| 21 | + |
|
| 22 | +public function testFileError() |
|
| 23 | +{ |
|
| 24 | +$sSrcFile = __DIR__ . '/../minifier/error.js'; |
|
| 25 | +$sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 26 | +$xMinifier = new FileMinifier(); |
|
| 27 | + |
|
| 28 | +$this->assertFalse($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 29 | +} |
|
| 30 | + |
|
| 31 | +public function testMinifier() |
|
| 32 | +{ |
|
| 33 | +$sSrcFile = __DIR__ . '/../minifier/src.js'; |
|
| 34 | +$sSrcMinFile = __DIR__ . '/../minifier/src.min.js'; |
|
| 35 | +$sDstMinFile = __DIR__ . '/../minifier/dst.min.js'; |
|
| 36 | +$xMinifier = new FileMinifier(); |
|
| 37 | + |
|
| 38 | +$this->assertTrue($xMinifier->minify($sSrcFile, $sDstMinFile)); |
|
| 39 | +$this->assertTrue(file_exists($sDstMinFile)); |
|
| 40 | +$this->assertEquals(filesize($sSrcMinFile), filesize($sDstMinFile)); |
|
| 41 | +} |
|
| 42 | 42 | } |