Inheritance: extends B1
 public function foo()
 {
     parent::ma32();
     parent::ma321();
     // Do not exists
     b2::ma2();
 }
Exemple #2
0
 public function before()
 {
     $this->a2 = A2::instance('a2-demo');
     $this->a1 = $this->a2->a1;
     $this->user = $this->a2->get_user();
     echo '<div style="position:absolute;top:0px;left:400px;background-color:#f0f0f0;font-weight:bold;padding:5px;">', html::anchor('a2demo/', 'index'), '-', html::anchor('a2demo/db', 'DB'), '</div>';
 }
Exemple #3
0
Fichier : user.php Projet : sars/rp
 public function before()
 {
     parent::before();
     $this->a2 = A2::instance('rp-user');
     $this->a1 = $this->a2->a1;
     $this->user = $this->a2->get_user();
 }
 public function __construct()
 {
     parent::__construct();
     new Profiler();
     $this->a2 = A2::instance('a2-demo');
     $this->a1 = $this->a2->a1;
     echo '<div style="position:absolute;top:0px;right:0px;background-color:#f0f0f0;font-weight:bold;padding:5px;">', html::anchor('a2demo/', 'index'), '-', html::anchor('a2demo/db', 'DB'), '</div>';
 }
 /**
  * Restrict access
  */
 public function before()
 {
     $a2 = A2::instance('auth');
     if (!$a2->allowed('logs', 'read')) {
         Kohana::$log->add('ACCESS', "Unauthorized attempt to read log files");
         Request::instance()->redirect(Route::get('admin_main')->uri());
     }
     parent::before();
 }
Exemple #6
0
 function f()
 {
     A1::f();
     A2::f();
     \A1::f();
     \A2::f();
     B::f();
     C::f();
 }
Exemple #7
0
 /**
  * Sets up admin framework controllers
  *
  * - Redirects invalid internal-only access requests to the admin main
  * - Loads resources if required, and redirects if invalid
  * - Performs ACL checking, and redirects if denied
  */
 public function before()
 {
     parent::before();
     // Set common variables
     $this->a2 = A2::instance('auth');
     $this->a1 = $this->a2->a1;
     $this->session = Session::instance();
     // Check if internal request
     if ($this->request !== Request::instance() or Request::$is_ajax) {
         $this->_internal = TRUE;
     }
     // Check if internal-only request
     if (in_array($this->request->action, $this->_internal_only) and !$this->_internal) {
         Kohana::$log->add(Kohana::INFO, 'Attempt to access internal URL, ' . $this->request->uri . ', externally');
         Request::instance()->redirect(Route::get('admin')->uri());
     }
     // Perform resource loads and ACL check
     try {
         if (in_array($this->request->action, $this->_resource_required)) {
             $this->_load_resource();
         }
         if ($this->_acl_required === 'all' or in_array($this->request->action, $this->_acl_required)) {
             $privilege = isset($this->_acl_map[$this->request->action]) ? $this->_acl_map[$this->request->action] : $this->_acl_map['default'];
             $this->a2->allowed($this->_resource, $privilege, TRUE);
         }
     } catch (A2_Exception $ae) {
         // Redirect to login form if not logged in
         if (!($user = $this->a2->get_user())) {
             $this->session->set('referrer', Request::instance()->uri);
             Message::instance()->error(Kohana::message('a2', 'login.required'));
             $this->request->redirect(Route::get('admin/auth')->uri());
         }
         Kohana::$log->add('ACCESS', 'Failed attempt to access resource, ' . $this->_resource . ', by user, ' . $user->username . ', with url, ' . $this->request->uri);
         Message::instance()->error($ae->getMessage(), array(':resource' => $this->_resource));
         // If internal request, redirect to denied action
         if ($this->_internal) {
             $this->request->action = 'denied';
         } else {
             // If controller-level access is denied, redirect to admin main
             if ($this->request->action == 'index') {
                 $this->request->redirect(Route::get('admin')->uri());
             } else {
                 $this->request->redirect($this->request->uri(array('action' => 'index', 'id' => NULL)));
             }
         }
     } catch (Kohana_Exception $ke) {
         // Catch 404 exceptions triggered by invalid resource loads
         if ($ke->getCode() == 404) {
             Message::instance()->error($ke->getMessage());
             $this->request->redirect($this->request->uri(array('action' => '', 'id' => NULL)));
         } else {
             throw $ke;
         }
     }
 }
Exemple #8
0
 public function before()
 {
     Session::$default = 'admin';
     $template = $this->template;
     $this->template = NULL;
     parent::before();
     if ($this->auto_render === TRUE) {
         $this->template = View_Admin::factory($template);
     }
     $this->acl = A2::instance('admin/a2');
     $this->config = Kohana::$config->load($this->config)->as_array();
 }
Exemple #9
0
 /**
  * Configure website controller
  */
 public function before()
 {
     parent::before();
     // Set common variables
     $this->a2 = A2::instance('auth');
     $this->a1 = $this->a2->a1;
     $this->session = Session::instance();
     // Check if internal request
     if ($this->request !== Request::instance()) {
         $this->internal_request = TRUE;
     }
 }
Exemple #10
0
 public function get_resource_id()
 {
     $resource = $this->_params['controller'];
     $parent = NULL;
     if (isset($this->_params['directory'])) {
         $parent = $this->_params['directory'];
         $resource = $this->_params['directory'] . '/' . $resource;
     }
     if (!A2::instance()->has_resource($resource)) {
         A2::instance()->add_resource($resource, $parent);
     }
     return $resource;
 }
Exemple #11
0
 public function before()
 {
     Session::$default = 'admin';
     parent::before();
     $this->acl = A2::instance('admin/a2');
     if (!$this->acl->logged_in() or empty($_FILES['upload'])) {
         Request::initial()->redirect(Route::url('error', array('action' => '403')));
     }
     $this->user = $this->acl->get_user();
     $this->site_id = (int) Session::instance()->get('SITE_ID');
     if (empty($this->site_id)) {
         $this->site_id = (int) $this->user->site_id;
     }
 }
Exemple #12
0
 public function before()
 {
     $this->add_css('assets/css/admin.css');
     $this->add_js('assets/js/jquery-1.3.2.min.js');
     $this->add_js('assets/js/jquery-ui-1.7.2.custom.min.js');
     $this->add_js('assets/js/main.js');
     $this->a2 = A2::instance();
     $this->a1 = $this->a2->a1;
     $this->user = $this->a2->get_user();
     View::set_global('user', $this->user);
     View::bind_global('errors', $this->errors);
     if ($this->auto_render === TRUE && !Request::$is_ajax) {
         // Load the template
         $this->template = View::factory($this->template)->bind('js', $this->js)->bind('css', $this->css);
         $this->template->errors = array();
     }
     // Check if the page is protected and if the user is not logged in
     if ($this->protected && !$this->user) {
         // Redirect the user to login page
         Request::instance()->redirect('account/login');
     }
 }
Exemple #13
0
 public function before()
 {
     $this->add_css('assets/css/main.css');
     $this->add_css('assets/css/redmond/jquery-ui.css');
     $this->add_js('assets/js/jquery.js');
     // Jquery 1.4
     $this->add_js('assets/js/jquery.validate.js');
     // Form Validation
     $this->add_js('assets/js/jquery-ui.js');
     $this->add_js('assets/js/main.js');
     // Initialize the Auth System
     $this->a2 = A2::instance();
     $this->a1 = $this->a2->a1;
     $this->user = $this->a2->get_user();
     // Setup the user specific settings
     if ($this->user) {
         if ($this->user->language) {
             I18n::lang($this->user->language);
         }
         //Time::$offset = '';
         //Time::$display = '';
     }
     //I18n::lang('en');
     View::set_global('user', $this->user);
     View::bind_global('errors', $this->errors);
     $this->MG = new ModularGaming($this->user);
     if ($this->auto_render === TRUE && !Request::$is_ajax) {
         // Load the template
         $this->template = View::factory($this->template)->bind('js', $this->js)->bind('css', $this->css);
     }
     // Check if the page is protected and if the user is not logged in
     if ($this->protected && !$this->user) {
         // Redirect the user to login page
         Request::instance()->redirect('account/login');
     }
     // Run the before events.
     Event::run('before', $this);
 }
Exemple #14
0
 protected function acl_init()
 {
     $request = $this->request->current();
     if (!Kohana::$is_cli) {
         $this->acl = A2::instance('admin/a2');
         if (!$this->acl->logged_in() and $request->controller() != 'auth') {
             Session::instance()->set('BACK_URL', $_SERVER['REQUEST_URI']);
             $request->redirect(Route::url('admin', array('controller' => 'auth')));
         }
         $this->user = $this->acl->get_user();
         if ($request->is_initial()) {
             define('IS_SUPER_USER', $this->user->role == 'super');
         }
     }
 }
Exemple #15
0
 public function action_index()
 {
     A2::instance('admin/a2')->auth()->logout(TRUE);
     $this->request->current()->redirect(Route::url('admin'));
 }
Exemple #16
0
 public static function doTest(A2 $obj)
 {
     echo __METHOD__ . "\n";
     $obj->test();
 }
Exemple #17
0
    }
    //这样做,启动单例的作用
    public static function getInstance()
    {
        return static::$instance;
    }
}
class A1 extends B1
{
    public function __construct()
    {
        //$this->setInstance($this);
        static::setInstance($this);
    }
    public function hello()
    {
        echo "A1 hello Method" . PHP_EOL;
    }
}
class A2 extends B1
{
    public function world()
    {
        echo 'A2 world Method' . PHP_EOL;
    }
}
$a1Obj = new A1();
B1::getInstance()->hello();
//输出 A1 hello Method
A2::getInstance()->hello();
Exemple #18
0
 public function __construct()
 {
     echo "In B2::__construct\n";
     parent::__construct();
 }
 function f()
 {
     self::nonStaticButSelfClass();
     static::nonStaticButSelfClass();
     parent::nonStaticButSelfClass();
 }
Exemple #20
0
 /**
  * Initializes Ushahidi and Plugins
  */
 public static function init()
 {
     /**
      * 0. Register depenendencies for injection.
      */
     $di = service();
     // Kohana injection
     $di->set('kohana.db', function () use($di) {
         // todo: is there some way to use different configs here?
         return Database::instance();
     });
     $di->set('kohana.media.dir', function () use($di) {
         return Kohana::$config->load('media.media_upload_dir');
     });
     // ACL
     $di->set('acl', function () {
         return A2::instance();
     });
     $di->set('session.user', function () use($di) {
         // Using the OAuth resource server, get the userid (owner id) for this request
         $server = $di->get('oauth.server.resource');
         $userid = $server->getOwnerId();
         // Using the user repository, load the user
         $repo = $di->get('repository.user');
         $user = $repo->get($userid);
         return $user;
     });
     // Console commands (oauth is disabled, pending T305)
     // $di->setter['Ushahidi\Console\Application']['injectCommands'][] = $di->lazyNew('Ushahidi_Console_Oauth_Client');
     // $di->setter['Ushahidi\Console\Application']['injectCommands'][] = $di->lazyNew('Ushahidi_Console_Oauth_Token');
     $di->setter['Ushahidi\\Console\\Application']['injectCommands'][] = $di->lazyNew('Ushahidi_Console_Dataprovider');
     $di->setter['Ushahidi_Console_Dataprovider']['setRepo'] = $di->lazyGet('repository.dataprovider');
     // OAuth servers
     $di->set('oauth.server.auth', function () use($di) {
         $server = $di->newInstance('League\\OAuth2\\Server\\Authorization');
         $server->addGrantType($di->newInstance('League\\OAuth2\\Server\\Grant\\AuthCode'));
         $server->addGrantType($di->newInstance('League\\OAuth2\\Server\\Grant\\RefreshToken'));
         $server->addGrantType($di->newInstance('League\\OAuth2\\Server\\Grant\\Password'));
         $server->addGrantType($di->newInstance('League\\OAuth2\\Server\\Grant\\ClientCredentials'));
         return $server;
     });
     $di->set('oauth.server.resource', $di->lazyNew('League\\OAuth2\\Server\\Resource'));
     // Use Kohana requests for OAuth server requests
     $di->setter['League\\OAuth2\\Server\\Resource']['setRequest'] = $di->lazyNew('OAuth2_Request');
     $di->setter['League\\OAuth2\\Server\\Authorization']['setRequest'] = $di->lazyNew('OAuth2_Request');
     // Custom password authenticator
     $di->setter['League\\OAuth2\\Server\\Grant\\Password']['setVerifyCredentialsCallback'] = function ($username, $password) {
         $usecase = service('factory.usecase')->get('users', 'login')->setIdentifiers(compact('username', 'password'));
         try {
             $data = $usecase->interact();
             return $data['id'];
         } catch (Exception $e) {
             return false;
         }
     };
     // Custom storage interfaces for OAuth servers
     $di->params['League\\OAuth2\\Server\\Authorization'] = ['client' => $di->lazyGet('repository.oauth.client'), 'session' => $di->lazyGet('repository.oauth.session'), 'scope' => $di->lazyGet('repository.oauth.scope')];
     $di->params['League\\OAuth2\\Server\\Resource'] = ['session' => $di->lazyNew('OAuth2_Storage_Session')];
     $di->params['OAuth2_Storage'] = ['db' => $di->lazyGet('kohana.db')];
     // Validator mapping
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['config'] = ['update' => $di->lazyNew('Ushahidi_Validator_Config_Update')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['forms'] = ['create' => $di->lazyNew('Ushahidi_Validator_Form_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Form_Update'), 'delete' => $di->lazyNew('Ushahidi_Validator_Form_Delete')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['form_attributes'] = ['create' => $di->lazyNew('Ushahidi_Validator_Form_Attribute_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Form_Attribute_Update')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['form_stages'] = ['create' => $di->lazyNew('Ushahidi_Validator_Form_Stage_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Form_Stage_Update'), 'delete' => $di->lazyNew('Ushahidi_Validator_Form_Stage_Delete')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['layers'] = ['create' => $di->lazyNew('Ushahidi_Validator_Layer_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Layer_Update')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['media'] = ['create' => $di->lazyNew('Ushahidi_Validator_Media_Create'), 'delete' => $di->lazyNew('Ushahidi_Validator_Media_Delete')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['posts'] = ['create' => $di->lazyNew('Ushahidi_Validator_Post_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Post_Create')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['tags'] = ['create' => $di->lazyNew('Ushahidi_Validator_Tag_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Tag_Update'), 'delete' => $di->lazyNew('Ushahidi_Validator_Tag_Delete')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['users'] = ['create' => $di->lazyNew('Ushahidi_Validator_User_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_User_Update'), 'register' => $di->lazyNew('Ushahidi_Validator_User_Register')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['messages'] = ['create' => $di->lazyNew('Ushahidi_Validator_Message_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Message_Update'), 'receive' => $di->lazyNew('Ushahidi_Validator_Message_Receive')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['savedsearches'] = ['create' => $di->lazyNew('Ushahidi_Validator_SavedSearch_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_SavedSearch_Update')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['sets'] = ['create' => $di->lazyNew('Ushahidi_Validator_Set_Create'), 'update' => $di->lazyNew('Ushahidi_Validator_Set_Create')];
     $di->params['Ushahidi\\Factory\\ValidatorFactory']['map']['sets_posts'] = ['create' => $di->lazyNew('Ushahidi_Validator_Set_Post_Create')];
     // Validator Setters
     $di->setter['Ushahidi_Validator_Form_Stage_Update'] = ['setFormRepo' => $di->lazyGet('repository.form')];
     $di->setter['Ushahidi_Validator_Media_Create'] = ['setMaxBytes' => $di->lazy(function () {
         return \Kohana::$config->load('media.max_upload_bytes');
     })];
     // Validation Trait
     $di->setter['Ushahidi\\Core\\Tool\\ValidationEngineTrait']['setValidation'] = $di->newFactory('Ushahidi_ValidationEngine');
     // Formatter mapping
     $di->params['Ushahidi\\Factory\\FormatterFactory']['map'] = ['config' => $di->lazyNew('Ushahidi_Formatter_Config'), 'dataproviders' => $di->lazyNew('Ushahidi_Formatter_Dataprovider'), 'forms' => $di->lazyNew('Ushahidi_Formatter_Form'), 'form_attributes' => $di->lazyNew('Ushahidi_Formatter_Form_Attribute'), 'form_stages' => $di->lazyNew('Ushahidi_Formatter_Form_Stage'), 'layers' => $di->lazyNew('Ushahidi_Formatter_Layer'), 'media' => $di->lazyNew('Ushahidi_Formatter_Media'), 'messages' => $di->lazyNew('Ushahidi_Formatter_Message'), 'posts' => $di->lazyNew('Ushahidi_Formatter_Post'), 'tags' => $di->lazyNew('Ushahidi_Formatter_Tag'), 'savedsearches' => $di->lazyNew('Ushahidi_Formatter_Set'), 'sets' => $di->lazyNew('Ushahidi_Formatter_Set'), 'sets_posts' => $di->lazyNew('Ushahidi_Formatter_Post'), 'savedsearches_posts' => $di->lazyNew('Ushahidi_Formatter_Post'), 'users' => $di->lazyNew('Ushahidi_Formatter_User')];
     // Formatter parameters
     foreach (['config', 'dataprovider', 'form', 'form_attribute', 'form_stage', 'layer', 'media', 'message', 'post', 'tag', 'user', 'savedsearch', 'set_post'] as $name) {
         $di->setter['Ushahidi_Formatter_' . Text::ucfirst($name, '_')]['setAuth'] = $di->lazyGet("authorizer.{$name}");
     }
     $di->setter['Ushahidi_Formatter_Set']['setAuth'] = $di->lazyGet("authorizer.set");
     // Set Formatter factory
     $di->params['Ushahidi\\Factory\\FormatterFactory']['factory'] = $di->newFactory('Ushahidi_Formatter_Collection');
     // Helpers, tools, etc
     $di->set('tool.hasher.password', $di->lazyNew('Ushahidi_Hasher_Password'));
     $di->set('tool.authenticator.password', $di->lazyNew('Ushahidi_Authenticator_Password'));
     $di->set('tool.filesystem', $di->lazyNew('Ushahidi_Filesystem'));
     $di->set('tool.validation', $di->lazyNew('Ushahidi_ValidationEngine'));
     $di->set('tool.jsontranscode', $di->lazyNew('Ushahidi\\Core\\Tool\\JsonTranscode'));
     // Handle filesystem using local paths for now... lots of other options:
     // https://github.com/thephpleague/flysystem/tree/master/src/Adapter
     $di->params['Ushahidi_Filesystem'] = ['adapter' => $di->lazyNew('League\\Flysystem\\Adapter\\Local')];
     $di->params['League\\Flysystem\\Adapter\\Local'] = ['root' => $di->lazyGet('kohana.media.dir')];
     // Formatters
     $di->set('formatter.entity.api', $di->lazyNew('Ushahidi_Formatter_API'));
     $di->set('formatter.entity.post.value', $di->lazyNew('Ushahidi_Formatter_PostValue'));
     $di->set('formatter.entity.post.geojson', $di->lazyNew('Ushahidi_Formatter_Post_GeoJSON'));
     $di->set('formatter.entity.post.geojsoncollection', $di->lazyNew('Ushahidi_Formatter_Post_GeoJSONCollection'));
     $di->set('formatter.entity.post.stats', $di->lazyNew('Ushahidi_Formatter_Post_Stats'));
     $di->set('formatter.output.json', $di->lazyNew('Ushahidi_Formatter_JSON'));
     $di->set('formatter.output.jsonp', $di->lazyNew('Ushahidi_Formatter_JSONP'));
     // Formatter parameters
     $di->setter['Ushahidi_Formatter_JSONP']['setCallback'] = function () {
         return Request::current()->query('callback');
     };
     $di->params['Ushahidi_Formatter_Post'] = ['value_formatter' => $di->lazyGet('formatter.entity.post.value')];
     $di->setter['Ushahidi_Formatter_Post_GeoJSON']['setDecoder'] = $di->lazyNew('Symm\\Gisconverter\\Decoders\\WKT');
     $di->setter['Ushahidi_Formatter_Post_GeoJSONCollection']['setDecoder'] = $di->lazyNew('Symm\\Gisconverter\\Decoders\\WKT');
     // Repositories
     $di->set('repository.config', $di->lazyNew('Ushahidi_Repository_Config'));
     $di->set('repository.contact', $di->lazyNew('Ushahidi_Repository_Contact'));
     $di->set('repository.dataprovider', $di->lazyNew('Ushahidi_Repository_Dataprovider'));
     $di->set('repository.form', $di->lazyNew('Ushahidi_Repository_Form'));
     $di->set('repository.form_stage', $di->lazyNew('Ushahidi_Repository_Form_Stage'));
     $di->set('repository.form_attribute', $di->lazyNew('Ushahidi_Repository_Form_Attribute'));
     $di->set('repository.layer', $di->lazyNew('Ushahidi_Repository_Layer'));
     $di->set('repository.media', $di->lazyNew('Ushahidi_Repository_Media'));
     $di->set('repository.message', $di->lazyNew('Ushahidi_Repository_Message'));
     $di->set('repository.post', $di->lazyNew('Ushahidi_Repository_Post'));
     $di->set('repository.tag', $di->lazyNew('Ushahidi_Repository_Tag'));
     $di->set('repository.set', $di->lazyNew('Ushahidi_Repository_Set'));
     $di->set('repository.savedsearch', $di->lazyNew('Ushahidi_Repository_Set', [], ['setSavedSearch' => true]));
     $di->set('repository.user', $di->lazyNew('Ushahidi_Repository_User'));
     $di->set('repository.role', $di->lazyNew('Ushahidi_Repository_Role'));
     $di->set('repository.oauth.client', $di->lazyNew('OAuth2_Storage_Client'));
     $di->set('repository.oauth.session', $di->lazyNew('OAuth2_Storage_Session'));
     $di->set('repository.oauth.scope', $di->lazyNew('OAuth2_Storage_Scope'));
     $di->setter['Ushahidi_Repository_User']['setHasher'] = $di->lazyGet('tool.hasher.password');
     // Repository parameters
     foreach (['form_attribute', 'post', 'layer', 'tag', 'set'] as $name) {
         $di->setter['Ushahidi_Repository_' . Text::ucfirst($name, '_')]['setTranscoder'] = $di->lazyGet('tool.jsontranscode');
     }
     // Abstract repository parameters
     $di->params['Ushahidi_Repository'] = ['db' => $di->lazyGet('kohana.db')];
     $di->params['Ushahidi_Repository_Media'] = ['upload' => $di->lazyGet('tool.uploader')];
     $di->params['Ushahidi_Repository_Post'] = ['form_attribute_repo' => $di->lazyGet('repository.form_attribute'), 'form_stage_repo' => $di->lazyGet('repository.form_stage'), 'post_value_factory' => $di->lazyGet('repository.post_value_factory'), 'bounding_box_factory' => $di->newFactory('Util_BoundingBox'), 'tag_repo' => $di->lazyGet('repository.tag')];
     $di->set('repository.post.datetime', $di->lazyNew('Ushahidi_Repository_PostDatetime'));
     $di->set('repository.post.decimal', $di->lazyNew('Ushahidi_Repository_PostDecimal'));
     $di->set('repository.post.geometry', $di->lazyNew('Ushahidi_Repository_PostGeometry'));
     $di->set('repository.post.int', $di->lazyNew('Ushahidi_Repository_PostInt'));
     $di->set('repository.post.point', $di->lazyNew('Ushahidi_Repository_PostPoint'));
     $di->set('repository.post.text', $di->lazyNew('Ushahidi_Repository_PostText'));
     $di->set('repository.post.varchar', $di->lazyNew('Ushahidi_Repository_PostVarchar'));
     // The post value repo factory
     $di->set('repository.post_value_factory', $di->lazyNew('Ushahidi_Repository_PostValueFactory'));
     $di->params['Ushahidi_Repository_PostValueFactory'] = ['map' => ['datetime' => $di->lazyGet('repository.post.datetime'), 'decimal' => $di->lazyGet('repository.post.decimal'), 'geometry' => $di->lazyGet('repository.post.geometry'), 'int' => $di->lazyGet('repository.post.int'), 'point' => $di->lazyGet('repository.post.point'), 'text' => $di->lazyGet('repository.post.text'), 'varchar' => $di->lazyGet('repository.post.varchar')]];
     $di->params['Ushahidi_Repository_PostPoint'] = ['decoder' => $di->lazyNew('Symm\\Gisconverter\\Decoders\\WKT')];
     // Validators
     $di->set('validator.user.login', $di->lazyNew('Ushahidi_Validator_User_Login'));
     $di->set('validator.contact.create', $di->lazyNew('Ushahidi_Validator_Contact_Create'));
     $di->params['Ushahidi_Validator_Contact_Create'] = ['repo' => $di->lazyGet('repository.contact'), 'user_repo' => $di->lazyGet('repository.user')];
     // Dependencies of validators
     $di->params['Ushahidi_Validator_Post_Create'] = ['repo' => $di->lazyGet('repository.post'), 'attribute_repo' => $di->lazyGet('repository.form_attribute'), 'stage_repo' => $di->lazyGet('repository.form_stage'), 'tag_repo' => $di->lazyGet('repository.tag'), 'user_repo' => $di->lazyGet('repository.user'), 'form_repo' => $di->lazyGet('repository.form'), 'role_repo' => $di->lazyGet('repository.role'), 'post_value_factory' => $di->lazyGet('repository.post_value_factory'), 'post_value_validator_factory' => $di->lazyGet('validator.post.value_factory')];
     $di->params['Ushahidi_Validator_Tag_Update'] = ['repo' => $di->lazyGet('repository.tag'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_User_Create'] = ['repo' => $di->lazyGet('repository.user'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_User_Update'] = ['repo' => $di->lazyGet('repository.user'), 'user' => $di->lazyGet('session.user'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_User_Register'] = ['repo' => $di->lazyGet('repository.user')];
     $di->params['Ushahidi_Validator_Layer_Update'] = ['media_repo' => $di->lazyGet('repository.media')];
     $di->params['Ushahidi_Validator_Message_Update'] = ['repo' => $di->lazyGet('repository.message')];
     $di->params['Ushahidi_Validator_Message_Create'] = ['repo' => $di->lazyGet('repository.message')];
     $di->params['Ushahidi_Validator_Message_Receive'] = ['repo' => $di->lazyGet('repository.message')];
     $di->params['Ushahidi_Validator_Set_Create'] = ['repo' => $di->lazyGet('repository.user'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_SavedSearch_Create'] = ['repo' => $di->lazyGet('repository.user'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_SavedSearch_Update'] = ['repo' => $di->lazyGet('repository.user'), 'role_repo' => $di->lazyGet('repository.role')];
     $di->params['Ushahidi_Validator_Set_Post_Create'] = ['post_repo' => $di->lazyGet('repository.post')];
     $di->set('validator.post.datetime', $di->lazyNew('Ushahidi_Validator_Post_Datetime'));
     $di->set('validator.post.decimal', $di->lazyNew('Ushahidi_Validator_Post_Decimal'));
     $di->set('validator.post.geometry', $di->lazyNew('Ushahidi_Validator_Post_Geometry'));
     $di->set('validator.post.int', $di->lazyNew('Ushahidi_Validator_Post_Int'));
     $di->set('validator.post.link', $di->lazyNew('Ushahidi_Validator_Post_Link'));
     $di->set('validator.post.point', $di->lazyNew('Ushahidi_Validator_Post_Point'));
     $di->set('validator.post.varchar', $di->lazyNew('Ushahidi_Validator_Post_Varchar'));
     $di->set('validator.post.value_factory', $di->lazyNew('Ushahidi_Validator_Post_ValueFactory'));
     $di->params['Ushahidi_Validator_Post_ValueFactory'] = ['map' => ['datetime' => $di->lazyGet('validator.post.datetime'), 'decimal' => $di->lazyGet('validator.post.decimal'), 'geometry' => $di->lazyGet('validator.post.geometry'), 'int' => $di->lazyGet('validator.post.int'), 'link' => $di->lazyGet('validator.post.link'), 'point' => $di->lazyGet('validator.post.point'), 'varchar' => $di->lazyGet('validator.post.varchar')]];
     /**
      * 1. Load the plugins
      */
     self::load();
     /**
      * Attach database config
      */
     self::attached_db_config();
 }
 function testDeepClone()
 {
     $a1 = new A2();
     $a2 = clone $a1;
     self::assertNotEquals(spl_object_hash($a1->getB()), spl_object_hash($a2->getB()));
 }