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()]); }
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; }
/** * 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; }
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()); }
public function __construct($value, $sanitize = false) { if ($sanitize) { $value = filter_var($value, FILTER_SANITIZE_URL); } parent::__construct($value); }
/** * 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)); }
/** * 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); }
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(); }
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(); }
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; }
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(); }
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"); }
# 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();
public function __construct($value, $delimiter) { parent::__construct($value); $this->delimiter = $delimiter; }
public function transform($object) { $seedData = parent::transform($object); $seedData['key'] = $object->id; return $seedData; }
public function __construct($parent = null, $separator = "-", $position = 1) { parent::__construct($parent, "tokenize", array($separator, $position)); }
public function __construct($value, $suffix) { parent::__construct($value); $this->suffix = $suffix; }
public function __construct($value, $needle) { parent::__construct($value); $this->needle = $needle; }
public function __construct($value, $allowableTags = '') { parent::__construct($value); $this->allowableTags = $allowableTags; }
public function __construct($parent = null) { parent::__construct($parent, "float_to_string"); }
public function __construct($parent = null) { parent::__construct($parent, "urldecode"); }
public function __construct($value, $start, $length = null) { parent::__construct($value); $this->start = $start; $this->length = $length; }
/** * Constructor. * * @param array $attributes [optional] */ public function __construct(array $attributes = []) { parent::__construct($attributes); }
public function __construct($value, $decode = false) { parent::__construct($value); $this->decode = $decode; }
public function getConfirmedCompanies($page, $rowCount) { $criteria = $this->getCompaniesWithStatusCriteria(2); $criteria->addTransformer(Transformer::_limit($page * $rowCount, $rowCount)); return $criteria->toArray(); }
public function __construct($parent = null) { parent::__construct($parent, "to_upper"); }
public function __construct($value, $left, $right) { parent::__construct($value); $this->left = $left; $this->right = $right; }
public function __construct($value) { parent::__construct($value); }
public function __construct($value, $prefix) { parent::__construct($value); $this->prefix = $prefix; }