|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
6
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
7
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
8
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
9
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
10
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
11
|
|
|
* THE SOFTWARE. |
|
12
|
|
|
* |
|
13
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
14
|
|
|
* and is licensed under the MIT license. |
|
15
|
|
|
* |
|
16
|
|
|
* Copyright (c) 2018 Yuuki Takezawa |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace Ytake\Lom; |
|
20
|
|
|
|
|
21
|
|
|
use Doctrine\Common\Annotations\AnnotationReader; |
|
22
|
|
|
use Doctrine\Common\Annotations\AnnotationRegistry; |
|
23
|
|
|
use Doctrine\Common\Annotations\IndexedReader; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class AnnotationRegister. |
|
27
|
|
|
* |
|
28
|
|
|
* @author yuuki.takezawa<[email protected]> |
|
29
|
|
|
* @license http://opensource.org/licenses/MIT MIT |
|
30
|
|
|
*/ |
|
31
|
|
|
class AnnotationRegister |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* annotations register. |
|
35
|
|
|
* |
|
36
|
|
|
* @return $this |
|
37
|
|
|
*/ |
|
38
|
|
|
final public function register(): self |
|
39
|
|
|
{ |
|
40
|
|
|
$iterator = new \DirectoryIterator(__DIR__.'/Meta'); |
|
41
|
|
|
foreach ($iterator as $file) { |
|
42
|
|
|
if ($file->isFile()) { |
|
43
|
|
|
$name = $file->getPathInfo()->getPathname().'/'.$file->getFilename(); |
|
44
|
|
|
AnnotationRegistry::registerFile($name); |
|
|
|
|
|
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
return $this; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @throws \Doctrine\Common\Annotations\AnnotationException |
|
53
|
|
|
* |
|
54
|
|
|
* @return IndexedReader |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getReader(): IndexedReader |
|
57
|
|
|
{ |
|
58
|
|
|
return new IndexedReader(new AnnotationReader()); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.