2017 © Pedro PelĆ”ez
 

library trex-parser

A PHP tool to parse code and extract statements

image

raphhh/trex-parser

A PHP tool to parse code and extract statements

  • Monday, December 28, 2015
  • by raphhh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 576 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

TRex parser

Latest Stable Version Build Status Scrutinizer Quality Score Code Coverage SensioLabsInsight Dependency Status Total Downloads Reference Status License, (*1)

PHP tool to parse code and extract statements., (*2)

Install

$ composer require raphhh/trex-parser, (*3)

Usage

ClassAnalyzer

First, give the PHP code to analyze:, (*4)

$code = 'class Foo{}';

$analyzer = new ClassAnalyzer();
$classReflections = $analyzer->getClassReflections($code);

You can also give a file path to the analyzer:, (*5)

$filePath = 'MyClass.php';

$analyzer = new ClassAnalyzer();
$classReflections = $analyzer->getClassReflectionsFromFile($filePath);

$classReflections is an array of ReflectionClass., (*6)

$objects = [];
foreach($classReflections as $className => $classReflection){
    $objects[$className] = $classReflection->newInstance();
}        

ClassName

Retrieve base name

$className = new ClassName('\Foo\Qux\Bar');
$className->getBaseName(); //"Bar"

Retrieve namespace

$className = new ClassName('\Foo\Qux\Bar');
$className->getNamespace(); //"Foo\Qux"

Split

$className = new ClassName('\Foo\Qux\Bar');
$className->split(); //["Foo", "Qux", "Bar"]

The Versions

28/12 2015

dev-master

9999999-dev https://github.com/Raphhh/trex-parser

A PHP tool to parse code and extract statements

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Raphaƫl Lefebvre

bootstrap

28/12 2015

1.1.0

1.1.0.0 https://github.com/Raphhh/trex-parser

A PHP tool to parse code and extract statements

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Raphaƫl Lefebvre

bootstrap

24/01 2015

1.0.0

1.0.0.0 https://github.com/Raphhh/trex-parser

A bootstrap for a PHP lib, including basic common files and settings

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Raphaƫl Lefebvre

bootstrap