Возвращает значения в enum'е значения которых разрешены
@return string[] Массив разрешённых значений
508682
public static function getEnabledValues()
    {
        $result = array();
        foreach (static::$validValues as $key => $enabled) {
            if ($enabled) {
                $result[] = $key;
            }
        }
        return $result;
    }
271560
private function getEnum()
     {

        $enumResult = $this->db->query(
            new Raw( <<<SQL
                SELECT
                    t.typname as name,
                    n.nspname as schema,
                    array_agg( e.enumlabel ORDER BY e.enumsortorder ) as labels
                FROM
                    pg_enum e
                INNER JOIN
                    pg_type t ON e.enumtypid = t.oid
                INNER JOIN
                    pg_namespace n ON t.typnamespace = n.oid
                WHERE
                    n.nspname = ANY( current_schemas(false) )
                GROUP BY
                    t.typname, t.oid, n.nspname
                ORDER BY
                    schema, t.typname ASC
SQL
             )
        );

        $output = [];
        foreach( $enumResult->fetch(Result::FLATTEN_PREVENT | Result::TYPE_DETECT) as $data ) {
            $output[$data['name']] = $data['labels'];
        }

        return new Enum($output);

     }
664099
public static function getTypes() {
        return array(
            self::TYPE_CHARACTER,
            self::TYPE_LOGICAL,
            self::TYPE_DATE ,
            self::TYPE_NUMERIC,
            self::TYPE_MEMO,
        );
    }
672176
public function getSettings(): array
    {
        $result = [];
        $settings = static::find()->select(['type', 'section', 'key', 'value'])->active()->asArray()->all();

        foreach ($settings as $setting) {
            $section = $setting['section'];
            $key = $setting['key'];
            $settingOptions = ['type' => $setting['type'], 'value' => $setting['value']];

            if (isset($result[$section][$key])) {
                ArrayHelper::merge($result[$section][$key], $settingOptions);
            } else {
                $result[$section][$key] = $settingOptions;
            }
        }

        return $result;
    }
84262
public function getTypes()
    {
        $oDb     = Factory::service('Database');
        $oResult = $oDb->query('SHOW COLUMNS FROM `' . $this->table . '` LIKE "type"')->row();
        $sTypes  = $oResult->Type;
        $sTypes  = preg_replace('/enum\((.*)\)/', '$1', $sTypes);
        $sTypes  = str_replace("'", '', $sTypes);
        $aTypes  = explode(',', $sTypes);

        $aOut = [];

        foreach ($aTypes as $sType) {
            $aOut[$sType] = ucwords(strtolower($sType));
        }

        return $aOut;
    }
78271
public function toArray()
    {
        return [$this->currency => [
            'name'                => $this->name,
            'code'                => $this->code,
            'precision'           => $this->precision,
            'subunit'             => $this->subunit,
            'symbol'              => $this->symbol,
            'symbol_first'        => $this->symbolFirst,
            'decimal_mark'        => $this->decimalMark,
            'thousands_separator' => $this->thousandsSeparator,
            'prefix'              => $this->getPrefix(),
            'suffix'              => $this->getSuffix(),
        ]];
    }
1022325
public static function getAllValues(): array
	{
		$enumerables = self::getCache();
		$result = [];

		foreach ($enumerables as $enumerable => $value) {
			$result[] = $value;
		}

		return $result;
	}
44459
public function actionDataMenu()
    {
        return [
            'items' => ArrayHelper::typeCast(MenuHelper::getItems()),
            'drafts' => ArrayHelper::typeCast(MenuHelper::getDrafts()),
            'containers' => ArrayHelper::typeCast(MenuHelper::getContainers()),
            'hiddenCats' => ArrayHelper::typeCast(Yii::$app->adminuser->identity->setting->get("togglecat", [])),
        ];
    }
399197
protected function getClassNameOptions()
    {
        $hidden  = [];
        $classes = [];
        
        foreach ($this->dbObject('ClassName')->enumValues() as $class) {
            
            if ($class == self::class || !in_array($class, ClassInfo::subclassesFor($this))) {
                continue;
            }
            
            if ($hide = Config::inst()->get($class, 'hide_ancestor')) {
                $hidden[$hide] = true;
            }
            
            if (!$class::singleton()->canCreate()) {
                continue;
            }
            
            $classes[$class] = $class::singleton()->i18n_singular_name();
            
        }
        
        foreach ($hidden as $class => $hide) {
            unset($classes[$class]);
        }
        
        return $classes;
    }
109196
public function getOptionNames()
    {
        $names = [];
        foreach ($this->options as $option) {
            $names[] = $option->getLongName();
            $names[] = $option->getShortName();
        }

        return $names;
    }
609829
public static function getAll()
    {
        return [
            self::ALICEBLUE => 'aliceblue',
            self::ANTIQUEWHITE => 'antiquewhite',
            self::AQUA => 'aqua',
            self::AQUAMARINE => 'aquamarine',
            self::AZURE => 'azure',
            self::BEIGE => 'beige',
            self::BISQUE => 'bisque',
            self::BLACK => 'black',
            self::BLANCHEDALMOND => 'blanchedalmond',
            self::BLUE => 'blue',
            self::BLUEVIOLET => 'blueviolet',
            self::BROWN => 'brown',
            self::BURLYWOOD => 'burlywood',
            self::CADETBLUE => 'cadetblue',
            self::CHARTREUSE => 'chartreuse',
            self::CHOCOLATE => 'chocolate',
            self::CORAL => 'coral',
            self::CORNFLOWERBLUE => 'cornflowerblue',
            self::CORNSILK => 'cornsilk',
            self::CRIMSON => 'crimson',
            self::CYAN => 'cyan',
            self::DARKBLUE => 'darkblue',
            self::DARKCYAN => 'darkcyan',
            self::DARKGOLDENROD => 'darkgoldenrod',
            self::DARKGRAY => 'darkgray',
            self::DARKGREEN => 'darkgreen',
            self::DARKKHAKI => 'darkkhaki',
            self::DARKMAGENTA => 'darkmagenta',
            self::DARKOLIVEGREEN => 'darkolivegreen',
            self::DARKORANGE => 'darkorange',
            self::DARKORCHID => 'darkorchid',
            self::DARKRED => 'darkred',
            self::DARKSALMON => 'darksalmon',
            self::DARKSEAGREEN => 'darkseagreen',
            self::DARKSLATEBLUE => 'darkslateblue',
            self::DARKSLATEGRAY => 'darkslategray',
            self::DARKTURQUOISE => 'darkturquoise',
            self::DARKVIOLET => 'darkviolet',
            self::DEEPPINK => 'deeppink',
            self::DEEPSKYBLUE => 'deepskyblue',
            self::DIMGRAY => 'dimgray',
            self::DODGERBLUE => 'dodgerblue',
            self::FIREBRICK => 'firebrick',
            self::FLORALWHITE => 'floralwhite',
            self::FORESTGREEN => 'forestgreen',
            self::FUCHSIA => 'fuchsia',
            self::GAINSBORO => 'gainsboro',
            self::GHOSTWHITE => 'ghostwhite',
            self::GOLD => 'gold',
            self::GOLDENROD => 'goldenrod',
            self::GRAY => 'gray',
            self::GREEN => 'green',
            self::GREENYELLOW => 'greenyellow',
            self::HONEYDEW => 'honeydew',
            self::HOTPINK => 'hotpink',
            self::INDIANRED => 'indianred',
            self::INDIGO => 'indigo',
            self::IVORY => 'ivory',
            self::KHAKI => 'khaki',
            self::LAVENDER => 'lavender',
            self::LAVENDERBLUSH => 'lavenderblush',
            self::LAWNGREEN => 'lawngreen',
            self::LEMONCHIFFON => 'lemonchiffon',
            self::LIGHTBLUE => 'lightblue',
            self::LIGHTCORAL => 'lightcoral',
            self::LIGHTCYAN => 'lightcyan',
            self::LIGHTGOLDENRODYELLOW => 'lightgoldenrodyellow',
            self::LIGHTGRAY => 'lightgray',
            self::LIGHTGREEN => 'lightgreen',
            self::LIGHTPINK => 'lightpink',
            self::LIGHTSALMON => 'lightsalmon',
            self::LIGHTSEAGREEN => 'lightseagreen',
            self::LIGHTSKYBLUE => 'lightskyblue',
            self::LIGHTSLATEGRAY => 'lightslategray',
            self::LIGHTSTEELBLUE => 'lightsteelblue',
            self::LIGHTYELLOW => 'lightyellow',
            self::LIME => 'lime',
            self::LIMEGREEN => 'limegreen',
            self::LINEN => 'linen',
            self::MAGENTA => 'magenta',
            self::MAROON => 'maroon',
            self::MEDIUMAQUAMARINE => 'mediumaquamarine',
            self::MEDIUMBLUE => 'mediumblue',
            self::MEDIUMORCHID => 'mediumorchid',
            self::MEDIUMPURPLE => 'mediumpurple',
            self::MEDIUMSEAGREEN => 'mediumseagreen',
            self::MEDIUMSLATEBLUE => 'mediumslateblue',
            self::MEDIUMSPRINGGREEN => 'mediumspringgreen',
            self::MEDIUMTURQUOISE => 'mediumturquoise',
            self::MEDIUMVIOLETRED => 'mediumvioletred',
            self::MIDNIGHTBLUE => 'midnightblue',
            self::MINTCREAM => 'mintcream',
            self::MISTYROSE => 'mistyrose',
            self::MOCCASIN => 'moccasin',
            self::NAVAJOWHITE => 'navajowhite',
            self::NAVY => 'navy',
            self::OLDLACE => 'oldlace',
            self::OLIVE => 'olive',
            self::OLIVEDRAB => 'olivedrab',
            self::ORANGE => 'orange',
            self::ORANGERED => 'orangered',
            self::ORCHID => 'orchid',
            self::PALEGOLDENROD => 'palegoldenrod',
            self::PALEGREEN => 'palegreen',
            self::PALETURQUOISE => 'paleturquoise',
            self::PALEVIOLETRED => 'palevioletred',
            self::PAPAYAWHIP => 'papayawhip',
            self::PEACHPUFF => 'peachpuff',
            self::PERU => 'peru',
            self::PINK => 'pink',
            self::PLUM => 'plum',
            self::POWDERBLUE => 'powderblue',
            self::PURPLE => 'purple',
            self::REBECCAPURPLE => 'rebeccapurple',
            self::RED => 'red',
            self::ROSYBROWN => 'rosybrown',
            self::ROYALBLUE => 'royalblue',
            self::SADDLEBROWN => 'saddlebrown',
            self::SALMON => 'salmon',
            self::SANDYBROWN => 'sandybrown',
            self::SEAGREEN => 'seagreen',
            self::SEASHELL => 'seashell',
            self::SIENNA => 'sienna',
            self::SILVER => 'silver',
            self::SKYBLUE => 'skyblue',
            self::SLATEBLUE => 'slateblue',
            self::SLATEGRAY => 'slategray',
            self::SNOW => 'snow',
            self::SPRINGGREEN => 'springgreen',
            self::STEELBLUE => 'steelblue',
            self::TAN => 'tan',
            self::TEAL => 'teal',
            self::THISTLE => 'thistle',
            self::TOMATO => 'tomato',
            self::TURQUOISE => 'turquoise',
            self::VIOLET => 'violet',
            self::WHEAT => 'wheat',
            self::WHITE => 'white',
            self::WHITESMOKE => 'whitesmoke',
            self::YELLOW => 'yellow',
            self::YELLOWGREEN => 'yellowgreen',
        ];
    }
961568
public static function enumTypes() {
        return [
            ButtonInterface::BUTTON_TYPE_DANGER,
            ButtonInterface::BUTTON_TYPE_DEFAULT,
            ButtonInterface::BUTTON_TYPE_INFO,
            ButtonInterface::BUTTON_TYPE_LINK,
            ButtonInterface::BUTTON_TYPE_PRIMARY,
            ButtonInterface::BUTTON_TYPE_SUCCESS,
            ButtonInterface::BUTTON_TYPE_WARNING,
        ];
    }
600566
public function choices()
    {
        if (empty($this->choices)) {
            $locales = $this->translator()->locales();
            if ($locales) {
                $selected = (array)$this->val();
                $choices  = [];

                foreach ($locales as $langCode => $localeStruct) {
                    /**
                     * @see \Charcoal\Admin\Widget\FormSidebarWidget::languages()
                     * @see \Charcoal\Admin\Widget\FormGroupWidget::languages()
                     */
                    if (isset($localeStruct['name'])) {
                        $label = $this->translator()->translation($localeStruct['name']);
                    } else {
                        $trans = 'locale.'.$langCode;
                        if ($trans === $this->translator()->translate($trans)) {
                            $label = strtoupper($langCode);
                        } else {
                            $label = $this->translator()->translation($trans);
                        }
                    }

                    $choices[$langCode] = [
                        'label'    => $label,
                        'selected' => in_array($langCode, $selected),
                        'value'    => $langCode
                    ];
                }

                $this->choices = $choices;
            }
        }

        return $this->choices;
    }
80824
protected function getStatusValues()
    {
        $values = array();
        foreach ($this->dbObject('Status')->enumValues() as $value) {
            $values[$value] = _t('SilverStripe\Omnipay\Model\Payment.STATUS_' . strtoupper($value), $value);
        }
        return $values;
    }
1181161
protected function getOptions()
    {
        return [
            ['namespace', 'ns', InputOption::VALUE_OPTIONAL, 'Namespace for entity and its closure.'],
            ['entity', 'e', InputOption::VALUE_REQUIRED, 'Entity class name.'],
            ['entity-table', 'et', InputOption::VALUE_OPTIONAL, 'Entity table name.'],
            ['closure', 'c', InputOption::VALUE_OPTIONAL, 'Closure class name'],
            ['closure-table', 'ct', InputOption::VALUE_OPTIONAL, 'Closure table name.'],
            ['models-path', 'mdl', InputOption::VALUE_OPTIONAL, 'Models path.'],
            ['migrations-path', 'mgr', InputOption::VALUE_OPTIONAL, 'Migrations path.'],
            ['use-innodb', 'i', InputOption::VALUE_OPTIONAL, 'Use InnoDB tables.'],
        ];
    }
670742
protected function _typesNice() {
        $enumValues = singleton("SilverStripe\SiteConfig\SiteConfig")->dbObject("Type")->enumValues();

        $values = array();

        foreach($enumValues as $enumValue) {
            $values[$enumValue] = _t("SiteInfo.TYPE" . strtoupper($enumValue), $enumValue);
        }

        return $values;
    }
706283
public function enum($type = '')
    {
        $result = array();
        $legacyKernel = Eresus_Kernel::app()->getLegacyKernel();
        $dir = $legacyKernel->froot . 'templates/';
        if ($type)
        {
            $dir .= "$type/";
        }
        $list = glob("$dir*.html");
        if ($list)
        {
            foreach ($list as $filename)
            {
                $file = file_get_contents($filename);
                $title = trim(mb_substr($file, 0, mb_strpos($file, "\n")));
                if (preg_match('/^\{\*(.+)\*\}/', $title, $title))
                {
                    $title = trim($title[1]);
                }
                else
                {
                    $title = 'n/a';
                }
                $result[basename($filename, '.html')] = $title;
            }
        }
        return $result;
    }