Skimia\Foundation
  • Namespace
  • Class
  • Tree
  • Todo
  • Download

Namespaces

  • None
  • PHP
  • Skimia
    • Foundation
      • Annotations
      • Exceptions
        • Fail
      • Providers
        • Traits
      • Support
        • Traits
      • Testing
        • Traits

Classes

  • Skimia\Foundation\Annotations\BaseServiceProvider
  • Skimia\Foundation\Annotations\Scanner
  • Skimia\Foundation\FoundationServiceProvider
  • Skimia\Foundation\Testing\CommandOutput

Interfaces

  • Skimia\Foundation\Testing\TestablePromptCommandInterface

Traits

  • Skimia\Foundation\Providers\Traits\CommandLoaderTrait
  • Skimia\Foundation\Support\Traits\NamespaceClassFinderTrait
  • Skimia\Foundation\Testing\Traits\CommandTrait
  • Skimia\Foundation\Testing\Traits\TestableCommandTrait

Exceptions

  • Exception
  • LogicException
  • Skimia\Foundation\Exceptions\Fail\InvalidSuperclassUsedForTraitException
  • Skimia\Foundation\Exceptions\Fail\IsNotASubclassOfException

Functions

  • ensure_trait_used_in_subclass_of_or_fail
  • is_subclass_of_or_fail
 1 <?php
 2 
 3 namespace Skimia\Foundation\Annotations;
 4 
 5 use Illuminate\Contracts\Foundation\Application;
 6 use Collective\Annotations\AnnotationScanner as BaseScanner;
 7 
 8 abstract class Scanner extends BaseScanner
 9 {
10     /**
11      * @var Application
12      */
13     protected $app;
14 
15     /**
16      * @param Application $app
17      */
18     public function __construct(Application $app, array $scan)
19     {
20         $this->app = $app;
21 
22         //TODO option to set automatically $namespaces & annotationRegistery for simpler & faster config
23         parent::__construct($scan);
24     }
25 
26     /**
27      * Get the path to the scanned annotation file.
28      * @return string
29      */
30     abstract public function getScannedAnnotationPath();
31 
32     public function annotationsAreScanned()
33     {
34         return $this->app['files']->exists($this->getScannedAnnotationPath());
35     }
36 
37     /**
38      * @codeCoverageIgnore
39      */
40     public function loadScannedAnnotations()
41     {
42         if ($this->annotationsAreScanned()) {
43             require $this->getScannedAnnotationPath();
44 
45             return true;
46         }
47 
48         return false;
49     }
50 
51     /**
52      * @codeCoverageIgnore
53      */
54     public function scan()
55     {
56         $filename = $this->getScannedAnnotationPath();
57         file_put_contents(
58             $filename, '<?php '.$this->getAnnotationsDefinitions()
59         );
60         chmod($filename, fileperms($filename) | 128 + 16 + 2);
61     }
62 
63     abstract public function getAnnotationsDefinitions();
64 }
65 
Skimia\Foundation API documentation generated by ApiGen