| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of the Assets package. |
| 5 |
* |
| 6 |
* (c) Inpsyde GmbH |
| 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 |
declare(strict_types=1); |
| 13 |
|
| 14 |
namespace Inpsyde\Assets; |
| 15 |
|
| 16 |
trait ConfigureAutodiscoverVersionTrait |
| 17 |
{ |
| 18 |
/** |
| 19 |
* Set to "false" and the version will not automatically discovered. |
| 20 |
* |
| 21 |
* @see self::disableAutodiscoverVersion() |
| 22 |
* @see self::enableAutodiscoverVersion() |
| 23 |
* |
| 24 |
* @var bool |
| 25 |
*/ |
| 26 |
protected $autodiscoverVersion = true; |
| 27 |
|
| 28 |
/** |
| 29 |
* Enable automatic discovering of the version if no version is set. |
| 30 |
* |
| 31 |
* @return static |
| 32 |
* |
| 33 |
* phpcs:disable Inpsyde.CodeQuality.ReturnTypeDeclaration |
| 34 |
*/ |
| 35 |
public function enableAutodiscoverVersion() |
| 36 |
{ |
| 37 |
// phpcs:enable Inpsyde.CodeQuality.ReturnTypeDeclaration |
| 38 |
|
| 39 |
$this->autodiscoverVersion = true; |
| 40 |
|
| 41 |
return $this; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Disable automatic discovering of the version if no version is set. |
| 46 |
* |
| 47 |
* @return static |
| 48 |
* |
| 49 |
* phpcs:disable Inpsyde.CodeQuality.ReturnTypeDeclaration |
| 50 |
*/ |
| 51 |
public function disableAutodiscoverVersion() |
| 52 |
{ |
| 53 |
// phpcs:enable Inpsyde.CodeQuality.ReturnTypeDeclaration |
| 54 |
|
| 55 |
$this->autodiscoverVersion = false; |
| 56 |
|
| 57 |
return $this; |
| 58 |
} |
| 59 |
} |
| 60 |
|