2017 © Pedro Peláez
 

library reflection

Reflection - Simple utility to reflect objects and classes to access properties and methods.

image

best-served-cold/reflection

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  • Monday, March 20, 2017
  • by nark3d
  • Repository
  • 1 Watchers
  • 0 Stars
  • 104 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Build Status Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight Latest Stable Version Code Climate Issue Count, (*1)

Reflection

A simple way of interrogating private methods and properties via overloading., (*2)

Install

composer require best-served-cold/reflection

Usage

Take this class:, (*3)

class ExampleClass
{
    protected $protectedProperty = 1;
    protected static $protectedStaticProperty = 2;
    private $privateProperty = 3;
    private static $privateStaticProperty = 4;

    protected function protectedMethod($number)
    {
        return $number + 1;
    }

    private function privateMethod($number)
    {
        return $number + 2;
    }

    protected static function protectedStaticMethod($number)
    {
        return $number + 3;
    }

    private static function privateStaticMethod($number)
    {
        return $number + 4;
    }
}

Usage as a class

$reflectionClass = new ReflectionClass(ExampleClass::class);

echo $reflectionClass->protectedStaticProperty . PHP_EOL;
echo $reflectionClass->privateStaticProperty . PHP_EOL;
echo $reflectionClass->protectedStaticMethod(2) . PHP_EOL;
echo $reflectionClass->privateStaticMethod(4) . PHP_EOL;

Returns:, (*4)

2
4
5
8

Usage as an object

$reflectionObject = new ReflectionObject(new Exampleclass);

echo $reflectionObject->protectedProperty . PHP_EOL;
echo $reflectionObject->privateProperty . PHP_EOL;
echo $reflectionObject->protectedMethod(2) . PHP_EOL;
echo $reflectionObject->privateMethod(4) . PHP_EOL;

Returns:, (*5)

1
3
3
6

The Versions

20/03 2017

dev-master

9999999-dev http://bestservedcold.com

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

reflection best served cold easy reflection auto reflection

14/03 2017

1.0.3

1.0.3.0 http://bestservedcold.com

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

reflection best served cold easy reflection auto reflection

14/03 2017

1.0.2

1.0.2.0 http://bestservedcold.com

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

reflection best served cold easy reflection auto reflection

14/03 2017

1.0.1

1.0.1.0 http://bestservedcold.com

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

reflection best served cold easy reflection auto reflection

14/03 2017

1.0.0

1.0.0.0 http://bestservedcold.com

Reflection - Simple utility to reflect objects and classes to access properties and methods.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

reflection best served cold easy reflection auto reflection