Loader Class Reference

List of all members.

Public Member Functions

 setExternal ($booExternal)
 getExternal ()
 show ($strFullPathFile)
 getClassContent ()

Static Public Member Functions

static getInstance ()
static requireOnce ($strFile, $booIsClass=false)

Protected Attributes

 $booExternal = false
 $arrFiles = array()
 $strClassContent = ''

Static Protected Attributes

static $objInstance


Detailed Description

Class responsable to controls the load of the files.

This class is responsable to make the classical load of the files and to make the visible code load, what is essencial to the external load of the component.

Author:
Thiago Henrique Ramos da Mata <thiago.henrique.mata@gmail.com>

Definition at line 16 of file Loader.class.php.


Member Function Documentation

getClassContent (  ) 

Definition at line 122 of file Loader.class.php.

00123     {
00124         return $this->strClassContent;
00125     }

getExternal (  ) 

Get if the loader it is to external access

See also:
Loader::setExternal( boolean )

Loader->boolExternal

Returns:
boolean

Definition at line 77 of file Loader.class.php.

Referenced by requireOnce().

00078     {
00079         return $this->booExternal;
00080     }

static getInstance (  )  [static]

Return the singleton instance of the Loader class

Returns:
Loader

Definition at line 49 of file Loader.class.php.

Referenced by requireOnce().

00050     {
00051         if( self::$objInstance == null )
00052         {
00053             self::$objInstance = new Loader();
00054         }
00055         return self::$objInstance;
00056     }

static requireOnce ( strFile,
booIsClass = false 
) [static]

Require Once the file of the Code To Diagram

Parameters:
string $strFile
boolean $booIsClass

Definition at line 88 of file Loader.class.php.

References $arrBackTrace, $arrCaller, $strFile, $strFileCaller, getExternal(), getInstance(), CorujaFileManipulation::getPathOfFile(), and CorujaFileManipulation::isRelativePath().

00089     {
00090 //        print $strFile . '<br/>' . "\n";
00091         $arrBackTrace = debug_backtrace();
00092         $arrCaller = $arrBackTrace[0];
00093         $strFileCaller = $arrCaller[ 'file' ];
00094         $strPathCaller = CorujaFileManipulation::getPathOfFile( $strFileCaller  );
00095 
00096         if( CorujaFileManipulation::isRelativePath( $strFile ) )
00097         {
00098             $strFullPathFile = $strPathCaller . $strFile;
00099         }
00100         else
00101         {
00102             $strFullPathFile = $strFile;
00103         }
00104 
00105         if( $booIsClass && self::getInstance()->getExternal() )
00106         {
00107              self::getInstance()->show( $strFullPathFile );
00108         }
00109         
00110         require_once( $strFullPathFile );
00111     }

setExternal ( booExternal  ) 

Set if the loader it is to extenal access

See also:
Loader::getExternal()

Loader->boolExternal

Parameters:
boolean $booExternal

Definition at line 65 of file Loader.class.php.

References $booExternal.

00066     {
00067         $this->booExternal = $booExternal;
00068     }

show ( strFullPathFile  ) 

Definition at line 113 of file Loader.class.php.

00114     {
00115         if( !in_array( $strFullPathFile , $this->arrFiles ) )
00116         {
00117             $this->arrFiles[] = $strFullPathFile;
00118             $this->strClassContent .= file_get_contents( $strFullPathFile );
00119         }
00120     }


Member Data Documentation

$arrFiles = array() [protected]

Array of files already load by the lodader class

string[]

Definition at line 35 of file Loader.class.php.

$booExternal = false [protected]

Flag if the loader it is to external access

boolean

Definition at line 28 of file Loader.class.php.

Referenced by setExternal().

$objInstance [static, protected]

instance of the loader element

Loader

Definition at line 22 of file Loader.class.php.

$strClassContent = '' [protected]

Class content of the classes loaded

string

Definition at line 42 of file Loader.class.php.


The documentation for this class was generated from the following file:

Generated on Thu Feb 3 03:55:03 2011 for CodeToDiagram by  doxygen 1.5.9