]> Raphaël G. Git Repositories - airbundle/blob - RapsysAirBundle.php
Rename rapsysair:calendar2 command to rapsysair:calendar
[airbundle] / RapsysAirBundle.php
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Rapsys AirBundle 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\AirBundle;
13
14 use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
15 use Symfony\Component\HttpKernel\Bundle\Bundle;
16
17 /**
18 * {@inheritdoc}
19 */
20 class RapsysAirBundle extends Bundle {
21 /**
22 * {@inheritdoc}
23 */
24 public function getContainerExtension(): ?ExtensionInterface {
25 //Return created container extension
26 return $this->createContainerExtension();
27 }
28
29 /**
30 * Return bundle alias
31 *
32 * @return string The bundle alias
33 */
34 public static function getAlias(): string {
35 //With namespace
36 if ($npos = strrpos(static::class, '\\')) {
37 //Set name pos
38 $npos++;
39 //Without namespace
40 } else {
41 $npos = 0;
42 }
43
44 //With trailing bundle
45 if (substr(static::class, -strlen('Bundle'), strlen('Bundle')) === 'Bundle') {
46 //Set bundle pos
47 $bpos = strlen(static::class) - $npos - strlen('Bundle');
48 //Without bundle
49 } else {
50 //Set bundle pos
51 $bpos = strlen(static::class) - $npos;
52 }
53
54 //Return lowercase bundle alias
55 return strtolower(substr(static::class, $npos, $bpos));
56 }
57
58 /**
59 * Return bundle version
60 *
61 * @return string The bundle version
62 */
63 public static function getVersion(): string {
64 //Return version
65 return '0.5.0';
66 }
67 }