__construct()
_init()
add_path()
clear_flash()
flash()
forge()
instance()
list_files()
locate()
paths()
prep_path()
prep_paths()
read_cache()
remove_path()
search()
write_cache()
add_to_cache()
cache()
from_cache()
$cache_dir
$cache_lifetime
$cache_valid
$cached_paths
$flash_paths
$instance
$paths
The Finder class allows for searching through a search path for a given file, as well as loading a given file.
| package | Fuel |
|---|---|
| subpackage | Core |
__construct(array $paths)
arrayThe paths to initialize with
_init()
add_path(string | array $paths, int $pos) : \Fuel\Core\Finder
Possible positions: (null): Append to the end of the search path (-1): Prepend to the start of the search path (index): The path will get inserted AFTER the given index
| fluent | This method is part of a fluent interface and will return the same instance |
|---|
stringarrayThe path to add
intThe position to add the path
\OutOfBoundsException |
|---|
clear_flash() : \Fuel\Core\Finder
| fluent | This method is part of a fluent interface and will return the same instance |
|---|
flash(array $paths) : \Fuel\Core\Finder
| fluent | This method is part of a fluent interface and will return the same instance |
|---|
arrayThe paths to add
list_files(string $directory, string $filter) : array
the cascading file system). This is useful for things like finding all the config files in all the search paths.
stringThe directory to look in
stringThe file filter
arraythe array of fileslocate(string $dir, string $file, string $ext, bool $multiple, bool $cache) : mixed
stringDirectory to look in
stringFile to find
stringFile extension
boolWhether to find multiple files
boolWhether to cache this path or not
mixedPath, or paths, or falsepaths() : array
..including flash paths.
arraySearch pathsprep_path(string $path) : string
It ensures that the path has a trailing Directory Separator.
stringThe path to prepare
stringprep_paths(array $paths) : array
arrayThe paths to prepare
arrayread_cache(string $cache_id) : void
stringCache id to read
remove_path(string $path) : \Fuel\Core\Finder
| fluent | This method is part of a fluent interface and will return the same instance |
|---|
stringPath to remove
search(string $dir, string $file, string $ext, bool $multiple, bool $cache) : mixed
stringDirectory to look in
stringFile to find
stringFile extension
boolWhether to find multiple files
boolWhether to cache this path or not
mixedPath, or paths, or falsewrite_cache(string $cache_id) : void
stringCache id to read
add_to_cache(string $cache_id, $path) : string | bool
stringCache id to load
stringboolPath or false if not foundcache(string $name, array $data, int $lifetime) : bool | null
It is used for things like path caching.
This method is from KohanaPHP's Kohana class.
stringthe cache name
arraythe data to cache (if non given it returns)
intthe number of seconds for the cache too live
boolnull
from_cache(string $cache_id) : string | bool
stringCache id to load
stringboolPath or false if not found$cache_dir : string
$cache_lifetime : int
$cache_valid : bool
$cached_paths : array
$flash_paths : array
$paths : array