Esempio n. 1
0
 /**
  * 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'])]);
 }
Esempio n. 2
0
<?php

ini_set("display_errors", 1);
error_reporting(E_ALL);
require_once "vendor/autoload.php";
\Storage\Storage::setConfig(array('nesting' => 4, 'step' => 4, 'path' => '{path-to-storage-directory}', 'url' => '{url-to-saved-files}'));
$storage = new Storage\Storage();
$storage->setSerializers(array(new Storage\Serializer\Php(), new \Storage\Serializer\Base64()));
$id = $storage->save(array('param1' => 'value1', 'param2' => 'value2'));
var_dump($storage->get($id));
$storage->delete($id);
Esempio n. 3
0
 public function testSetSeparatorMethod()
 {
     $separator = '.';
     Storage::setSeparator($separator);
     $this->assertEquals($separator, Storage::$separator, 'Separator set was failed');
 }
Esempio n. 4
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'vendor/autoload.php';
\Storage\Storage::setConfig(['uri' => 'http://storage.loc']);
\Storage\Storage::setToken('{token}');
$storage = new \Storage\Storage();
$res = $storage->upload('files', \Storage\Storage::FILES);
var_dump($res);
$info = $storage->getInfo($res[0]->getIdentity());
var_dump($info);
$list = $storage->getList(0, 10);
var_dump($list);
$searchResults = $storage->search('search string', 0, 10);
var_dump($searchResults);
$isDeleted = $storage->delete($searchResults[1]->getIdentity());
var_dump($isDeleted);