Example #1
0
 /**
  * 2016-08-27
  * @param object $caller
  * @param array(string => mixed) $p
  * @return string
  */
 private static function _sign($caller, array $p)
 {
     /** @var string $type */
     $type = df_trim_text_left(df_caller_f(), 'sign');
     /** @var self $i */
     $i = df_create(df_con($caller, df_cc_class('Signer', $type), df_con($caller, 'Signer')), $p);
     $i->_caller = $caller;
     return $i->sign();
 }
Example #2
0
 /**
  * @used-by \Df\Qa\Message_Failure::traceS()
  * @override
  * @return string
  */
 public function __toString()
 {
     if (!isset($this->{__METHOD__})) {
         /**
          * Метод @see __toString() не имеет права возбуждать исключительных ситуаций.
          * Fatal error: Method __toString() must not throw an exception
          * http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring
          */
         try {
             /** @var string[] $resultA */
             /** @uses param() */
             $resultA = array_filter(array_map([__CLASS__, 'param'], [['File', str_replace(DIRECTORY_SEPARATOR, '/', df_trim_text_left($this->filePath(), BP . DIRECTORY_SEPARATOR))], ['Line', $this->line()], ['Caller', !$this->_next ? '' : $this->_next->methodName()], ['Callee', $this->methodName()]]));
             if ($this[self::$P__SHOW_CONTEXT] && $this->context()) {
                 $resultA[] = self::param(['Context', "\n" . $this->context()]);
             }
             $this->{__METHOD__} = df_cc_n($resultA);
         } catch (\Exception $e) {
             df_log(df_ets($e));
             $this->{__METHOD__} = df_ets($e);
         }
     }
     return $this->{__METHOD__};
 }
Example #3
0
 /**
  * 2016-07-10
  * @param string $globalId
  * @return string
  */
 public static function transactionIdG2L($globalId)
 {
     return df_trim_text_left($globalId, self::codeS() . '-');
 }
Example #4
0
/**
 * 2016-08-25
 * Без префикса «dfe_»
 * @uses \Df\Payment\Method::codeS()
 * @param string|object $class
 * @return string
 */
function dfp_method_code_short($class)
{
    return df_trim_text_left(dfp_method_code($class), 'dfe_');
}
Example #5
0
/**
 * Отсекает у строки $haystack подстроку $needle,
 * если она встречается в начале или в конце строки $haystack
 * 2016-10-28
 * Добавил поддержку нескольких $needle.
 * @param string $haystack
 * @param string|string[] $needle
 * @return string
 */
function df_trim_text($haystack, $needle)
{
    return df_trim_text_left(df_trim_text_right($haystack, $needle), $needle);
}
Example #6
0
/**
 * 2015-12-06
 * Левый «/» мы убираем.
 * Результат вызова @uses \Magento\Framework\Filesystem\Directory\Read::getAbsolutePath()
 * завершается на «/»
 * @param string $path
 * @param string $base [optional]
 * @return string
 */
function df_path_relative($path, $base = BP)
{
    return df_trim_ds_left(df_trim_text_left(df_path_n($path), df_trim_ds_left(df_fs_r($base)->getAbsolutePath())));
}