PreReq Index
| From: | Craige Leeder | Date: | Thu, 30 Oct 2008 22:01:19 +0000 |
| Subject: | PreReq Index | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-282672@lists.php.net to get a copy of this message | ||
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