You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
672 B
37 lines
672 B
<?php
|
|
|
|
namespace League\Flysystem\Plugin;
|
|
|
|
class ListPaths extends AbstractPlugin
|
|
{
|
|
/**
|
|
* Get the method name.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getMethod()
|
|
{
|
|
return 'listPaths';
|
|
}
|
|
|
|
/**
|
|
* List all paths.
|
|
*
|
|
* @param string $directory
|
|
* @param bool $recursive
|
|
*
|
|
* @return string[] paths
|
|
*/
|
|
public function handle($directory = '', $recursive = false)
|
|
{
|
|
$result = [];
|
|
$contents = $this->filesystem->listContents($directory, $recursive);
|
|
|
|
foreach ($contents as $object) {
|
|
$result[] = $object['path'];
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|