search for files which contains given string in their name

@param string $word

@return File[]
@throws DirectoryNotFoundException
347335
public function search(string $word) {
		$index   = $this->addFilter(new Search($word));
		$content = $this->listContents(true);
		$this->removeFilter($index);

		return $content;
	}
736039
protected function find_attachment($file)
	{
		foreach($this->get_config('attach_paths') as $path)
		{
			if(is_file($path.$file))
			{
				return $path.$file;
			}
		}

		// No file found?
		throw new \AttachmentNotFoundException('Email attachment not found: '.$file);
	}
909499
protected function pathMatchesSearch($path, $words)
    {
        $path = Str::lower($path);

        foreach ($words as $word) {
            $word = trim($word);
            if (!strlen($word)) {
                continue;
            }

            if (!Str::contains($path, $word)) {
                return false;
            }
        }

        return true;
    }
501152
public function fileGet($file)
    {
        if (($r = @file_get_contents($this->alias->resolve($file))) === false) {
            throw new FileNotFoundException($file);
        }

        return $r;
    }
763195
private function searchPrefixes($path)
    {
        $dirname = dirname($path);
        $directoryParts = explode(DIRECTORY_SEPARATOR, $dirname);
        $directories = [];
        while ($directoryParts) {
            $directories[] = implode(DIRECTORY_SEPARATOR, $directoryParts);
            array_shift($directoryParts);
        }
        return $directories;
    }
1338519
protected function findFile($file)
    {
        foreach (clone $this->paths as $path) {
            $filePath = $path . '/' . $file;

            if (is_file($filePath)) {
                return $filePath;
            }
        }

        return false;
    }
736085
protected function Find()
	{
		$myWords = $this->WordCollection();
		
		$xmlnukeDB = $this->_context->getXMLDataBase();
		
		$arr = $xmlnukeDB->searchDocuments($this->txtSearch, $this->_context->get("checkAll") != "");

		$blockCenter = new XmlBlockCollection($myWords->Value("BLOCKRESULT"), BlockPosition::Center);
		$this->_document->addXmlnukeObject($blockCenter);
		
		if ($arr == null)
		{
			$paragraph = new XmlParagraphCollection();
			$paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("NOTFOUND")));
			$blockCenter->addXmlnukeObject($paragraph);
		}
		else
		{
			$nodeTitleList = array("/meta/title");
			$nodeAbstractList = array("/meta/abstract");

			$configSearchFile = new AnydatasetFilenameProcessor("_configsearch");
			$configSearch = new AnyDataset( $configSearchFile ->FullQualifiedNameAndPath());
			
			$iterator = $configSearch->getIterator();
			while ($iterator->hasNext())
			{
				$singleRow = $iterator->moveNext();
				$nodeTitleList[] = $sr->getField("nodetitle");
				$nodeAbstractList[] = $sr->getField("nodeabstract") ;
			}

			foreach($arr as $s)
			{
				$singleName = FilenameProcessor::StripLanguageInfo($s);

				try
				{
					$file = new XMLFilenameProcessor($singleName);
					$docResult = $this->_context->getXMLDataBase()->getDocument($file->FullQualifiedName(), null);
					$nodeResult = $this->getNode($nodeTitleList, $docResult);
					$titulo = ($nodeResult == null) ? $myWords->Value("NOTITLE") : $nodeResult->nodeValue;
					$nodeResult = $this->getNode($nodeAbstractList, $docResult);
					$abstr = ($nodeResult == null) ? "" : $nodeResult->nodeValue;
					
					$paragraph = new XmlParagraphCollection();
					$blockCenter->addXmlnukeObject($paragraph);
					
					$href = new XmlAnchorCollection("engine:xmlnuke?xml=$singleName", "");
					$href->addXmlnukeObject(new XmlnukeText($titulo));
					$paragraph->addXmlnukeObject($href);
					
					$paragraph->addXmlnukeObject(new XmlnukeText(" ["));
					
					$href = new XmlAnchorCollection("engine:xmlnuke?xml=$singleName&xsl=rawxml", "");
					$href->addXmlnukeObject(new XmlnukeText($myWords->Value("VIEWXML")));
					$paragraph->addXmlnukeObject($href);
					
					$paragraph->addXmlnukeObject(new XmlnukeText("]"));
					$paragraph->addXmlnukeObject(new XmlnukeBreakLine());
					$paragraph->addXmlnukeObject(new XmlnukeText($abstr));
				}
				catch (Exception $e)
				{
					$paragraph = new XmlParagraphCollection();
					$paragraph->addXmlnukeObject(new XmlnukeText($s . " (" . $myWords->Value("NOTITLE") . ")"));
					$blockCenter->addXmlnukeObject($paragraph);
				}
			}
			$paragraph = new XmlParagraphCollection();
			$paragraph->addXmlnukeObject(new XmlnukeText($myWords->Value("DOCFOUND", sizeof($arr) )));
			$blockCenter->addXmlnukeObject($paragraph);
		}
	}
75152
private static function getIgnoredFiles($file) {
    if (file_exists($file) === FALSE) {
      return array();
    }

    $contents = file_get_contents($file);
    if ($contents === FALSE) {
      return array();
    }

    return preg_split('/\s+/', $contents);
  }
1252177
public function searchDocuments($words, $includeAllDocs)
	{
		$this->checkBtreeIsLoaded();
		
		if ($this->_btree == null)
		{
			throw new NotFoundException("BTree is invalid. Try to recreate  the index.", 601);
		}
		else
		{
			$arr = BTreeUtil::searchDocuments(strtolower(trim($words)), $this->_btree, $includeAllDocs);

			return $arr;
		}
	}
114665
public static function basedOnBlacklist($word)
	{
		$words[] = (string)$word;
		$words[] = strtolower($word);
		$words[] = strtolower(strrev($word));

		$len = strlen($word);
		$word2 = '';

		// @FIXME: badly inefficient
		for ($i = 0; $i < $len; $i++)
		{
			if (preg_match('/[a-zA-Z]/', $word[$i]))
			{
				$word2 .= $word[$i];
			}
		}

		$words[] = strtolower($word2);
		$words[] = strtolower(strrev($word2));
		$words[] = self::toL33t($word);
		$words[] = strrev(self::toL33t($word));
		$words[] = self::toSimpleL33t($word);
		$words[] = strrev(self::toSimpleL33t($word));

		$total = self::all()
			->whereIn('word', $words)
			->total();

		return ($total > 1); // returns true if char belongs to class
	}
365498
private void findFiles(File directory) throws IOException, ClassNotFoundException {

        File[] files = directory.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name.endsWith(".class");
            }
        });

        if (files != null) {
            for (File file : files) {
                int current = currentDirectoryPath.length();
                String fileName = file.getCanonicalPath().substring(++current);
                String className = fileName.replace(File.separatorChar, '.').substring(0, fileName.length() - 6);
                tryClass(className);
            }
        }
    }
27807
protected function ucWords($word)
    {
        $arr = explode('-', $word);
        $list = [];
        foreach ($arr as $vo) {
            $list[] = ucfirst($vo);
        }
        return implode('-', $list);
    }
511433
public static function isBasedOnName($word, $name)
	{
		$word = self::normalize($word);

		if (empty($word))
		{
			return false;
		}

		$names = explode(" ", $name);

		$count = count($names);
		$words = array();

		$fullname = self::normalize($name);

		$words[] = $fullname;
		$words[] = strrev($fullname);

		foreach ($names as $e)
		{
			$e = self::normalize($e);

			if (strlen($e) > 3)
			{
				$words[] = $e;
				$words[] = strrev($e);
			}
		}

		if ($count > 1)
		{
			$e = self::normalize($names[0] . $names[$count-1]);

			$words[] = $e;
			$words[] = strrev($e);
		}

		foreach ($words as $w)
		{
			if (empty($w))
			{
				continue;
			}

			if (strpos($w, $word) !== false)
			{
				return true;
			}
		}

		return false;
	}
369384
public function grep( $word ) {
		$found = array();
		foreach($this->logs as $log) {
			if (strpos($log,$word)!==false) {
				$found[] = $log;
			}
		}
		return $found;
	}
852008
public static function get(String $file) : stdClass
    {
        $file = self::rpath($file);

        if( ! is_file($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        return (object)
        [
            'basename'   => self::pathInfo($file, 'basename'),
            'size'       => filesize($file),
            'date'       => filemtime($file),
            'readable'   => is_readable($file),
            'writable'   => is_writable($file),
            'executable' => is_executable($file),
            'permission' => fileperms($file)
        ];
    }
705245
protected function findFiles()
    {
        $ds = new DirectoryScanner();
        $ds->setBasedir($this->dir);
        $ds->setIncludes(array('**/composer.json'));
        $ds->scan();
        return $ds->getIncludedFiles();
    }
1039945
public function file($path)
    {
        return $this->files(dirname($path))->first(function ($file) use ($path) {
            return $file['path'] === $path;
        }, function () use ($path) {
            throw new FileNotFoundException("File [$path] not found!");
        });
    }