コード例 #1
0
ファイル: Bug006Test.php プロジェクト: naderman/pflow
 /**
  * testFileQueryResolvesReferenceToInterfaceInSameFile
  *
  * @return void
  * @covers \stdClass
  * @group reflection
  * @group reflection::regression
  * @group regressiontest
  */
 public function testFileQueryResolvesReferenceToInterfaceInSameFile()
 {
     $path = $this->getPathnameForClass('Bug006_1');
     $session = new ReflectionSession();
     $query = $session->createFileQuery();
     foreach ($query->find($path) as $class) {
         if ($class->getName() === 'Bug006_1') {
             $this->assertEquals(array('Bug006_1_Interface'), $class->getInterfaceNames());
         }
     }
 }
コード例 #2
0
 /**
  * testSessionWithFileQueryCreatesExpectedNullClassInstances
  *
  * @return void
  * @covers \stdClass
  * @group reflection
  * @group reflection::integration
  * @group integrationtest
  */
 public function testSessionWithFileQueryCreatesExpectedNullClassInstances()
 {
     $path = $this->getPathnameForClass('ClassWithNullAndPreParsedInterface');
     $session = new ReflectionSession();
     $session->addClassFactory(new NullReflectionClassFactory());
     $query = $session->createFileQuery();
     $class = $query->find($path)->current();
     $interfaces = $class->getInterfaces();
     $this->assertFalse($interfaces[0]->isUserDefined());
 }
コード例 #3
0
ファイル: parse_file.php プロジェクト: naderman/pflow
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @category  PHP
 * @package   pdepend\reflection\examples
 * @author    Manuel Pichler <*****@*****.**>
 * @copyright 2009-2010 Manuel Pichler. All rights reserved.
 * @license   http://www.opensource.org/licenses/bsd-license.php  BSD License
 * @version   SVN: $Id$
 * @link      http://pdepend.org/
 */
use pdepend\reflection\Autoloader;
use pdepend\reflection\ReflectionSession;
if (count($argv) < 2) {
    echo 'Usage parse_file.php <file>', PHP_EOL;
    exit(23);
}
if (is_file($argv[1]) === false) {
    echo 'No valid file given: ', $argv[1], PHP_EOL;
    exit(23);
}
include_once __DIR__ . '/../../source/pdepend/reflection/Autoloader.php';
spl_autoload_register(array(new Autoloader(), 'autoload'));
$session = new ReflectionSession();
$query = $session->createFileQuery();
foreach ($query->find($argv[1]) as $class) {
    echo '- ', $class->getName(), PHP_EOL, '    ', $class->getFileName(), PHP_EOL;
}