Ejemplo n.º 1
0
 public function query($sql)
 {
     $resource = mssql_query($sql, $this->link);
     if ($resource) {
         if (is_resource($resource)) {
             $i = 0;
             $data = array();
             while ($result = mssql_fetch_assoc($resource)) {
                 $data[$i] = $result;
                 $i++;
             }
             mssql_free_result($resource);
             $query = new Object();
             $row = isset(Arrays::first($data)) ? Arrays::first($data) : array();
             $query->setRow($row)->setRows($data)->setNumRows($i);
             unset($data);
             return $query;
         } else {
             return true;
         }
     } else {
         trigger_error('Error: ' . mssql_get_last_message($this->link) . '<br />' . $sql);
         exit;
     }
 }
Ejemplo n.º 2
0
 public function orderBy($tab, $fieldOrder, $orderDirection = 'ASC')
 {
     $sortFunc = function ($key, $direction) {
         return function ($a, $b) use($key, $direction) {
             if ('ASC' == $direction) {
                 return $a[$key] > $b[$key];
             } else {
                 return $a[$key] < $b[$key];
             }
         };
     };
     if (Arrays::is($fieldOrder) && !Arrays::is($orderDirection)) {
         $t = array();
         foreach ($fieldOrder as $tmpField) {
             array_push($t, $orderDirection);
         }
         $orderDirection = $t;
     }
     if (!Arrays::is($fieldOrder) && Arrays::is($orderDirection)) {
         $orderDirection = Arrays::first($orderDirection);
     }
     if (Arrays::is($fieldOrder) && Arrays::is($orderDirection)) {
         for ($i = 0; $i < count($fieldOrder); $i++) {
             usort($tab, $sortFunc($fieldOrder[$i], $orderDirection[$i]));
         }
     } else {
         usort($tab, $sortFunc($fieldOrder, $orderDirection));
     }
     return $tab;
 }
Ejemplo n.º 3
0
Archivo: Db.php Proyecto: schpill/thin
 public static function connexion()
 {
     $args = func_get_args();
     $class = '\\Thin\\Db\\' . ucfirst(Inflector::lower(Arrays::first($args)));
     array_shift($args);
     return call_user_func_array([$class, 'instance'], $args);
 }
Ejemplo n.º 4
0
 public function __call($func, $argv)
 {
     if (substr($func, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         if (isset($argv[0])) {
             $environment = $argv[0];
         } else {
             $environment = APPLICATION_ENV;
         }
         return getConfig($key, $environment);
     } elseif (substr($func, 0, 3) == 'set') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($argv);
         if (isset($argv[1])) {
             $environment = $argv[1];
         } else {
             $environment = 'all';
         }
         setConfig($key, $value, $environment);
         return $this;
     } elseif (substr($func, 0, 3) == 'has') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         if (isset($argv[0])) {
             $environment = $argv[0];
         } else {
             $environment = APPLICATION_ENV;
         }
         return null !== getConfig($key, $environment);
     }
 }
Ejemplo n.º 5
0
 public function __call($method, $args)
 {
     if (true === $this->__has($method)) {
         return $this->__fire($method, $args);
     }
     $reverse = strrev($method);
     $last = $reverse[0];
     if ('s' == $last) {
         if (!count($args)) {
             return isAke($this->values, $method);
         } else {
             $this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
             foreach ($args as $arg) {
                 array_push($this->values[$method], $arg);
             }
         }
         return $this;
     } else {
         $method .= 's';
         if (!count($args)) {
             $val = isAke($this->values, $method);
             return count($val) ? Arrays::first($val) : null;
         } else {
             $this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
             foreach ($args as $arg) {
                 array_push($this->values[$method], $arg);
             }
         }
         return $this;
     }
 }
Ejemplo n.º 6
0
 public function __call($method, $args)
 {
     if (0 == count($args)) {
         return static::get($method);
     } elseif (1 == count($args)) {
         return static::set($method, Arrays::first($args));
     }
 }
Ejemplo n.º 7
0
 public static function send($arguments = array())
 {
     $response = static::request('messages/send', $arguments);
     if (false !== $response && Arrays::is($response)) {
         $response = Arrays::first($response);
         return $response['status'] == 'sent' ? true : $response['status'];
     }
     return false;
 }
Ejemplo n.º 8
0
 public function del($key)
 {
     $files = $this->search($key . '#');
     if (count($files)) {
         $key = Arrays::first($files);
         unset($this->buffer[$key]);
         $this->commit();
     }
     return $this;
 }
Ejemplo n.º 9
0
 public function del($key)
 {
     $pattern = strstr($key, '#') ? $key : $key . '#';
     $rows = $this->search($pattern);
     if (count($rows)) {
         $key = Arrays::first($rows);
         $this->db->srem($this->ns, $key);
     }
     return $this;
 }
Ejemplo n.º 10
0
Archivo: Cli.php Proyecto: schpill/thin
 public function __construct($args)
 {
     $method = Arrays::first($args);
     $argv = array_slice($args, 1);
     if (method_exists($this, $method)) {
         call_user_func_array(array($this, $method), $argv);
     } else {
         $this->render(Arrays::first($args) . ' is not a valid method', 'ERROR');
     }
 }
Ejemplo n.º 11
0
 public static function __callStatic($method, $args)
 {
     $auth = ['GET', 'POST', 'COOKIE', 'SESSION', 'SERVER', 'REQUEST', 'GLOBALS'];
     $method = Inflector::upper($method);
     if (Arrays::in($method, $auth) && count($args) > 0) {
         $default = isset($args[1]) ? $args[1] : null;
         return isAke(self::tab($method), Arrays::first($args), $default);
     } elseif (Arrays::in($method, $auth) && count($args) == 0) {
         return self::tab($method);
     } else {
         throw new Exception("Wrong parameters.");
     }
 }
Ejemplo n.º 12
0
 public function __call($func, $argv)
 {
     if (substr($func, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         return getMeta($key);
     } elseif (substr($func, 0, 3) == 'set') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($argv);
         setMeta($key, $value);
         return $this;
     } elseif (substr($func, 0, 3) == 'has') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($func, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         return null !== getMeta($key);
     }
 }
Ejemplo n.º 13
0
Archivo: Moo.php Proyecto: schpill/thin
 public static function __callStatic($method, $args)
 {
     $db = Inflector::uncamelize($method);
     if (fnmatch('*_*', $db)) {
         list($database, $table) = explode('_', $db, 2);
     } else {
         $database = SITE_NAME;
         $table = $db;
     }
     if (!count($args)) {
         return Moo\Db::instance($database, $table);
     } elseif (count($args) == 1) {
         $id = Arrays::first($args);
         if (is_numeric($id)) {
             return Moo\Db::instance($database, $table)->find($id);
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * @param array $patterns
  * @return \Closure
  */
 protected static function __match(array $patterns)
 {
     return function (...$args) use($patterns) {
         // [a] -> Bool
         $patternApplies = function ($pattern) use($args) {
             /** @noinspection PhpParamsInspection */
             return Logic::all(Arrays::zipWith(Lambda::apply(), Arrays::map(self::make(), Arrays::init($pattern)), $args));
         };
         try {
             /** @noinspection PhpParamsInspection */
             $getMatchedImplementation = Lambda::compose(Arrays::last(), Arrays::first($patternApplies), Arrays::filter(function ($pattern) use($args) {
                 return count($pattern) - 1 === count($args);
             }));
             return call_user_func_array($getMatchedImplementation($patterns), $args);
         } catch (\Exception $e) {
             throw new IncompletePatternMatchException('Incomplete pattern match expression.');
         }
     };
 }
Ejemplo n.º 15
0
 private function clean($key, $force = false)
 {
     $now = time();
     $file = $this->getFile('expires.' . $key . '.5');
     $path = str_replace(DS . Arrays::last(explode(DS, $file)), '', $file);
     if (is_dir($path)) {
         $files = glob($path . DS . '*.php');
         if (!empty($files)) {
             $when = (int) str_replace([$path . DS, '.php'], '', Arrays::first($files));
             if ($when < $now || true === $force) {
                 File::rmdir($path);
                 $this->remove($key);
             }
         }
     } else {
         if (true === $force) {
             $this->remove($key);
         }
     }
     return $this;
 }
Ejemplo n.º 16
0
 public function __call($event, $args)
 {
     if (substr($event, 0, 3) == 'get') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($event, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         return $this->get($key);
     } elseif (substr($event, 0, 3) == 'set') {
         $value = Arrays::first($args);
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($event, 3)));
         $key = Inflector::lower($uncamelizeMethod);
         if ($key == '__object') {
             throw new Exception("The key {$key} is protected.");
         }
         return $this->set($key, $value);
     }
     if (true === $this->__has($event)) {
         return $this->__fire($event, $args);
     } else {
         $value = Arrays::first($args);
         if (method_exists($this, $event)) {
             throw new Exception("The method {$event} is a native class' method. Please choose an other name.");
         }
         if (!is_callable($value)) {
             $closure = function () use($value) {
                 return $value;
             };
             $value = $closure;
         }
         $obj = $this->instance();
         $share = function () use($obj, $value) {
             $args = func_get_args();
             $args[] = $obj;
             return call_user_func_array($value, $args);
         };
         $eventable = $this->__event($event, $share);
         return $this;
     }
 }
Ejemplo n.º 17
0
 public static function _construct()
 {
     // Load the charsets file so we can detect them.
     $chset = Core::config('charset');
     if (!file_exists(CORE . 'charset' . EXT)) {
         Core::error('404MSG', 'LIBTIT', array(__CLASS__, 'charset'));
     }
     include CORE . 'charset' . EXT;
     self::$_CHS = $_CHS;
     unset($_CHS);
     // load the default database configuration and
     // check for required values.
     self::$_DBS = Core::config('databases');
     if (!is_array(self::$_DBS)) {
         Core::error('ARRTYP', 'LIBTIT', array(__CLASS__, 'databases'));
     }
     if (!count(self::$_DBS)) {
         Core::error('ARRNUM', 'LIBTIT', array(__CLASS__, 'databases', 1));
     }
     // we get the default database and check for the correct settings
     self::$_DDB = Arrays::first(self::$_DBS);
     echo key(self::$_DBS);
     var_dump(self::$_DDB);
 }
Ejemplo n.º 18
0
Archivo: Log.php Proyecto: schpill/thin
 /**
  * Dynamically write a log message.
  *
  * <code>
  *      // Write an "error" message to the log file
  *      Log::error('This is an error!');
  *
  *      // Write a "warning" message to the log file
  *      Log::warning('This is a warning!');
  *
  *      // Log an arrays data
  *      Log::info(array('name' => 'Sawny', 'passwd' => '1234', array(1337, 21, 0)), true);
  *      //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
  *      //If we had omit the second parameter the result had been: Array
  * </code>
  */
 public static function __callStatic($method, $parameters)
 {
     $prettyPrint = count($parameters) == 2 ? Arrays::last($parameters) : false;
     static::write($method, Arrays::first($parameters), $prettyPrint);
 }
Ejemplo n.º 19
0
 private function queryParamsCallback($matches)
 {
     return preg_replace('/./Uui', '*', Arrays::first($matches));
 }
Ejemplo n.º 20
0
Archivo: Orm.php Proyecto: schpill/thin
 public function backup()
 {
     $newline = NL;
     $tables = $this->_query('SHOW TABLES');
     if (Arrays::is($tables)) {
         $count = count($tables);
     } else {
         $count = $tables->rowCount();
     }
     if (false === $tables) {
         throw new Exception("This database {$this->_entity} contains no table.");
     }
     $output = '';
     foreach ($tables as $table) {
         $table = current($table);
         $queryTable = "SHOW CREATE TABLE `" . $this->_dbName . '`.`' . $table . '`';
         $res = $this->_query($queryTable);
         if (is_array($res)) {
             $count = count($res);
         } else {
             $count = $res->rowCount();
         }
         if (false === $res || 1 > $count) {
             continue;
         }
         $res = Arrays::first($res);
         $create = $res[1];
         $output .= '#' . $newline . '# TABLE STRUCTURE FOR: ' . $table . $newline . '#' . $newline . $newline;
         $output .= 'DROP TABLE IF EXISTS ' . $table . ';' . $newline . $newline;
         $output .= $create . ';' . $newline . $newline;
         $res = $this->_query("SELECT * FROM {$table}");
         if (Arrays::is($res)) {
             $count = count($res);
         } else {
             $count = $res->rowCount();
         }
         if (false === $res || 1 > $count) {
             continue;
         }
         foreach ($res as $row) {
             $fields = array();
             $values = array();
             foreach ($row as $key => $value) {
                 if (!is_numeric($key)) {
                     $fields[] = $key;
                     $values[] = "'" . addslashes($value) . "'";
                 }
             }
             $output .= 'INSERT INTO ' . $table . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ');' . $newline;
         }
         $output .= $newline;
     }
     return $output;
 }
Ejemplo n.º 21
0
 public function expire($key, $ttl = 3600)
 {
     $val = $this->get($key);
     if (strlen($val)) {
         $db = Fastdb::instance('core', 'expirate');
         $record = array();
         $record['key'] = $key;
         $record['ns'] = $this->ns;
         $record['entity'] = $this->entity;
         $record['expire'] = time() + $ttl;
         $exists = $db->search(array('key' => $key, 'ns' => $this->ns, 'entity' => $this->entity));
         $id = count($exists) ? Arrays::first($exists) : $db->incr('core::expire::count');
         $db->set($id, $record);
     }
 }
Ejemplo n.º 22
0
 public function getExtract($id)
 {
     $json = getCached('getExtract.wp.' . $id, function () use($id) {
         return file_get_contents("https://fr.wikipedia.org/w/api.php?action=query&pageids={$id}&prop=extracts|pageimages|pageterms&format=json&redirects=true&exchars=1024&explaintext=true&piprop=thumbnail|name");
     });
     $tab = json_decode($json, true);
     $extract = array_get($tab, 'query.pages.' . $id . '.extract');
     return Arrays::first(explode("\n", $extract));
 }
Ejemplo n.º 23
0
 /**
  * Keep the connection alive and dispatch events
  *
  * @access public
  * @todo work on callbacks
  */
 public function keepAlive()
 {
     while (is_resource($this->fd)) {
         if ($this->session['heartbeat_timeout'] > 0 && $this->session['heartbeat_timeout'] + $this->heartbeatStamp - 5 < time()) {
             $this->send(self::TYPE_HEARTBEAT);
             $this->heartbeatStamp = time();
         }
         $r = array($this->fd);
         $w = $e = null;
         if (stream_select($r, $w, $e, 5) == 0) {
             continue;
         }
         $res = $this->read();
         $sess = explode(':', $res);
         if ((int) Arrays::first($sess) === self::TYPE_EVENT) {
             unset(Arrays::first($sess), $sess[1], $sess[2]);
             $response = json_decode(implode(':', $sess), true);
             $name = $response['name'];
             $data = Arrays::first($response['args']);
             $this->stdout('debug', 'Receive event "' . $name . '" with data "' . $data . '"');
             if (!empty($this->callbacks[$name])) {
                 foreach ($this->callbacks[$name] as $callback) {
                     call_user_func($callback, $data);
                 }
             }
         }
     }
 }
Ejemplo n.º 24
0
 public function getOfferInByCategory($reseller_id, $offerin_id, $category_id)
 {
     $db = Model::Offerin();
     $ageDb = $db->getAge();
     $cache = $db->getCache('get.offerbycategory.in');
     $keyAge = 'age.' . sha1(serialize(func_get_args()));
     $keyData = 'data.' . sha1(serialize(func_get_args()));
     $cacheAge = $cache->get($keyAge, false);
     if (false !== $cacheAge) {
         if ($ageDb < $cacheAge) {
             $cacheData = $cache->get($keyData, false);
             if (false !== $cacheData) {
                 return unserialize($cacheData);
             }
         }
     }
     $collection = $return = $cats = [];
     $offers = Model::Offerin()->inCache(true)->where(['id', '=', $offerin_id])->exec();
     if (!empty($offers)) {
         foreach ($offers as $offer) {
             $item = $offer;
             $item['date_creation'] = $offer['created_at'];
             $item['date_expiration'] = $offer['expiration'];
             $articles = Model::Articlein()->where(['offerin_id', '=', $offer['id']])->exec();
             if (!empty($articles)) {
                 foreach ($articles as $article) {
                     $item_id = isAke($article, 'item_id', 0);
                     if (0 < $item_id) {
                         $family = repo('segment')->getFamilyfromItem($item_id);
                         $seg = jmodel('segment')->find($item_id);
                         $cat = isset($family[1]) ? $family[1] : false;
                         $article['family'] = $family;
                         $article['name'] = $seg->name;
                     } else {
                         $cat = [];
                         $cat['id'] = 0;
                         $cat['name'] = 'autre';
                         $cat['icon'] = 'fa fa-cubes';
                     }
                     if (false !== $cat) {
                         if ($cat['id'] == $category_id) {
                             $cats[$cat['name']] = $cat;
                             $c = isAke($collection, $cat['name'], []);
                             $co = isAke($c, 'offer_' . $offer['id'], $item);
                             $ca = isAke($co, 'articles', []);
                             $article['qty'] = (double) $article['qty'];
                             $article['item_id'] = (int) $article['item_id'];
                             $ca[] = $article;
                             $co['articles'] = $ca;
                             $collection[$cat['name']]['offer_' . $offer['id']] = $co;
                         }
                     }
                 }
             }
         }
     }
     foreach ($offers as $offer) {
         foreach ($collection as $c => $cat) {
             $of = isAke($cat, 'offer_' . $offer['id'], false);
             if (false !== $of) {
                 $cTab = isAke($cats, $c, []);
                 $of['category_name'] = isAke($cTab, 'name', $c);
                 $of['category_icon'] = isAke($cTab, 'icon', '');
                 $of['category_id'] = isAke($cTab, 'id', 0);
                 $a = $this->hasAnswered($offer['id'], $of['category_id'], $reseller_id);
                 if (false === $a) {
                     $of['is_answered'] = false;
                 } else {
                     $of['is_answered'] = true;
                     $of['answerer'] = is_object($a) ? $a->assoc() : [];
                 }
                 $return[] = $of;
             }
         }
     }
     $cache->set($keyData, serialize(Arrays::first($return)));
     $cache->set($keyAge, time());
     return Arrays::first($return);
 }
Ejemplo n.º 25
0
 public static function mime($extension, $default = 'application/octet-stream')
 {
     Config::load('mimes');
     $mimes = null !== config::get('mimes') ? config::get('mimes') : [];
     if (!Arrays::exists($extension, $mimes)) {
         return $default;
     }
     return Arrays::is($mimes[$extension]) ? Arrays::first($mimes[$extension]) : $mimes[$extension];
 }
Ejemplo n.º 26
0
 public static function __callStatic($method, $parameters)
 {
     if (2 == count($parameters)) {
         return static::tag($method, Arrays::first($parameters), Arrays::last($parameters));
     } else {
         if (1 == count($parameters)) {
             return static::tag($method, Arrays::first($parameters));
         } else {
             if (0 == count($parameters)) {
                 return static::tag($method);
             } else {
                 throw new Exception("The method {$method} is not well implemented.");
             }
         }
     }
 }
Ejemplo n.º 27
0
Archivo: gma.php Proyecto: noikiy/inovi
 private function map($structures, $table, $separator = '%%')
 {
     $session = session('upload');
     $data = $session->getCsv();
     if (!strlen($data)) {
         return $this->error("An error occured. Please try again.");
     }
     $rows = explode("\n", $data);
     $first = Arrays::first($rows);
     $html = '<p><h2>Map the fields to structure</h2></p>
         <form action="' . container()->getUrlsite() . 'gma.php?action=importMap&amp;table=' . $table->getId() . '" method="post" name="map" id="map"><input type="hidden" name="separator" id="separator" value="' . $separator . '" />
         ';
     $select = '<select id="field_##key##" name="field_##key##">';
     foreach ($structures as $structure) {
         $label = $structure->getLabel();
         $label = !strlen($label) ? $structure->field()->getName() : $label;
         $select .= '<option value="' . $structure->field()->getName() . '">' . $label . '</option>';
     }
     $select .= '</select>';
     if (!strstr($first, $separator)) {
         return $this->error('An error occured. Plese try again.');
     }
     $words = explode($separator, $first);
     for ($i = 0; $i < count($words); $i++) {
         $word = trim($words[$i]);
         $tmpSelect = repl('##key##', $i, $select);
         $html .= $word . ' => ' . $tmpSelect . '<br />';
     }
     $html .= '<button onclick="$(\'#map\').submit();">OK</button>
             </form>';
     return $html;
 }
Ejemplo n.º 28
0
 public static function __callStatic($method, $args)
 {
     $db = new self();
     if (substr($method, 0, 3) == 'get' && strlen($method) > 3) {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
         $var = Inflector::lower($uncamelizeMethod);
         if (count($args) == 1) {
             $default = Arrays::first($args);
         } else {
             $default = null;
         }
         return $db->get($var, $default);
     } elseif (substr($method, 0, 3) == 'set' && strlen($method) > 3) {
         if (count($args) == 2) {
             $ttl = Arrays::last($args);
         } else {
             $ttl = 0;
         }
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 3)));
         $var = Inflector::lower($uncamelizeMethod);
         return $db->set($var, Arrays::first($args), $ttl);
     } else {
         throw new \BadMethodCallException(__CLASS__ . ' => ' . $func);
     }
 }
Ejemplo n.º 29
0
 public static function mime($file = false)
 {
     $ext = substr(strrchr($file, '.'), 1);
     if (!self::$_MME) {
         if (!file_exists($path = CORE . 'mimes' . EXT)) {
             return false;
         }
         include $path;
         if (!is_array($_MME)) {
             return false;
         }
         self::$_MME = $_MME;
         unset($_MME);
     }
     if (!array_key_exists($ext, self::$_MME)) {
         return false;
     }
     // if the extension has multiple mime types, return the first one.
     if (is_array(self::$_MME[$ext])) {
         return Arrays::first(self::$_MME[$ext]);
     }
     return self::$_MME[$ext];
 }
Ejemplo n.º 30
0
 public function __call($method, $parameters)
 {
     if (substr($method, 0, 6) == 'findBy') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 6)));
         $field = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($parameters);
         return $this->findBy($field, $value);
     } elseif (substr($method, 0, strlen('findObjectsBy')) == 'findObjectsBy') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, strlen('findObjectsBy'))));
         $field = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($parameters);
         return $this->findBy($field, $value, false, true);
     } elseif (substr($method, 0, 9) == 'findOneBy') {
         $uncamelizeMethod = Inflector::uncamelize(lcfirst(substr($method, 9)));
         $field = Inflector::lower($uncamelizeMethod);
         $value = Arrays::first($parameters);
         return $this->findBy($field, $value, true);
     } else {
         $settings = isAke(self::$configs, $this->entity);
         $event = isAke($settings, $method);
         if (!empty($event)) {
             if (is_callable($event)) {
                 if (version_compare(PHP_VERSION, '5.4.0', ">=")) {
                     $event = $event->bindTo($this);
                 }
                 return call_user_func_array($event, $parameters);
             }
         } else {
             throw new Exception("The method '{$method}' is not callable.");
         }
     }
 }