Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
ReflectionTypeHint.php
Содержимое
<?php /** * A class for validating method parameters to allowed types via reflection. * * Purpose * Used as a more convenient multiple assert(), standing after the declaration of the methods. * * Features and advantage * * Very easy to use * * Ability to turn off on the production server * * WARNING * On a production server, it is important to disable assert, that would save server resources. * For this, use the assert_options(ASSERT_ACTIVE, false) or INI setting "assert.active 0". * In this case ReflectionTypeHint::isValid() always returns TRUE! * * Useful links * http://www.ilia.ws/archives/205-Type-hinting-for-PHP-5.3.html * http://php.net/manual/en/language.oop5.typehinting.php * * @example ReflectionTypeHint_example.php * @link http://code.google.com/p/php5-reflection-type-hint/ * @license http://creativecommons.org/licenses/by-sa/3.0/ * @author Nasibullin Rinat * @version 1.1.0 */ class ReflectionTypeHint { protected static $hints = array( 'int' => 'is_int', 'integer' => 'is_int', 'digit' => 'ctype_digit', 'number' => 'ctype_digit', 'float' => 'is_float', 'double' => 'is_float', 'real' => 'is_float', 'numeric' => 'is_numeric', 'str' => 'is_string', 'string' => 'is_string', 'char' => 'is_string', 'bool' => 'is_bool', 'boolean' => 'is_bool', 'null' => 'is_null', 'array' => 'is_array', 'obj' => 'is_object', 'object' => 'is_object', 'res' => 'is_resource', 'resource' => 'is_resource', 'scalar' => 'is_scalar', #integer, float, string or boolean 'cb' => 'is_callable', 'callback' => 'is_callable', ); #calling the methods of this class only statically! private function __construct() {} public static function isValid() { if (! assert_options(ASSERT_ACTIVE)) return true; $bt = self::debugBacktrace(null, 1); extract($bt); //to $file, $line, $function, $class, $object, $type, $args if (! $args) return true; #speed improve $r = new ReflectionMethod($class, $function); $doc = $r->getDocComment(); $cache_id = $class. $type. $function; preg_match_all('~ [\r\n]++ [\x20\t]++ \* [\x20\t]++ @param [\x20\t]++ \K #memory reduce ( [_a-z]++[_a-z\d]*+ (?>[|/,][_a-z]+[_a-z\d]*)*+ ) #1 types [\x20\t]++ &?+\$([_a-z]++[_a-z\d]*+) #2 name ~sixSX', $doc, $params, PREG_SET_ORDER); $parameters = $r->getParameters(); //d($args, $params, $parameters); if (count($parameters) > count($params)) { $message = 'phpDoc %d piece(s) @param description expected in %s%s%s(), %s given, ' . PHP_EOL . 'called in %s on line %d ' . PHP_EOL . 'and defined in %s on line %d'; $message = sprintf($message, count($parameters), $class, $type, $function, count($params), $file, $line, $r->getFileName(), $r->getStartLine()); trigger_error($message, E_USER_NOTICE); } foreach ($args as $i => $value) { if (! isset($params[$i])) return true; if ($parameters[$i]->name !== $params[$i][2]) { $param_num = $i + 1; $message = 'phpDoc @param %d in %s%s%s() must be named as $%s, $%s given, ' . PHP_EOL . 'called in %s on line %d ' . PHP_EOL . 'and defined in %s on line %d'; $message = sprintf($message, $param_num, $class, $type, $function, $parameters[$i]->name, $params[$i][2], $file, $line, $r->getFileName(), $r->getStartLine()); trigger_error($message, E_USER_NOTICE); } $hints = preg_split('~[|/,]~sSX', $params[$i][1]); if (! self::checkValueTypes($hints, $value)) { $param_num = $i + 1; $message = 'Argument %d passed to %s%s%s() must be an %s, %s given, ' . PHP_EOL . 'called in %s on line %d ' . PHP_EOL . 'and defined in %s on line %d'; $message = sprintf($message, $param_num, $class, $type, $function, implode('|', $hints), (is_object($value) ? get_class($value) . ' ' : '') . gettype($value), $file, $line, $r->getFileName(), $r->getStartLine()); trigger_error($message, E_USER_WARNING); return false; } } return true; } /** * Return stacktrace. Correctly work with call_user_func*() * (totally skip them correcting caller references). * If $return_frame is present, return only $return_frame matched caller, not all stacktrace. * * @param string|null $re_ignore example: '~^' . preg_quote(__CLASS__, '~') . '(?![a-zA-Z\d])~sSX' * @param int|null $return_frame * @return array */ public static function debugBacktrace($re_ignore = null, $return_frame = null) { $trace = debug_backtrace(); $a = array(); $frames = 0; for ($i = 0, $n = count($trace); $i < $n; $i++) { $t = $trace[$i]; if (! $t) continue; // Next frame. $next = isset($trace[$i+1])? $trace[$i+1] : null; // Dummy frame before call_user_func*() frames. if (! isset($t['file']) && $next) { $t['over_function'] = $trace[$i+1]['function']; $t = $t + $trace[$i+1]; $trace[$i+1] = null; // skip call_user_func on next iteration } // Skip myself frame. if (++$frames < 2) continue; // 'class' and 'function' field of next frame define where this frame function situated. // Skip frames for functions situated in ignored places. if ($re_ignore && $next) { // Name of function "inside which" frame was generated. $frame_caller = (isset($next['class']) ? $next['class'] . $next['type'] : '') . (isset($next['function']) ? $next['function'] : ''); if (preg_match($re_ignore, $frame_caller)) continue; } // On each iteration we consider ability to add PREVIOUS frame to $a stack. if (count($a) === $return_frame) return $t; $a[] = $t; } return $a; } /** * Checks a value to the allowed types * * @param array $types * @param mixed $value * @return bool */ public static function checkValueTypes(array $types, $value) { foreach ($types as $type) { $type = strtolower($type); if (array_key_exists($type, self::$hints) && call_user_func(self::$hints[$type], $value)) return true; if (is_object($value) && @is_a($value, $type)) return true; if ($type === 'mixed') return true; } return false; } }
/restoran/
Имя
Дата
Размер
..
2026-10-02
css
2013-12-04
disagn
2013-12-04
images
2017-03-03
img
2013-12-06
js
2016-03-24
panoram
2016-01-28
virtualtourdata
2014-11-28
.htaccess
2015-04-04
164 байт
Censure.php
2015-07-23
19 кб.
ChangeLog
2013-12-04
464 байт
Pagination.php
2013-12-04
5 кб.
ReflectionTypeHint.php
2013-12-23
6 кб.
UTF8.php
2013-12-23
145 кб.
_ins_comment.php
2013-12-17
2 кб.
action.php
2014-06-30
2 кб.
application.js
2013-12-04
1 кб.
bridge.swf
2013-12-04
308 байт
bridge11.swf
2013-12-04
286 байт
clip_image001.gif
2013-12-04
258 кб.
comment_form.inc.php
2016-03-28
2 кб.
comments_action.php
2016-03-25
2 кб.
del_comment.php
2016-03-28
569 байт
delete_podpiska.php
2014-03-18
716 байт
edit_comment.php
2023-12-22
1 кб.
edit_comment.php~
2013-12-04
1 кб.
evercookie.js
2013-12-04
25 кб.
food_box.php
2013-12-04
917 байт
gang_1.jpg
2013-12-04
142 кб.
gang_2.jpg
2013-12-04
267 кб.
gang_3.JPG
2013-12-04
151 кб.
index.php
2023-12-22
4 кб.
index.php~
2023-09-13
4 кб.
ins_comment.php
2016-03-29
2 кб.
insert_user_p.php
2014-03-17
1 кб.
menu.inc.php
2016-03-15
9 кб.
menu_grinn_beer.pdf
2013-12-04
3885 кб.
menu_rest_green.pdf
2013-12-04
2004 кб.
modifier.strpos.php
2016-03-29
726 байт
news.php
2023-12-22
11 кб.
news.php~
2017-08-16
11 кб.
novoe_menyu_yaponia.doc
2013-12-04
1944 кб.
novoe_menyu_yaponia.docx
2013-12-04
1905 кб.
pinthouse_accii.jpg
2013-12-04
231 кб.
pinthouse_accii_1.jpg
2013-12-04
245 кб.
preview.php
2015-09-29
7 кб.
resize.php
2013-12-09
1 кб.
rest_bottom.php
2016-03-29
1 кб.
restoran.js
2016-02-15
5 кб.
restoran_comments.php
2016-12-14
1 кб.
restoran_echo.js
2015-05-19
3 кб.
restoran_echo.php
2023-12-22
3 кб.
restoran_echo.php~
2020-07-21
3 кб.
restoran_menu.php
2016-12-15
743 байт
restoran_news.php
2016-12-14
4 кб.
restoran_news_echo.php
2013-12-04
3 кб.
restoran_photos.php
2016-12-15
775 байт
restoran_print.php
2019-02-27
8 кб.
rt_menu.pdf
2013-12-04
4810 кб.
rules.php
2023-12-22
6 кб.
rules.php~
2013-12-04
6 кб.
search_restoran.php
2013-12-04
5 кб.
send_letter_cron.php
2015-01-19
3 кб.
seo_box.php
2013-12-04
586 байт
stylerest.css
2013-12-04
2 кб.
swfobject-2.2.min.js
2013-12-04
10 кб.
t_2.jpg
2013-12-06
2 кб.
test.php
2016-12-05
6 кб.
top_best.php
2013-12-04
1 кб.
top_last.php
2013-12-04
360 байт
top_last_comment.php
2013-12-04
2 кб.
top_news.php
2013-12-06
2 кб.
top_section.php
2016-03-10
7 кб.
update_comment.php
2016-03-25
442 байт
virtualtour.swf
2014-11-28
106 кб.
yesno.php
2013-12-04
1 кб.
zaliv.php
2016-03-23
16 кб.
/restoran
Загрузить файлы
Файл 1
Файл 2
Файл 3