PreReq Index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys,

So here's what I'm looking for as a result(ex):

array ('html'       => array('iOutput'  => array('iIO' => array() )),

      'xml'        => array('iInput'   => array('iIO' => array() )),
      'database'   =>  array('iData',
                             'aMySQL',
                             'aFile',
                             'iOutput' => array('iIO' => array())
                            )
     );

This is a requirement tree which will be populated via my method Ember::setPreReq(). I'm not sure how to develop this method properly, however.

Ember::setPreReq() is a method I'm using as part of my framework that includes files needed by components in a clean manner, as well as allowing me map the requirements in an array that can be used for debugging purposes.

Definition thus far:

/***********
  * Public Static Method getPrereq
  * INCOMPLETE
  * @param fpaFiles Array(String, Integer)
  **
  * Allows files to get prerequisite files to be included and initilized
  * if required.
  *
  * fpaFiles format:
  * array( 'test.php'  => Ember::mciSystem,
           'test2.php' => Ember::mciModule );
  **********/
const mciSystem = 0;
 const mciModule    = 1;
 const mciLibrary   = 2;
 const mciInterface = 3;
 const mciException = 4;
public static function setPrereq($fpaFiles) {
   global $gcSystemPath, $gcLibaryPath, $gcInterfacePath;
   foreach ( $fpaFiles as $fFile => $fType ) {
     switch ($fType) {
//
       // mciSystem
       //
       case 0:
break; //
       // mciModule
       //
       case 1:
break; //
       // mciLibrary
       //
       case 2:
$fFile = $gcLibraryPath . $fFile . '.php'; break; //
       // mciInterface
       //
       case 3:
$fFile = $gcInterfacePath . $fFile . '.php'; if ( !file_exists($fFile) ) {
           throw new Exception("File '$fFile' does not exist", 1003);
         }
@include_once $fFile or ( throw new Exception("File '$fFile' could not be included.", 1003) ); $this->maReqTree break; //
       // mciException
       //
       case 4:
break;
     }
   }
}

Example Call:


Ember::setPrereq( array('iOutput' => Ember::mciInterface) );

Any help is apreceated. I'm not sure where to go next to build this array.

Regards,
- Craige

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux