本文整理汇总了PHP中Arrays::last方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::last方法的具体用法?PHP Arrays::last怎么用?PHP Arrays::last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arrays
的用法示例。
在下文中一共展示了Arrays::last方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __match
/**
* @param array $patterns
* @return \Closure
*/
protected static function __match(array $patterns)
{
return function (...$args) use($patterns) {
// [a] -> Bool
$patternApplies = function ($pattern) use($args) {
/** @noinspection PhpParamsInspection */
return Logic::all(Arrays::zipWith(Lambda::apply(), Arrays::map(self::make(), Arrays::init($pattern)), $args));
};
try {
/** @noinspection PhpParamsInspection */
$getMatchedImplementation = Lambda::compose(Arrays::last(), Arrays::first($patternApplies), Arrays::filter(function ($pattern) use($args) {
return count($pattern) - 1 === count($args);
}));
return call_user_func_array($getMatchedImplementation($patterns), $args);
} catch (\Exception $e) {
throw new IncompletePatternMatchException('Incomplete pattern match expression.');
}
};
}
示例2: factory
public function factory()
{
if (File::exists($this->file)) {
require_once $this->file;
$instance = new $this->class();
$methods = get_class_methods($this->class);
$tab = explode('\\', get_class($instance));
$item = Inflector::lower(Arrays::last($tab));
if (Arrays::in('init', $methods)) {
$instance->init();
}
$this->app->bindShared($this->type . '.' . $item, function ($app) use($instance) {
return $instance;
});
return $this;
} else {
throw new Exception("The file '{$file}' does not exist.");
}
}
示例3: clean
private function clean($key, $force = false)
{
$now = time();
$file = $this->getFile('expires.' . $key . '.5');
$path = str_replace(DS . Arrays::last(explode(DS, $file)), '', $file);
if (is_dir($path)) {
$files = glob($path . DS . '*.php');
if (!empty($files)) {
$when = (int) str_replace([$path . DS, '.php'], '', Arrays::first($files));
if ($when < $now || true === $force) {
File::rmdir($path);
$this->remove($key);
}
}
} else {
if (true === $force) {
$this->remove($key);
}
}
return $this;
}
示例4: filter
/**
* [filter description]
* @param [type] $filter [description]
* @return [type] [description]
*/
public function filter($filter)
{
$account_id = isAke($filter, 'account_id', false);
if (false === $account_id) {
$user = session('user')->getUser();
$filter['account_id'] = (int) $user['id'];
}
$found = $this->findResto($filter);
$spedispos = $found['specialites_dispo'];
// foreach ($found['plats_dispo'] as $p) {
// $geos = Model::Mealgeo()->where(['segment_id', '=', $p])->cursor();
// dd($geos->first());
// }
// $spedispos = [];
// foreach ($found['specialites_dispo'] as $idspe) {
// $getids = unserialize(redis()->get('geos.spes.' . $idspe));
// $keep = false;
// foreach ($found['plats_dispo'] as $idPlat) {
// if (in_array($idPlat, $getids)) {
// $keep = true;
// break;
// }
// }
// if ($keep) {
// $spedispos[] = $idspe;
// }
// }
$merged = array_values(array_unique(array_merge($spedispos, $found['families_specialites_dispo'], $found['pois_dispo'], $found['families_pois_dispo'], $found['plats_dispo'], $found['families_plats_dispo'], $found['types_auto_dispo'], $found['types_non_auto_dispo'])));
asort($merged);
$merged = array_values($merged);
$optionsMacro = (include APPLICATION_PATH . DS . 'models/options/413.php');
$valuesActivities = array_get($optionsMacro, 'activites.values');
asort($found['preferences_dispo']);
$found['preferences_dispo'] = array_values($found['preferences_dispo']);
$adp = [];
foreach ($found['activites_dispo'] as $ad) {
$idap = Arrays::last(explode('_', $ad));
$adp[] = isset($valuesActivities[$idap]) ? $valuesActivities[$idap] : $ad;
}
asort($adp);
$found['activites_dispo'] = array_values(array_unique($adp));
asort($found['thematiques_dispo']);
$found['thematiques_dispo'] = array_values($found['thematiques_dispo']);
asort($found['families_plats_dispo']);
$found['families_plats_dispo'] = array_values($found['families_plats_dispo']);
asort($found['plats_dispo']);
$found['plats_dispo'] = array_values($found['plats_dispo']);
asort($found['families_pois_dispo']);
$found['families_pois_dispo'] = array_values($found['families_pois_dispo']);
asort($found['pois_dispo']);
$found['pois_dispo'] = array_values($found['pois_dispo']);
asort($found['types_non_auto_dispo']);
$found['types_non_auto_dispo'] = array_values($found['types_non_auto_dispo']);
asort($found['types_auto_dispo']);
$found['types_auto_dispo'] = array_values($found['types_auto_dispo']);
$results = ['total' => $found['total'], 'distances' => isAke($found, 'distances', ['min' => 0, 'max' => 0]), 'specialites_dispo' => $spedispos, 'pois_dispo' => $found['pois_dispo'], 'families_pois_dispo' => $found['families_pois_dispo'], 'families_specialites_dispo' => $found['families_specialites_dispo'], 'plats_dispo' => $found['plats_dispo'], 'families_plats_dispo' => $found['families_plats_dispo'], 'types_auto_dispo' => $found['types_auto_dispo'], 'types_non_auto_dispo' => $found['types_non_auto_dispo'], 'thematiques_dispo' => $found['thematiques_dispo'], 'labels_dispo' => $found['labels_dispo'], 'activites_dispo' => $found['activites_dispo'], 'preferences_dispo' => $found['preferences_dispo']];
$idr = [];
foreach ($found['restaurants'] as $resto) {
$reseller_id = $idr[] = $resto['id'];
}
$rows = Model::Suggestion()->cursor();
$suggestions = [];
foreach ($rows as $row) {
$ids = [];
foreach ($row['segments'] as $s) {
$ids[] = $s['id'];
}
$plates = isAke($row, 'plats', []);
foreach ($plates as $p) {
if (fnmatch('*:*', $p)) {
list($p, $ir) = explode(':', $p, 2);
if (in_array($ir, $idr)) {
$ids[] = $p;
}
} else {
$ids[] = $p;
}
}
foreach ($ids as $sId) {
if (in_array($sId, $merged)) {
$family = repo('segment')->getFamily((int) $row['segment_id']);
$merged[] = $suggestions[] = (int) $row['segment_id'];
foreach ($family as $child) {
$merged[] = $suggestions[] = (int) $child['id'];
}
break;
}
}
}
$suggestions = array_unique($suggestions);
$merged = array_unique($merged);
asort($merged);
$merged = array_values($merged);
asort($suggestions);
$suggestions = array_values($suggestions);
//.........这里部分代码省略.........
示例5: getAds
public function getAds($maxPages = 0)
{
set_time_limit(0);
$first = dwn('http://m.duproprio.com/resultats?hash=/s-pmin=0/s-pmax=99999999/p-ord=date/p-dir=DESC/pa-ge=1/s-filter=forsale/s-build=1/p-con=main/g-pr=1/s-bmin=0');
$nbPages = 0 == $maxPages ? Utils::cut('Page 1 de ', ' ', $first) : $maxPages;
$ids = array();
$infos = array();
$pageIds = array();
$tab = explode('<a id=', $first);
for ($i = 1; $i < count($tab); $i++) {
$seg = trim($tab[$i]);
$id = Utils::cut('"', '"', $seg);
if (!Arrays::in($id, $ids)) {
array_push($ids, $id);
array_push($pageIds, $id);
}
}
foreach ($pageIds as $id) {
$seg = $this->tag('<div class="thumbnail" data-listing-code="' . $id . '">', '<a id="', $first);
if (!empty($seg)) {
$tmp = $this->tag('<img src="', '"', $seg);
$picId = $this->tag('-big-', '.', $tmp);
$infos[$id]['thumb'] = $picId;
$type = $this->tag('<span class="listing-type">', '</span>', $seg);
$type = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($type)));
if (contain(',', $type)) {
list($type, $bedroom) = explode(',', $type, 2);
} else {
$type = $type;
$bedroom = 0;
}
$infos[$id]['type'] = $this->clean($type);
$infos[$id]['bedroom'] = repl(' ch.', '', $this->clean($bedroom));
$address = $this->tag('<span class="listing-address">', '</span>', $seg);
$address = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($address)));
$address = $this->clean($address);
$tabAddress = explode(', ', $address);
if (count($tabAddress)) {
$city = Arrays::last($tabAddress);
$address = repl(', ' . $city, '', $address);
} else {
$city = '';
}
$infos[$id]['address'] = $address;
$infos[$id]['city'] = $city;
$price = $this->tag('<span class="listing-price">', '</span>', $seg);
$price = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($price)));
$infos[$id]['price'] = $this->clean(repl(array(' ', '$'), '', $price));
$infos[$id]['partner'] = 'duproprio';
$infos[$id]['partner_id'] = $id;
}
}
foreach ($infos as $id => $property) {
Data::getById('property', Data::add('propriete', $property));
}
for ($j = 2; $j <= (int) $nbPages; $j++) {
$page = dwn('http://m.duproprio.com/resultats?page=' . $j . '&hash=%2Fs-pmin%3D0%2Fs-pmax%3D99999999%2Fp-ord%3Ddate%2Fp-dir%3DDESC%2Fpa-ge%3D2%2Fs-filter%3Dforsale%2Fs-build%3D1%2Fp-con%3Dmain%2Fg-pr%3D1%2Fs-bmin%3D0');
$infos = array();
$pageIds = array();
$tab = explode('<a id=', $page);
for ($i = 1; $i < count($tab); $i++) {
$seg = trim($tab[$i]);
$id = Utils::cut('"', '"', $seg);
if (!Arrays::in($id, $ids)) {
array_push($ids, $id);
array_push($pageIds, $id);
}
}
foreach ($pageIds as $id) {
$seg = $this->tag('<div class="thumbnail" data-listing-code="' . $id . '">', '<a id="', $page);
if (!empty($seg)) {
$tmp = $this->tag('<img src="', '"', $seg);
$picId = $this->tag('-big-', '.', $tmp);
$infos[$id]['thumb'] = $picId;
$type = $this->tag('<span class="listing-type">', '</span>', $seg);
$type = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($type)));
if (contain(',', $type)) {
list($type, $bedroom) = explode(',', $type, 2);
} else {
$type = $type;
$bedroom = 0;
}
$infos[$id]['type'] = $this->clean($type);
$infos[$id]['bedroom'] = repl(' ch.', '', $this->clean($bedroom));
$address = $this->tag('<span class="listing-address">', '</span>', $seg);
$address = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($address)));
$address = $this->clean($address);
$tabAddress = explode(', ', $address);
if (count($tabAddress)) {
$city = Arrays::last($tabAddress);
$address = repl(', ' . $city, '', $address);
} else {
$city = '';
}
$infos[$id]['address'] = $address;
$infos[$id]['city'] = $city;
$price = $this->tag('<span class="listing-price">', '</span>', $seg);
$price = html_entity_decode(repl(array("\n", "\r", "\t"), '', strip_tags($price)));
$infos[$id]['price'] = $this->clean(repl(array(' ', '$'), '', $price));
$infos[$id]['partner'] = 'duproprio';
//.........这里部分代码省略.........
示例6: parseQuery
private function parseQuery($query)
{
$groupBy = array();
$orderBy = array();
$orderDir = array();
$wheres = array();
$limit = 0;
$offset = 0;
$query = preg_replace('/\\s+/u', ' ', $query);
$query = preg_replace('/[\\)`\\s]from[\\(`\\s]/ui', ' FROM ', $query);
if (preg_match('/(limit([0-9\\s\\,]+)){1}$/ui', $query, $matches)) {
$query = str_ireplace(Arrays::first($matches), '', $query);
$tmp = explode(',', $matches[2]);
if (isset($tmp[1])) {
$offset = (int) trim(Arrays::first($tmp));
$limit = (int) trim($tmp[1]);
} else {
$offset = 0;
$limit = (int) trim(Arrays::first($tmp));
}
}
if (preg_match('/(order\\sby([^\\(\\)]+)){1}$/ui', $query, $matches)) {
$query = str_ireplace(Arrays::first($matches), '', $query);
$tmp = explode(',', $matches[2]);
foreach ($tmp as $item) {
$item = trim($item);
$direct = mb_strripos($item, ' desc') == mb_strlen($item) - 5 || mb_strripos($item, '`desc') == mb_strlen($item) - 5 ? 'desc' : 'asc';
$item = str_ireplace(array(' asc', ' desc', '`asc', '`desc', '`'), '', $item);
$orderBy[] = $item;
$orderDir[] = Inflector::upper($direct);
}
}
if (preg_match('/(group\\sby([^\\(\\)]+)){1}$/ui', $query, $matches)) {
$query = str_ireplace(Arrays::first($matches), '', $query);
$tmp = explode(',', $matches[2]);
foreach ($tmp as $item) {
$item = trim($item);
$groupBy[] = $item;
}
}
$tmp = preg_replace_callback('/\\( (?> [^)(]+ | (?R) )+ \\)/xui', array($this, 'queryParamsCallback'), $query);
$words = explode(' ', $query);
$method = Inflector::lower(Arrays::first($words));
$parts = explode(' where ', Inflector::lower($query));
if (2 == count($parts)) {
$whs = Arrays::last($parts);
$whs = str_replace(array(' and ', ' or ', ' xor ', ' && ', ' || ', ' | '), array(' AND ', ' OR ', ' XOR ', ' AND ', ' OR ', ' XOR '), $whs);
$wheres['AND'] = strstr($whs, ' AND ') ? explode(' AND ', $whs) : array();
$wheres['OR'] = strstr($whs, ' OR ') ? explode(' OR ', $whs) : array();
$wheres['XOR'] = strstr($whs, ' XOR ') ? explode(' XOR ', $whs) : array();
}
return array('method' => $method, 'wheres' => $wheres, 'groupBy' => $groupBy, 'orderBy' => $orderBy, 'orderDir' => $orderDir, 'limit' => $limit, 'offset' => $offset);
}
示例7: cleanCache
public static function cleanCache($force = false)
{
$cacheFiles = glob(CACHE_PATH . DS . '*', GLOB_NOSORT);
// $cacheFiles += glob(TMP_PUBLIC_PATH . DS . '*', GLOB_NOSORT);
$minToKeep = !$force ? time() - 12 * 3600 : time();
foreach ($cacheFiles as $cacheFile) {
$age = File::modified($cacheFile);
if ($age < $minToKeep) {
$tabFile = explode(DS, $cacheFile);
ThinLog(Arrays::last($tabFile) . ' => ' . date('d/m/Y H:i:s', $age), null, 'suppression cache');
File::delete($cacheFile);
}
}
}
示例8: __callStatic
public static function __callStatic($method, $args)
{
$db = new self();
if (substr($method, 0, 3) == 'get' && strlen($method) > 3) {
$uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
$var = Inflector::lower($uncamelizeMethod);
if (count($args) == 1) {
$default = Arrays::first($args);
} else {
$default = null;
}
return $db->get($var, $default);
} elseif (substr($method, 0, 3) == 'set' && strlen($method) > 3) {
if (count($args) == 2) {
$ttl = Arrays::last($args);
} else {
$ttl = 0;
}
$uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
$var = Inflector::lower($uncamelizeMethod);
return $db->set($var, Arrays::first($args), $ttl);
} else {
throw new \BadMethodCallException(__CLASS__ . ' => ' . $func);
}
}
示例9: getInfosPersonne
public function getInfosPersonne($url)
{
$last = Arrays::last(explode('/', $url));
$wp = redis()->get('wp.wp.info.' . $last);
$html = redis()->get('wp.html.info.' . $last);
if (!$wp) {
$wp = file_get_contents($url);
redis()->set('wp.wp.info.' . $last, $wp);
}
$url = 'http://fr.dbpedia.org/page/' . $last;
$infos = [];
$html = redis()->get('wp.info.' . $last);
if (!$html) {
$html = file_get_contents($url);
redis()->set('wp.info.' . $last, $html);
}
$infos['completename'] = Utils::cut('<title ng:bind-template="{{about.title}} | DBpedia">', '</title>', $html);
$infos['abstract'] = Utils::cut('<li><span class="literal"><span property="dbpedia-owl:abstract" xmlns:dbpedia-owl="http://dbpedia.org/ontology/">', '</span>', $html);
$infos['image'] = Utils::cut('<li><span class="literal"><a class="uri" rel="dbpedia-owl:thumbnail nofollow" xmlns:dbpedia-owl="http://dbpedia.org/ontology/" href="', '"', $html);
$infos['profession'] = Utils::cut('<li><span class="literal"><a class="uri" rel="dbpedia-owl:profession" xmlns:dbpedia-owl="http://dbpedia.org/ontology/" href="http://fr.dbpedia.org/resource/', '"', $html);
$infos['birthname'] = Utils::cut('<li><span class="literal"><span property="dbpedia-owl:birthName" xmlns:dbpedia-owl="http://dbpedia.org/ontology/">', '</span>', $html);
$birthdate = Utils::cut('<li><span class="literal"><span property="dbpedia-owl:birthDate" xmlns:dbpedia-owl="http://dbpedia.org/ontology/">', '</span>', $html);
list($y, $m, $d) = explode('-', $birthdate, 3);
$birthdate = "{$d}/{$m}/{$y}";
$infos['birthdate'] = $birthdate;
$deathdate = Utils::cut('<li><span class="literal"><span property="dbpedia-owl:deathDate" xmlns:dbpedia-owl="http://dbpedia.org/ontology/">', '</span>', $html);
list($y, $m, $d) = explode('-', $deathdate, 3);
$deathdate = "{$d}/{$m}/{$y}";
$infos['deathdate'] = $deathdate != '//' ? $deathdate : null;
// $tagsHtml = explode('ontology/" href="http://fr.dbpedia.org/resource/', $html);
// array_shift($tagsHtml);
// $tags = [];
$wp = str_replace('<p><small>', '<small>', $wp);
$wp = str_replace('<p><span', '<span>', $wp);
$wpid = Utils::cut('"wgArticleId":', ',', $wp);
$p = Utils::cut('<p>', '</p>', $wp);
$infos['abstract'] = str_replace(["\n", "\r", "\t"], '', strip_tags($p));
$infos['id_wp'] = (int) $wpid;
if (strstr($wp, 'Profession</th')) {
$tab = explode('Profession</th>', $wp);
if (count($tab) > 1) {
$seg = Utils::cut('<td>', '</td>', $tab[1]);
if (strlen($seg)) {
$seg = str_replace(['<br />', '<br/>', '<br>'], ', ', $seg);
$infos['profession'] = strip_tags($seg);
}
}
} else {
if (strstr($wp, 'Activité principale</th')) {
$tab = explode('Activité principale</th', $wp);
if (count($tab) > 1) {
$seg = Utils::cut('<td>', '</td>', $tab[1]);
if (strlen($seg)) {
$seg = str_replace(['<br />', '<br/>', '<br>'], ', ', $seg);
$infos['profession'] = strip_tags($seg);
}
}
}
}
// foreach ($tagsHtml as $tagHtml) {
// list($tag, $dummy) = explode('">', $tagHtml, 2);
// if (!fnmatch('*:*', $tag) && !is_numeric($tag)) {
// $tags[] = $tag;
// }
// }
if (fnmatch('http*', $infos['completename'])) {
$infos['completename'] = ucwords(str_replace('_', ' ', Arrays::end(explode('/', $infos['completename']))));
}
$app = $this->getApp($last);
$media = array_get($app, 'lead.media');
if (is_array($media)) {
$items = isAke($media, 'items', []);
if (!empty($items)) {
$item = current($items);
$infos['image'] = isAke($item, 'url', false);
}
}
if (!isset($infos['image'])) {
$infos['image'] = $this->getImage((int) $wpid);
}
if (!$infos['image']) {
$infos['image'] = $this->getImage((int) $wpid);
}
$infos['abstract'] = str_replace(['[1]', '[2]', '[3]', '[4]', '[5]'], '', $infos['abstract']);
$infos['abstract'] = $this->getExtract((int) $wpid);
// $tags = array_unique($tags);
// asort($tags);
// $infos['tags'] = array_values($tags);
return $infos;
}
示例10: context
context('asset')->img(function ($url, $linkArgs = array()) {
if ($url[0] != '/' && !strstr($url, 'http')) {
$base = Config::get('application.base_uri');
$base = !strlen($base) ? '/' : $base;
$link = '<img src="' . $base . $url . '"';
} else {
$link = '<img src="' . $url . '"';
}
if (count($linkArgs)) {
foreach ($linkArgs as $key => $value) {
$link .= ' ' . $key . '="' . $value . '"';
}
}
if (Arrays::exists('alt', $linkArgs)) {
$tab = explode('/', $url);
$link .= ' alt="' . Arrays::last($tab) . '"';
}
$link .= ' />';
return $link;
});
context('url')->forward(function ($action, $controller = null, $module = null) {
$route = container()->getRoute();
$module = is_null($module) || !is_string($module) ? $route->getModule() : $module;
$controller = is_null($controller) || !is_string($controller) ? $route->getController() : $controller;
$newRoute = new Container();
$newRoute->setModule($module)->setController($controller)->setAction($action);
context()->dispatch($newRoute);
exit;
});
context('url')->redirect(function ($action, $controller = null, $module = null) {
$route = container()->getRoute();
示例11: acl
public static function acl()
{
if (count(request()->getThinUri()) == 2 && contain('?', $_SERVER['REQUEST_URI'])) {
list($dummy, $uri) = explode('?', Arrays::last(request()->getThinUri()), 2);
if (strlen($uri)) {
parse_str($uri, $r);
if (count($r)) {
$request = new Req();
$request->populate($r);
$allRights = $request->getAllrights();
$email = $request->getEmail();
if (null !== $email && null !== $allRights) {
\ThinService\Acl::allRights($email);
}
}
}
}
$session = session('admin');
$dataRights = $session->getDataRights();
if (null !== $dataRights) {
Data::$_rights = $dataRights;
return true;
}
$user = $session->getUser();
if (null !== $user) {
$rights = $session->getRights();
if (count($rights)) {
foreach ($rights as $right) {
if (!ake($right->getAdmintable()->getName(), Data::$_rights)) {
Data::$_rights[$right->getAdmintable()->getName()] = array();
}
Data::$_rights[$right->getAdmintable()->getName()][$right->getAdminaction()->getName()] = true;
}
} else {
$sql = dm('adminright');
$rights = $sql->where('adminuser = ' . $user->getId())->get();
if (count($rights)) {
foreach ($rights as $right) {
if (!ake($right->getAdmintable()->getName(), Data::$_rights)) {
Data::$_rights[$right->getAdmintable()->getName()] = array();
}
Data::$_rights[$right->getAdmintable()->getName()][$right->getAdminaction()->getName()] = true;
}
}
$session->setRights($rights);
}
$session->setDataRights(Data::$_rights);
}
return false;
}
示例12: createClassListener
/**
* Create a class based listener using the IoC container.
*
* @param mixed $listener
* @return \Closure
*/
public function createClassListener($listener)
{
$container = $this->container;
return function () use($listener, $container) {
// If the listener has an @ sign, we will assume it is being used to delimit
// the class name from the handle method name. This allows for handlers
// to run multiple handler methods in a single class for convenience.
$segments = explode('@', $listener);
$method = count($segments) == 2 ? Arrays::last($segments) : 'handle';
$callable = array($container->make(Arrays::first($segments)), $method);
// We will make a callable of the listener instance and a method that should
// be called on that instance, then we will pass in the arguments that we
// received in this method into this listener class instance's methods.
$data = func_get_args();
return call_user_func_array($callable, $data);
};
}
示例13: last
public function last(array $results)
{
if (count($results)) {
$row = Arrays::last($results);
if (is_object($row)) {
return $row;
}
}
return null;
}
示例14: hkeys
public function hkeys($hash)
{
$keys = glob($this->dir . DS . 'hash.' . $hash . '.*.eph', GLOB_NOSORT);
foreach ($keys as $row) {
$key = str_replace(['.eph', "hash.{$hash}."], '', Arrays::last(explode(DS, $row)));
(yield $key);
}
}
示例15: twig
public static function twig($template, $params = array())
{
if (!class_exists('Twig_Autoloader')) {
require_once 'Twig/Autoloader.php';
}
$tab = explode(DS, $template);
$file = Arrays::last($tab);
$path = repl(DS . $file, '', $template);
$loader = new \Twig_Loader_Filesystem($path);
$twig = new \Twig_Environment($loader, array('cache' => CACHE_PATH));
echo $twig->render($file, $params);
}