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