public function __findSerialisablePropertyAccessors() {

        // Grab the class name first.
        $className = get_class($this);

        // If no accessor map has been previously cached for this class type, cache it now.
        if (!isset (self::$__accessorMaps [$className])) {


            $reflectionClass = new \ReflectionClass ($className);

            // Create the accessors array for storing all possible accessors.
            $accessors = array();

            // Loop through all methods, checking for public get and set accessors first.
            $methods = $reflectionClass->getMethods();
            foreach ($methods as $method) {

                if ($method->isStatic())
                    continue;

                if ((substr($method->getName(), 0, 3) == "get") && ($method->getNumberOfRequiredParameters() == 0)) {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["get"] = $method;
                } else if (substr($method->getName(), 0, 3) == "set") {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["set"] = $method;
                }
            }

            // Now loop through all properties, checking for any public / protected ones
            $properties = $reflectionClass->getProperties();
            foreach ($properties as $property) {

                if ($property->isStatic())
                    continue;

                $propertyName = strtolower($property->getName());

                if (!isset ($accessors [$propertyName])) {
                    $accessors [$propertyName] = array();
                }
                if (!isset ($accessors [$propertyName] ["get"]))
                    $accessors [$propertyName] ["get"] = $property;
                if (!isset ($accessors [$propertyName] ["set"]))
                    $accessors [$propertyName] ["set"] = $property;

            }

            self::$__accessorMaps [$className] = $accessors;

        }

        return self::$__accessorMaps [$className];
    }
public function __findSerialisablePropertyAccessors() {

        // Grab the class name first.
        $className = get_class($this);

        // If no accessor map has been previously cached for this class type, cache it now.
        if (!isset (self::$__accessorMaps [$className])) {


            $reflectionClass = new \ReflectionClass ($className);

            // Create the accessors array for storing all possible accessors.
            $accessors = array();

            // Loop through all methods, checking for public get and set accessors first.
            $methods = $reflectionClass->getMethods();
            foreach ($methods as $method) {

                if ($method->isStatic())
                    continue;

                if ((substr($method->getName(), 0, 3) == "get") && ($method->getNumberOfRequiredParameters() == 0)) {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["get"] = $method;
                } else if (substr($method->getName(), 0, 3) == "set") {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["set"] = $method;
                }
            }

            // Now loop through all properties, checking for any public / protected ones
            $properties = $reflectionClass->getProperties();
            foreach ($properties as $property) {

                if ($property->isStatic())
                    continue;

                $propertyName = strtolower($property->getName());

                if (!isset ($accessors [$propertyName])) {
                    $accessors [$propertyName] = array();
                }
                if (!isset ($accessors [$propertyName] ["get"]))
                    $accessors [$propertyName] ["get"] = $property;
                if (!isset ($accessors [$propertyName] ["set"]))
                    $accessors [$propertyName] ["set"] = $property;

            }

            self::$__accessorMaps [$className] = $accessors;

        }

        return self::$__accessorMaps [$className];
    }
public function __findSerialisablePropertyAccessors ( ) { // Grab the class name first. $ className = get_class ( $ this ) ; // If no accessor map has been previously cached for this class type, cache it now. if ( ! isset ( self :: $ __accessorMaps [ $ className ] ) ) { $ reflectionClass = new \ ReflectionClass ( $ className ) ; // Create the accessors array for storing all possible accessors. $ accessors = array ( ) ; // Loop through all methods, checking for public get and set accessors first. $ methods = $ reflectionClass -> getMethods ( ) ; foreach ( $ methods as $ method ) { if ( $ method -> isStatic ( ) ) continue ; if ( ( substr ( $ method -> getName ( ) , 0 , 3 ) == "get" ) && ( $ method -> getNumberOfRequiredParameters ( ) == 0 ) ) { $ propertyName = strtolower ( substr ( $ method -> getName ( ) , 3 ) ) ; if ( ! isset ( $ accessors [ $ propertyName ] ) ) { $ accessors [ $ propertyName ] = array ( ) ; } $ accessors [ $ propertyName ] [ "get" ] = $ method ; } else if ( substr ( $ method -> getName ( ) , 0 , 3 ) == "set" ) { $ propertyName = strtolower ( substr ( $ method -> getName ( ) , 3 ) ) ; if ( ! isset ( $ accessors [ $ propertyName ] ) ) { $ accessors [ $ propertyName ] = array ( ) ; } $ accessors [ $ propertyName ] [ "set" ] = $ method ; } } // Now loop through all properties, checking for any public / protected ones $ properties = $ reflectionClass -> getProperties ( ) ; foreach ( $ properties as $ property ) { if ( $ property -> isStatic ( ) ) continue ; $ propertyName = strtolower ( $ property -> getName ( ) ) ; if ( ! isset ( $ accessors [ $ propertyName ] ) ) { $ accessors [ $ propertyName ] = array ( ) ; } if ( ! isset ( $ accessors [ $ propertyName ] [ "get" ] ) ) $ accessors [ $ propertyName ] [ "get" ] = $ property ; if ( ! isset ( $ accessors [ $ propertyName ] [ "set" ] ) ) $ accessors [ $ propertyName ] [ "set" ] = $ property ; } self :: $ __accessorMaps [ $ className ] = $ accessors ; } return self :: $ __accessorMaps [ $ className ] ; }
Find all serialisable property objects, return a map of accessor objects keyed in by GET and SET.
Find all serialisable property objects return a map of accessor objects keyed in by GET and SET .