]> git.andy128k.dev Git - ipf.git/commitdiff
pass project to application
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 17 Dec 2016 18:12:09 +0000 (19:12 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 17 Dec 2016 18:12:09 +0000 (19:12 +0100)
ipf/application.php
ipf/project.php

index 47264c617b6ed3ddf4653678b1514217ae32cdfa..71bb436abc2bb49ed662bdc18129a52786bc9465 100644 (file)
@@ -2,14 +2,25 @@
 
 abstract class IPF_Application
 {
-    protected $name = null;
+    /** @var IPF_Project */
+    private $project;
 
-    public function __construct($data=array())
+    /** @var string */
+    private $name, $path;
+
+    public function __construct(IPF_Project $project)
     {
+        $this->project = $project;
+
         $this->name = preg_replace('/_App$/', '', get_class($this));
 
         $rc = new ReflectionClass($this);
-        $this->path = dirname($rc->getFileName()).DIRECTORY_SEPARATOR;
+        $this->path = dirname($rc->getFileName()) . DIRECTORY_SEPARATOR;
+    }
+
+    public function getProject()
+    {
+        return $this->project;
     }
 
     public function getName()
@@ -34,8 +45,10 @@ abstract class IPF_Application
 
     /**
      * Configures application
+     *
+     * @param IPF_Settings $settings
      */
-    public function configure($settings)
+    public function configure(IPF_Settings $settings)
     {
     }
 
@@ -69,4 +82,3 @@ abstract class IPF_Application
         return array();
     }
 }
-
index b3ac3a9e303153c73920244b7b97e71b3894c491..4da1fae4cc2ff340288e409cbd6ba6c87f53b1d0 100644 (file)
@@ -19,7 +19,8 @@ final class IPF_Project
     {
         foreach (IPF::get('applications') as $name) {
             $className = $name.'_App';
-            $app = new $className;
+            /** @var IPF_Application $app */
+            $app = new $className($this);
             $app->configure(IPF::$settings);
 
             $this->apps[$name] = $app;