Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
62.50% covered (warning)
62.50%
5 / 8
CRAP
75.00% covered (success)
75.00%
18 / 24
NamingStrategyRegistry
0.00% covered (danger)
0.00%
0 / 1
62.50% covered (warning)
62.50%
5 / 8
14.25
75.00% covered (success)
75.00%
18 / 24
 getClassNamingStrategy
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 setClassNamingStrategy
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getAttributeNamingStrategy
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 setAttributeNamingStrategy
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getTableNamingStrategy
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 setTableNamingStrategy
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 getColumnNamingStrategy
0.00% covered (danger)
0.00%
0 / 1
2.50
50.00% covered (warning)
50.00%
2 / 4
 setColumnNamingStrategy
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
namespace Siesta\NamingStrategy;
use Siesta\Config\MainGeneratorConfig;
use Siesta\Config\ReverseConfig;
class NamingStrategyRegistry
{
    /**
     * @var NamingStrategy
     */
    protected static $attributeNamingStrategy;
    /**
     * @var NamingStrategy
     */
    protected static $columnNamingStrategy;
    /**
     * @var NamingStrategy
     */
    protected static $tableNamingStrategy;
    /**
     * @var NamingStrategy
     */
    protected static $classNamingStrategy;
    /**
     * @return NamingStrategy
     */
    public static function getClassNamingStrategy(): NamingStrategy
    {
        if (self::$classNamingStrategy === null) {
            $classNamingDefault = ReverseConfig::OPTION_CLASS_NAMING_DEFAULT;
            self::$classNamingStrategy = new $classNamingDefault;
        }
        return self::$classNamingStrategy;
    }
    /**
     * @param NamingStrategy $classNamingStrategy
     */
    public static function setClassNamingStrategy(NamingStrategy $classNamingStrategy)
    {
        self::$classNamingStrategy = $classNamingStrategy;
    }
    /**
     * @return NamingStrategy
     */
    public static function getAttributeNamingStrategy(): NamingStrategy
    {
        if (self::$attributeNamingStrategy === null) {
            $attributeNamingDefault = ReverseConfig::OPTION_ATTRIBUTE_NAMING_DEFAULT;
            self::$attributeNamingStrategy = new $attributeNamingDefault;
        }
        return self::$attributeNamingStrategy;
    }
    /**
     * @param NamingStrategy $attributeNamingStrategy
     */
    public static function setAttributeNamingStrategy(NamingStrategy $attributeNamingStrategy)
    {
        self::$attributeNamingStrategy = $attributeNamingStrategy;
    }
    /**
     * @return NamingStrategy
     */
    public static function getTableNamingStrategy(): NamingStrategy
    {
        if (self::$tableNamingStrategy === null) {
            $strategy = MainGeneratorConfig::OPTION_TABLE_NAMING_STRATEGY_DEFAULT;
            self::$tableNamingStrategy = new $strategy;
        }
        return self::$tableNamingStrategy;
    }
    /**
     * @param NamingStrategy $tableNamingStrategy
     */
    public static function setTableNamingStrategy(NamingStrategy $tableNamingStrategy)
    {
        self::$tableNamingStrategy = $tableNamingStrategy;
    }
    /**
     * @return NamingStrategy
     */
    public static function getColumnNamingStrategy(): NamingStrategy
    {
        if (self::$columnNamingStrategy === null) {
            $strategy = MainGeneratorConfig::OPTION_COLUMN_NAMING_STRATEGY_DEFAULT;
            self::$columnNamingStrategy = new $strategy;
        }
        return self::$columnNamingStrategy;
    }
    /**
     * @param NamingStrategy $columnNamingStrategy
     */
    public static function setColumnNamingStrategy(NamingStrategy $columnNamingStrategy)
    {
        self::$columnNamingStrategy = $columnNamingStrategy;
    }
}