public static function getInstance($property, AnConfig $config)
    {
        $description = $config['description'];
        $name = $config['name'];

        if (!$name || !$description) {
            throw new AnDomainPropertyException('name [string] or desription [AnDomainDescriptionAbstract] options are missing');
        }

        if ($description->getProperty($name)) {
            $instance = $description->getProperty($name);
        } else {
            if (!isset(self::$_instances[$property])) {
                $classname = 'AnDomain'.AnInflector::camelize($property);
                self::$_instances[$property] = new $classname();
            }
            $instance = clone self::$_instances[$property];
        }

        $instance->setConfig($config);

        $description->setProperty($instance);

        return $instance;
    }
public static function getInstance($property, AnConfig $config)
    {
        $description = $config['description'];
        $name = $config['name'];

        if (!$name || !$description) {
            throw new AnDomainPropertyException('name [string] or desription [AnDomainDescriptionAbstract] options are missing');
        }

        if ($description->getProperty($name)) {
            $instance = $description->getProperty($name);
        } else {
            if (!isset(self::$_instances[$property])) {
                $classname = 'AnDomain'.AnInflector::camelize($property);
                self::$_instances[$property] = new $classname();
            }
            $instance = clone self::$_instances[$property];
        }

        $instance->setConfig($config);

        $description->setProperty($instance);

        return $instance;
    }
public static function getInstance ( $ property , AnConfig $ config ) { $ description = $ config [ 'description' ] ; $ name = $ config [ 'name' ] ; if ( ! $ name || ! $ description ) { throw new AnDomainPropertyException ( 'name [string] or desription [AnDomainDescriptionAbstract] options are missing' ) ; } if ( $ description -> getProperty ( $ name ) ) { $ instance = $ description -> getProperty ( $ name ) ; } else { if ( ! isset ( self :: $ _instances [ $ property ] ) ) { $ classname = 'AnDomain' . AnInflector :: camelize ( $ property ) ; self :: $ _instances [ $ property ] = new $ classname ( ) ; } $ instance = clone self :: $ _instances [ $ property ] ; } $ instance -> setConfig ( $ config ) ; $ description -> setProperty ( $ instance ) ; return $ instance ; }
Creates and initialize a property. The instantiation happens through cloning rather
then creating a new instance.

@param string  $property The property type
@param AnConfig $config   The property configuration

@return AnDomainPropertyAbstract
Creates and initialize a property . The instantiation happens through cloning rather then creating a new instance .