Example #1
0
 /**
  * Constructs an <code>ExitStatusException</code>.
  * @param null|int|string $arg1
  * @param int $arg2
  * @param Location $arg3
  */
 public function __construct($arg1 = null, $arg2 = 0, Location $arg3 = null)
 {
     $methodArgsNum = func_num_args();
     if ($methodArgsNum === 1) {
         parent::__construct();
         $this->code = (int) $arg1;
     } elseif ($methodArgsNum === 2 && is_string($arg1) && is_int($arg2)) {
         parent::__construct($arg1);
         $this->code = $arg2;
     } elseif ($methodArgsNum === 3 && is_string($arg1) && is_int($arg2)) {
         parent::__construct($arg1, $arg3);
         $this->code = $arg2;
     }
 }
Example #2
0
 /**
  * Constructor, generates an Exception Message.
  */
 public function __construct()
 {
     parent::__construct('Build was not executed yet');
 }
Example #3
0
 /**
  * Import a PHP file
  * @param string $path Path to the PHP file
  * @param mixed $classpath String or object supporting __toString()
  * @throws BuildException - if cannot find the specified file
  */
 public static function __import($path, $classpath = null)
 {
     if ($classpath) {
         // Apparently casting to (string) no longer invokes __toString() automatically.
         if (is_object($classpath)) {
             $classpath = $classpath->__toString();
         }
         // classpaths are currently additive, but we also don't want to just
         // indiscriminantly prepand/append stuff to the include_path.  This means
         // we need to parse current incldue_path, and prepend any
         // specified classpath locations that are not already in the include_path.
         //
         // NOTE:  the reason why we do it this way instead of just changing include_path
         // and then changing it back, is that in many cases applications (e.g. Propel) will
         // include/require class files from within method calls.  This means that not all
         // necessary files will be included in this import() call, and hence we can't
         // change the include_path back without breaking those apps.  While this method could
         // be more expensive than switching & switching back (not sure, but maybe), it makes it
         // possible to write far less expensive run-time applications (e.g. using Propel), which is
         // really where speed matters more.
         $curr_parts = explode(PATH_SEPARATOR, ini_get('include_path'));
         $add_parts = explode(PATH_SEPARATOR, $classpath);
         $new_parts = array_diff($add_parts, $curr_parts);
         if ($new_parts) {
             if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
                 print "Phing::import() prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts) . "\n";
             }
             ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
         }
     }
     $ret = (include_once $path);
     if ($ret === false) {
         $e = new BuildException("Error importing {$path}");
         if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
             // We can't log this because listeners belong
             // to projects.  We'll just print it -- of course
             // that isn't very compatible w/ other frontends (but
             // there aren't any right now, so I'm not stressing)
             print "Error importing {$path}\n";
             print $e->getTraceAsString() . "\n";
         }
         throw $e;
     }
     return;
 }
Example #4
0
 /**
  * Constructor, generates an Exception Message.
  *
  * @param Xinc_Project $project
  * @param int          $buildTime
  */
 public function __construct(Project $project, $buildTime)
 {
     parent::__construct('Build  "' . $project->getName() . '" ' . 'with timestamp ' . $buildTime . ' was not found.');
 }
Example #5
0
 /**
  * Constructor, generates an Exception Message.
  *
  * @param Xinc_Project $project
  * @param int          $buildTime
  */
 public function __construct(Project $project, $buildTime)
 {
     parent::__construct('Build of "' . $project->getName() . '" ' . ' with timestamp: ' . $buildTime . ' could not be serialized.');
 }