Пример #1
0
/**
 * 2015-04-05
 * @used-by \Df\Core\Exception_InvalidObjectProperty::__construct()
 * @used-by Df_Core_Validator::check()
 * @param mixed $value
 * @param bool $addQuotes [optional]
 * @return string
 */
function df_debug_type($value, $addQuotes = true)
{
    /** @var string $result */
    if (is_object($value)) {
        $result = 'объект класса ' . get_class($value);
    } else {
        if (is_array($value)) {
            $result = sprintf('массив с %d элементами', count($value));
        } else {
            if (is_null($value)) {
                $result = 'NULL';
            } else {
                $result = sprintf('%s (%s)', df_string($value), gettype($value));
            }
        }
    }
    return !$addQuotes ? $result : df_quote_russian($result);
}
Пример #2
0
 /**
  * 2016-06-30
  * @return Phrase
  */
 private function message()
 {
     /** @var string $namesA */
     $namesA = df_quote_russian(df_html_b(df_currency_name($this->_iso3)));
     /** @var string $namesS */
     $namesS = implode(', ', $namesA);
     /** @var string $whatToEnable */
     /** @var string $whatToSet */
     /** @var string $object */
     list($whatToEnable, $whatToSet, $object) = 1 === count($namesA) ? ["the {$namesS} currency", 'an exchange rate', 'it'] : ["at least one of the {$namesS} currencies", 'exchange rates', 'them'];
     /** @var string $urlEnable */
     $urlEnable = df_url_backend('admin/system_config/edit/section/currency');
     /** @var string $urlRate */
     $urlRate = df_url_backend('admin/system_currency');
     // 2016-11-20
     // @todo It should return a Phrase, not a string.
     return "Please <a href='{$urlEnable}' target='_blank'>enable</a> {$whatToEnable}" . " and <a href='{$urlRate}' target='_blank'>set {$whatToSet}</a> for {$object}.";
 }
Пример #3
0
 /**
  * 2016-08-02
  * @return string
  */
 protected function label()
 {
     if (!isset($this->{__METHOD__})) {
         /** @var string[] $pathA */
         $pathA = explode('/', $this->getPath());
         /** @var Phrase[] $resultA */
         $resultA = [];
         /** @var IConfigElement|ConfigElement|Section|null $e */
         while ($pathA && ($e = df_config_structure()->getElementByPathParts($pathA))) {
             $resultA[] = $e->getLabel();
             array_pop($pathA);
         }
         $resultA[] = df_config_tab_label($e);
         $resultA = array_reverse($resultA);
         $resultA[] = $this->labelShort();
         $this->{__METHOD__} = implode(' → ', df_quote_russian($resultA));
     }
     return $this->{__METHOD__};
 }
Пример #4
0
/**
 * @param string[] ...$args
 * @return string
 */
function df_csv_pretty_quote(...$args)
{
    return df_csv_pretty(df_quote_russian(df_args($args)));
}