protected function getRealPath($phpFile) { if (Str::startsWith($this->path, ['phar'])) { $realPath = $phpFile->getPath() . '/' . $phpFile->getFilename(); } else { $realPath = $phpFile->getRealPath(); } return $realPath; }
/** * return an array of values filtered by the key starting with $startswith * @param $arr [] * @param $startwith string * @return array */ public static function filterKeyStartsWith(&$arr, $startwith) { $results = array(); foreach ($arr as $key => $value) { if (Str::startsWith($key, $startwith) === true) { $results[$key] = $value; } } return $results; }
public function testStartsWithNull() { $this->assertFalse(Str::startsWith('test', null)); }