/** * @param string * @return false when file is not found * true when class file is found and loaded */ public function loadClass($class) { if (class_exists($class, false) || interface_exists($class, false)) { return true; } $path = NamespaceParser::parse($class); if (false === $path) { return false; } foreach ($this->pathList as $root) { $file = $root . DIRECTORY_SEPARATOR . $path; if (is_file($file)) { require $file; return true; } } if ($this->isIncludePathEnabled() && ($file = stream_resolve_include_path($path))) { require $file; return true; } return false; }
/** * @dataProvider provideParseStringsWithExtensions * @return null */ public function testParseWithExtension($input, $expected) { $result = $this->parser->parse($input); $this->assertEquals($expected, $result); }