Formulas/Resources/Resource.php
public static function fromArray( $source )
	{
		try
		{
			$classname = get_called_class();

			if ( ! class_exists( $classname ) )
			{
				\XBRL_Log::getInstance()->err( "The class '$classname' does not exist" );
				return null;
			}

			$instance = new $classname();

			if ( ! $instance instanceof Resource )
			{
				\XBRL_Log::getInstance()->err( "The class instance being created MUST inherit from 'XBRL\\Formulas\\Resources\\Resources'" );
				return null;
			}

			$has = get_object_vars( $instance );
			foreach ( $has as $name => $oldValue )
			{
	        	if ( ! isset( $source[ $name ] ) ) continue;
	        	$instance->$name = $source[ $name ];
			}

			return $instance;
		}
		catch( \Exception $ex )
		{
			return null;
		}
	}
public static function fromArray( $source )
	{
		try
		{
			$classname = get_called_class();

			if ( ! class_exists( $classname ) )
			{
				\XBRL_Log::getInstance()->err( "The class '$classname' does not exist" );
				return null;
			}

			$instance = new $classname();

			if ( ! $instance instanceof Resource )
			{
				\XBRL_Log::getInstance()->err( "The class instance being created MUST inherit from 'XBRL\\Formulas\\Resources\\Resources'" );
				return null;
			}

			$has = get_object_vars( $instance );
			foreach ( $has as $name => $oldValue )
			{
	        	if ( ! isset( $source[ $name ] ) ) continue;
	        	$instance->$name = $source[ $name ];
			}

			return $instance;
		}
		catch( \Exception $ex )
		{
			return null;
		}
	}
public static function fromArray ( $ source ) { try { $ classname = get_called_class ( ) ; if ( ! class_exists ( $ classname ) ) { \ XBRL_Log :: getInstance ( ) -> err ( "The class '$classname' does not exist" ) ; return null ; } $ instance = new $ classname ( ) ; if ( ! $ instance instanceof Resource ) { \ XBRL_Log :: getInstance ( ) -> err ( "The class instance being created MUST inherit from 'XBRL\\Formulas\\Resources\\Resources'" ) ; return null ; } $ has = get_object_vars ( $ instance ) ; foreach ( $ has as $ name => $ oldValue ) { if ( ! isset ( $ source [ $ name ] ) ) continue ; $ instance -> $ name = $ source [ $ name ] ; } return $ instance ; } catch ( \ Exception $ ex ) { return null ; } }
Populate an instance with values from an array
@param array $source An array of values to add to the class
@return Resource
Populate an instance with values from an array