本文整理汇总了PHP中Finder::in方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::in方法的具体用法?PHP Finder::in怎么用?PHP Finder::in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Finder
的用法示例。
在下文中一共展示了Finder::in方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collectGarbage
/**
* Randomly runs garbage collection on the image directory
*
* @return bool
*/
public function collectGarbage()
{
if (!mt_rand(1, $this->gcFreq) == 1) {
return false;
}
$this->createFolderIfMissing();
$finder = new Finder();
$criteria = sprintf('<= now - %s minutes', $this->expiration);
$finder->in($this->webPath . '/' . $this->imageFolder)->date($criteria);
foreach ($finder->files() as $file) {
unlink($file->getPathname());
}
return true;
}
示例2: load
public function load($resource, $type = null)
{
if (true === $this->loaded) {
throw new \RuntimeException('Do not add this loader twice');
}
//$modules = $this->doctrine->getRepository('MaximCMSBundle:Module')->findBy(array("activated" => 1));
$collection = new RouteCollection();
/* FIND ROUTING FILES IN BUNDLES AND LOAD THOSE */
$exclude = array("CMSBundle", "InstallBundle", "AdminBundle");
$names = array("routing.yml", "routing_admin.yml");
for ($i = 0; $i < count($names); $i++) {
$finder = new Finder();
$finder->name($names[$i]);
foreach ($finder->in(__DIR__ . "/../../")->exclude($exclude) as $file) {
$locator = new FileLocator(array(substr($file, 0, count($file) - (strlen($names[$i]) + 1))));
$loader = new YamlFileLoader($locator);
$collection->addCollection($loader->load($names[$i]));
}
}
return $collection;
/*if (true === $this->loaded) {
throw new \RuntimeException('Do not add this loader twice');
}
$collection = new RouteCollection();
echo "hi";
// get all Bundles
$bundles = $this->container->getParameter('kernel.bundles');
foreach($bundles as $bundle) {
if(isset($bundle)) {
echo $bundle;
}
}
/*$resource = '@AcmeDemoBundle/Resources/config/import_routing.yml';
$type = 'yaml';
$importedRoutes = $this->import($resource, $type);
$collection->addCollection($importedRoutes);
return $collection; */
}
示例3: delete
/**
* Delete a directory.
*
* @access public
* @return bool
*/
public function delete()
{
$from = $this->getStreamName();
$finder = new Finder();
$finder->in($from)->childFirst();
foreach ($finder as $file) {
$file->open()->delete();
$file->close();
}
if (null === $this->getStreamContext()) {
return @rmdir($from);
}
return @rmdir($from, $this->getStreamContext()->getContext());
}