Exemplo n.º 1
0
 /**
  * Find one file and return.
  *
  * @param  mixed   $condition       Finding condition, that can be a string, a regex or a callback function.
  *                                  Callback example:
  *                                  <code>
  *                                  function($current, $key, $iterator)
  *                                  {
  *                                  return @preg_match('^Foo', $current->getFilename())  && ! $iterator->isDot();
  *                                  }
  *                                  </code>
  * @param  boolean $recursive       True to resursive.
  *
  * @return  \SplFileInfo  Finded file info object.
  *
  * @since  2.0
  */
 public function findOne($condition, $recursive = false)
 {
     return Filesystem::findOne((string) $this, $condition, $recursive);
 }
Exemplo n.º 2
0
 /**
  * Method to test findOne().
  *
  * @return void
  *
  * @covers Windwalker\Filesystem\Filesystem::findOne
  */
 public function testFindOne()
 {
     // String condition
     $file = Filesystem::findOne(static::$dest, 'file', true);
     $files = Filesystem::find(static::$dest, 'file', true, true);
     $this->assertEquals(Path::clean((string) $files[0]), Path::clean((string) $file));
 }