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