public static function methods($class, $format = null, array $options = []) {
		$defaults = ['methods' => [], 'group' => true, 'self' => true];
		$options += $defaults;

		if (!(is_object($class) && $class instanceof ReflectionClass)) {
			try {
				$class = new ReflectionClass($class);
			} catch (ReflectionException $e) {
				return null;
			}
		}
		$options += ['names' => $options['methods']];
		$methods = static::_items($class, 'getMethods', $options);
		$result = [];

		switch ($format) {
			case null:
				return $methods;
			case 'extents':
				if ($methods->getName() === []) {
					return [];
				}

				$extents = function($start, $end) { return [$start, $end]; };
				$result = array_combine($methods->getName(), array_map(
					$extents, $methods->getStartLine(), $methods->getEndLine()
				));
			break;
			case 'ranges':
				$ranges = function($lines) {
					list($start, $end) = $lines;
					return ($end <= $start + 1) ? [] : range($start + 1, $end - 1);
				};
				$result = array_map($ranges, static::methods(
					$class, 'extents', ['group' => true] + $options
				));
			break;
		}

		if ($options['group']) {
			return $result;
		}
		$tmp = $result;
		$result = [];

		array_map(function($ln) use (&$result) { $result = array_merge($result, $ln); }, $tmp);
		return $result;
	}
public static function methods($class, $format = null, array $options = []) {
		$defaults = ['methods' => [], 'group' => true, 'self' => true];
		$options += $defaults;

		if (!(is_object($class) && $class instanceof ReflectionClass)) {
			try {
				$class = new ReflectionClass($class);
			} catch (ReflectionException $e) {
				return null;
			}
		}
		$options += ['names' => $options['methods']];
		$methods = static::_items($class, 'getMethods', $options);
		$result = [];

		switch ($format) {
			case null:
				return $methods;
			case 'extents':
				if ($methods->getName() === []) {
					return [];
				}

				$extents = function($start, $end) { return [$start, $end]; };
				$result = array_combine($methods->getName(), array_map(
					$extents, $methods->getStartLine(), $methods->getEndLine()
				));
			break;
			case 'ranges':
				$ranges = function($lines) {
					list($start, $end) = $lines;
					return ($end <= $start + 1) ? [] : range($start + 1, $end - 1);
				};
				$result = array_map($ranges, static::methods(
					$class, 'extents', ['group' => true] + $options
				));
			break;
		}

		if ($options['group']) {
			return $result;
		}
		$tmp = $result;
		$result = [];

		array_map(function($ln) use (&$result) { $result = array_merge($result, $ln); }, $tmp);
		return $result;
	}
public static function methods ( $ class , $ format = null , array $ options = [ ] ) { $ defaults = [ 'methods' => [ ] , 'group' => true , 'self' => true ] ; $ options += $ defaults ; if ( ! ( is_object ( $ class ) && $ class instanceof ReflectionClass ) ) { try { $ class = new ReflectionClass ( $ class ) ; } catch ( ReflectionException $ e ) { return null ; } } $ options += [ 'names' => $ options [ 'methods' ] ] ; $ methods = static :: _items ( $ class , 'getMethods' , $ options ) ; $ result = [ ] ; switch ( $ format ) { case null : return $ methods ; case 'extents' : if ( $ methods -> getName ( ) === [ ] ) { return [ ] ; } $ extents = function ( $ start , $ end ) { return [ $ start , $ end ] ; } ; $ result = array_combine ( $ methods -> getName ( ) , array_map ( $ extents , $ methods -> getStartLine ( ) , $ methods -> getEndLine ( ) ) ) ; break ; case 'ranges' : $ ranges = function ( $ lines ) { list ( $ start , $ end ) = $ lines ; return ( $ end <= $ start + 1 ) ? [ ] : range ( $ start + 1 , $ end - 1 ) ; } ; $ result = array_map ( $ ranges , static :: methods ( $ class , 'extents' , [ 'group' => true ] + $ options ) ) ; break ; } if ( $ options [ 'group' ] ) { return $ result ; } $ tmp = $ result ; $ result = [ ] ; array_map ( function ( $ ln ) use ( & $ result ) { $ result = array_merge ( $ result , $ ln ) ; } , $ tmp ) ; return $ result ; }
Returns various information on the methods of an object, in different formats.

@param string|object $class A string class name for purely static classes or an object
instance, from which to get methods.
@param string $format The type and format of data to return. Available options are:
- `null`: Returns a `Collection` object containing a `ReflectionMethod` instance
for each method.
- `'extents'`: Returns a two-dimensional array with method names as keys, and
an array with starting and ending line numbers as values.
- `'ranges'`: Returns a two-dimensional array where each key is a method name,
and each value is an array of line numbers which are contained in the method.
@param array $options Set of options applied directly (check `_items()` for more options):
- `'methods'` _array_: An arbitrary list of methods to search, as a string (single
method name) or array of method names.
- `'group'`: If true (default) the array is grouped by context (ex.: method name), if
false the results are sequentially appended to an array.
-'self': If true (default), only returns properties defined in `$class`,
excluding properties from inherited classes.
@return mixed Return value depends on the $format given:
- `null` on failure.
- `lithium\util\Collection` if $format is `null`
- `array` if $format is either `'extends'` or `'ranges'`.
Returns various information on the methods of an object in different formats .