1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys PackBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\PackBundle
;
14 use Rapsys\PackBundle\DependencyInjection\RapsysPackExtension
;
16 use Symfony\Component\DependencyInjection\Extension\ExtensionInterface
;
17 use Symfony\Component\HttpKernel\Bundle\Bundle
;
22 class RapsysPackBundle
extends Bundle
{
26 public function getContainerExtension(): ?ExtensionInterface
{
27 //Return created container extension
28 return $this->createContainerExtension();
34 * @return string The bundle alias
36 public static function getBundleAlias(): string {
38 if ($npos = strrpos(static::class, '\\')) {
42 //With single namespace
43 $nspos = strpos(static::class, '\\');
50 //With trailing bundle
51 if (substr(static::class, -strlen('Bundle'), strlen('Bundle')) === 'Bundle') {
53 $bpos = strlen(static::class) - $npos - strlen('Bundle');
57 $bpos = strlen(static::class) - $npos;
62 //Return prefixed class name
63 return strtolower(substr(static::class, 0, $nspos).'/'.substr(static::class, $npos, $bpos));
67 return strtolower(substr(static::class, $npos, $bpos));
73 * @return string The alias
75 public static function getAlias(): string {
77 if ($npos = strrpos(static::class, '\\')) {
85 //With trailing bundle
86 if (substr(static::class, -strlen('Bundle'), strlen('Bundle')) === 'Bundle') {
88 $bpos = strlen(static::class) - $npos - strlen('Bundle');
92 $bpos = strlen(static::class) - $npos;
95 //Return lowercase bundle alias
96 return strtolower(substr(static::class, $npos, $bpos));
100 * Return bundle version
102 * @return string The bundle version
104 public static function getVersion(): string {