Exemplo n.º 1
0
 /**
  * Get the full server path to the view file backing this
  * view object.
  *
  * @return String The full server path
  */
 protected function getPath()
 {
     $path = $this->provider->getPath() . '/View';
     $old_path = $this->provider->getPath() . '/views';
     foreach (array($path, $old_path) as $path) {
         if (file_exists($path . '/' . $this->path . '.php')) {
             return $path . '/' . $this->path . '.php';
         }
     }
     throw new \Exception('View file not found: ' . htmlentities($this->path));
 }
Exemplo n.º 2
0
 public function __construct(Provider $provider)
 {
     $this->provider = $provider;
     $this->shortname = $provider->getPrefix();
 }
Exemplo n.º 3
0
 /**
  * @param String $path Root path for the provider namespace
  * @param String $file Name of the setup file
  * @param String $prefix Prefix for our service provider [optional]
  */
 public function addProvider($path, $file = 'addon.setup.php', $prefix = NULL)
 {
     $path = rtrim($path, '/');
     $file = $path . '/' . $file;
     $prefix = $prefix ?: basename($path);
     if (!file_exists($file)) {
         throw new \Exception("Cannot read setup file: {$path}");
     }
     $provider = new Provider($this->dependencies, $path, require $file);
     $provider->setPrefix($prefix);
     $provider->setAutoloader($this->autoloader);
     $this->registry->register($prefix, $provider);
     return $provider;
 }
Exemplo n.º 4
0
 /**
  * Is a given provider an addon?
  *
  * @return bool Is an addon?
  */
 protected function isAddon(Provider $provider)
 {
     $path = $provider->getPath();
     return strpos($path, PATH_ADDONS) === 0 || strpos($path, PATH_THIRD) === 0;
 }