/** * Portfolio constructor. * @param array $config */ public function __construct(array $config) { Portfolio::$app = $this; $this->config = $config; $this->slim = new \Slim\Slim(['view' => new \Slim\Views\Twig()]); $this->slim->view()->parserOptions = array('debug' => $config['debug'], 'cache' => $config['twig']['cacheDir']); $this->slim->view()->parserExtensions = array(new \Slim\Views\TwigExtension()); $this->slim->view()->setTemplatesDirectory($config['twig']['templatesDir']); $this->client = new \ApiClient\Client($config['vk']); $this->storage = new \Storage\Storage(new \Predis\Client($config['redis'])); $group = $this->storage->getById(new \Model\Group(), -$config['vk']['owner_id']); $this->slim->view()->appendData(['Group' => $group]); $this->slim->view()->appendData(['Meta' => $this->getMetaData($config['meta'])]); }