]> Raphaël G. Git Repositories - treebundle/blob - RapsysTreeBundle.php
Add element repository class with findOneByUidIdPathAsArray method
[treebundle] / RapsysTreeBundle.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys TreeBundle package.
5 *
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\TreeBundle;
13
14 use Rapsys\PackBundle\DependencyInjection\RapsysPackExtension;
15
16 use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
17 use Symfony\Component\HttpKernel\Bundle\Bundle;
18
19 /**
20 * {@inheritdoc}
21 */
22 class RapsysTreeBundle extends Bundle {
23 /**
24 * {@inheritdoc}
25 */
26 public function getContainerExtension(): ?ExtensionInterface {
27 //Return created container extension
28 return $this->createContainerExtension();
29 }
30
31 /**
32 * Return bundle alias
33 *
34 * @return string The bundle alias
35 */
36 public static function getAlias(): string {
37 //With namespace
38 if ($npos = strrpos(static::class, '\\')) {
39 //Set name pos
40 $npos++;
41 //Without namespace
42 } else {
43 $npos = 0;
44 }
45
46 //With trailing bundle
47 if (substr(static::class, -strlen('Bundle'), strlen('Bundle')) === 'Bundle') {
48 //Set bundle pos
49 $bpos = strlen(static::class) - $npos - strlen('Bundle');
50 //Without bundle
51 } else {
52 //Set bundle pos
53 $bpos = strlen(static::class) - $npos;
54 }
55
56 //Return lowercase bundle alias
57 return strtolower(substr(static::class, $npos, $bpos));
58 }
59
60 /**
61 * Return bundle version
62 *
63 * @return string The bundle version
64 */
65 public static function getVersion(): string {
66 //Return version
67 return '0.0.7';
68 }
69 }