Doc Comment Parsing Wrapper in PHP, used in my final year project
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ARO_Exceptions
tests
ARO.php
AnnotationParser.php
AnnotationParsing.php
Parser.php
README.markdown

README.markdown

No Maintenance Intended

ARO - Doc Comment Parsing Wrapper-

Module of BlueIgnis

Written by Ashwanth Kumar <ashwanth@ashwanthkumar.in>

Version 0.1

Introduction

An attempt to create a Doc Comment Block parsing wrapper, as I was not able to find anything decent to get things done in a simple way without too much dependencies, and being lightweight. Well the name At the Rate Of (ARO) is inspired from 2 source, first being usually At the Rate Of (ARO) refers to symbol "@", and second that's how we represent annotations.

Design Goals:

  • Improve the parsing method to enable detecting mutli-valued annotation values as in @MultiValued(name = "Name", visible = "false")

Usage Examples:

require_once("/path/to/lib/aro/ARO.php");

/**
 *	Mock Class small description goes here about the class.
 *
 *	@author Ashwanth Kumar
 *	@email	ashwanth@ashwanthkumar.in
 *	@version 0.1
 *	@module AROTest
 *	@Inject ServiceName
 **/
class MockClass {
	/**
	 *	@NonVisual Helo
	 **/
	public $non_visual;
	/**
	 *	@Visual
	 **/
	public $visual;

	/**
	 *	Sample random method that does nothing.
	 *
	 *	@return void
	 **/
	public function method() {
	}
}

// Invoke any of these classes for parsing the annotations
$reflection = new AnnotatedClass('MockClass');

$reflection = new AnnotatedMethod('MockClass', 'method');

$reflection = new AnnotatedProperty('MockClass', 'visual');

// All these Objects have 3 methods in common

// Returns a Boolean value whether the Annotation exist 
$reflection->hasAnnotation($annotation_name_to_check);

try {
	// If the Annotation exist, it returns the value, else AnnotationNotFoundException exception is thrown
	$reflection->getAnnotation($annotation_name_to_get_value);
} catch(AnnotationNotFoundException $e) {
	// Handle the exception here
}

// Get the list of all annotations 
$reflection->getAnnotations(); 

Credits