public static function getRoute(Query $config) { // Get the route unserializing the query (if possible) $serializedRoute = json_decode($config->getQuery(), true); if ($serializedRoute !== null) { $params = []; if (isset($serializedRoute['params']) && is_array($serializedRoute['params'])) { // Unserialize models if there are ones foreach ($serializedRoute['params'] as $key => $value) { $params[$key] = ModelFactory::isModel($value) ? ModelFactory::getModel($value) : $value; } } return new Route($serializedRoute['controller'], $serializedRoute['action'], $params); } else { $routes = static::getInstance()->routes; foreach ($routes as $route) { $params = static::urlMatch($route['path'], $config->getQuery()); if ($params !== false) { return new Route($route['definition']['controller'], $route['definition']['action'], $params); } } } return false; }
public function getImHistory(\AlfredSlack\Models\ImModel $im) { return ModelFactory::getModels($this->commander->execute('im.history', ['channel' => $im->getId()])->getBody()['messages'], '\\AlfredSlack\\Models\\MessageModel'); }