Пример #1
0
 public function login(Request $request)
 {
     $credentials = $request->only(['email', 'password']);
     $user = $this->authService->loginWithCredentials($credentials);
     $encodedToken = $this->tokenService->requestAccessToken($user);
     $jsonUser = $this->jsonTransformer->item($user, new UserTransformer());
     return $this->respondOk(['user' => $jsonUser, 'token' => $encodedToken->toString()]);
 }
Пример #2
0
 public function scrap()
 {
     // $html = file_get_contents(base_path('resources/views/dse.php'));
     $downloader = new Downloader();
     $parser = new Parser();
     $transformer = new Transformer();
     $html = $downloader->download();
     $data = $parser->parse($html);
     $data = $transformer->transform($data);
     return $data;
 }
Пример #3
0
 /**
  * convert method
  *
  * @param $entity
  * @param array $embeds
  * @return array
  */
 public function transform($entity, array $embeds = [])
 {
     $data = $this->transformer->transform($entity);
     foreach ($embeds as $embed) {
         if (isset($entity->{$embed->name}) && method_exists($this->transformer, $embed->name)) {
             $resource = $this->transformer->{$embed->name}();
             $data[$embed->name] = $resource->transform($entity->{$embed->name}, $embed->children);
         }
     }
     return $data;
 }
Пример #4
0
 public function testTransform()
 {
     $map = array('id' => 'productId', 'name' => 'name', 'price' => 'unitPrice');
     $product = new Fixtures\Product();
     $product->setId('product-1');
     $product->setName('T-Shirt');
     $product->setPrice(44.99);
     $transformer = new Transformer();
     $transformer->setTransformationMap($map);
     $lineItem = $transformer->transform($product, 'Transform\\Fixtures\\LineItem');
     $this->assertEquals($product->getId(), $lineItem->getProductId());
     $this->assertEquals($product->getName(), $lineItem->getName());
     $this->assertEquals($product->getPrice(), $lineItem->getUnitPrice());
 }
Пример #5
0
 public function __construct($value, $sanitize = false)
 {
     if ($sanitize) {
         $value = filter_var($value, FILTER_SANITIZE_URL);
     }
     parent::__construct($value);
 }
Пример #6
0
 /**
  * Tests whether the generateFilename method returns a file according to
  * the right format.
  *
  * @covers phpDocumentor\Transformer\Transformer::generateFilename
  *
  * @return void
  */
 public function testGenerateFilename()
 {
     // separate the directories with the DIRECTORY_SEPARATOR constant to
     // prevent failing tests on windows
     $filename = 'directory' . DIRECTORY_SEPARATOR . 'directory2' . DIRECTORY_SEPARATOR . 'file.php';
     $this->assertEquals('directory.directory2.file.html', $this->fixture->generateFilename($filename));
 }
Пример #7
0
 /**
  * transformOnce method
  *
  * @param mixed $input
  * @param array $embeds
  * @return array
  */
 protected function transformOnce($input, array $embeds = [])
 {
     if ($this->transformer === null) {
         $this->transformer = $this->provider->willTransform($input)->get();
     }
     return $this->transformer->transform($input, $embeds);
 }
Пример #8
0
 public function getEntityWithLowerPosition(Page $movedEntity)
 {
     $criteria = new SelectCriteria($this->getDomain());
     $criteria->setCriteria(Criterion::_gt($this->getDomain(), "position", $movedEntity->getPosition()));
     $criteria->addTransformer(Transformer::_limit(1));
     $criteria->addTransformer(Transformer::_orderBy($this->getDomain(), "position", false));
     return $criteria->toUnique();
 }
Пример #9
0
function process($tag)
{
    global $dir;
    if (!file_exists($dir . $tag)) {
        return false;
    }
    $file = $dir . $tag;
    $handle = fopen($file, "r");
    $tokenstream = (new Tokenizer($handle))->tokenize();
    $parser = new Parser();
    $parser->parse($tokenstream);
    global $tree;
    $xml = $tree->toXML($file);
    $info = pathinfo($file);
    $xmlFile = $info["dirname"] . "/" . $info["filename"] . ".xml";
    $transformer = new Transformer($xmlFile);
    echo $transformer->transform();
}
Пример #10
0
 public function __construct($value, $padValue, $padAmount, $padType)
 {
     parent::__construct($value);
     if ($padType != STR_PAD_RIGHT && $padType != STR_PAD_LEFT && $padType != STR_PAD_BOTH) {
         throw new \InvalidArgumentException("Invalid pad side option");
     }
     $this->padValue = $padValue;
     $this->padType = $padType;
     $this->padAmount = $padAmount;
 }
Пример #11
0
 public function getEntityWithLowerPosition(PageComponent $movedEntity)
 {
     $criteria = new SelectCriteria($this->getDomain());
     $positionCriteria = Criterion::_gt($this->getDomain(), "position", $movedEntity->getPosition());
     $columnCriteria = Criterion::_eq($this->getDomain(), "pageColumnId", $movedEntity->getPageColumnId());
     $criteria->setCriteria(Criterion::_and($positionCriteria, $columnCriteria));
     $criteria->addTransformer(Transformer::_limit(1));
     $criteria->addTransformer(Transformer::_orderBy($this->getDomain(), "position", false));
     return $criteria->toUnique();
 }
Пример #12
0
 public function __construct($value, $appendValue)
 {
     parent::__construct($value);
     $this->appendValue = $appendValue;
     $this->setPreAppend(false);
 }
 public function __construct($parent = null)
 {
     parent::__construct($parent, "string_to_float");
 }
Пример #14
0
# page data
$page_obj->add("script", $_SERVER["SCRIPT_NAME"]);
$page_obj->add("lang", $lang);
$page_obj->add("order", $order);
$page_obj->add("ordertype", $ordertype);
if ($scroll) {
    $page_obj->add("scroll", $scroll);
}
if ($httpParam->cmd()) {
    $page_obj->add("cmd", $httpParam->cmd());
}
# authentivication data
if (isset($_SESSION["logged"])) {
    $page_obj->add("auth", $_SESSION["logged"]);
    $page_obj->add("user", $_SESSION["user"]);
}
# page call id
if ($httpParam->id()) {
    $page_obj->add("id", $httpParam->id());
    $page_obj->add_parameter(["id" => $httpParam->id()]);
}
# timeout parameters
if (isset($_timeout)) {
    $page_obj->add("timeout", $_timeout["time"]);
    $page_obj->add("timeoutpage", $_timeout["page"]);
}
// get parameters for transformation
$param = $page_obj->getarray();
//  debug($param);
$output = new Transformer($xml, "page/" . $page . "/" . $skin . ".xslt", $param);
echo $output->data();
Пример #15
0
 public function __construct($value, $delimiter)
 {
     parent::__construct($value);
     $this->delimiter = $delimiter;
 }
Пример #16
0
 public function transform($object)
 {
     $seedData = parent::transform($object);
     $seedData['key'] = $object->id;
     return $seedData;
 }
Пример #17
0
 public function __construct($parent = null, $separator = "-", $position = 1)
 {
     parent::__construct($parent, "tokenize", array($separator, $position));
 }
Пример #18
0
 public function __construct($value, $suffix)
 {
     parent::__construct($value);
     $this->suffix = $suffix;
 }
Пример #19
0
 public function __construct($value, $needle)
 {
     parent::__construct($value);
     $this->needle = $needle;
 }
Пример #20
0
 public function __construct($value, $allowableTags = '')
 {
     parent::__construct($value);
     $this->allowableTags = $allowableTags;
 }
 public function __construct($parent = null)
 {
     parent::__construct($parent, "float_to_string");
 }
Пример #22
0
 public function __construct($parent = null)
 {
     parent::__construct($parent, "urldecode");
 }
Пример #23
0
 public function __construct($value, $start, $length = null)
 {
     parent::__construct($value);
     $this->start = $start;
     $this->length = $length;
 }
Пример #24
0
 /**
  * Constructor.
  *
  * @param array $attributes [optional]
  */
 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
 }
Пример #25
0
 public function __construct($value, $decode = false)
 {
     parent::__construct($value);
     $this->decode = $decode;
 }
Пример #26
0
 public function getConfirmedCompanies($page, $rowCount)
 {
     $criteria = $this->getCompaniesWithStatusCriteria(2);
     $criteria->addTransformer(Transformer::_limit($page * $rowCount, $rowCount));
     return $criteria->toArray();
 }
Пример #27
0
 public function __construct($parent = null)
 {
     parent::__construct($parent, "to_upper");
 }
Пример #28
0
 public function __construct($value, $left, $right)
 {
     parent::__construct($value);
     $this->left = $left;
     $this->right = $right;
 }
Пример #29
0
 public function __construct($value)
 {
     parent::__construct($value);
 }
Пример #30
0
 public function __construct($value, $prefix)
 {
     parent::__construct($value);
     $this->prefix = $prefix;
 }