Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Aug 5, 2019
2 parents bb4d132 + 85ba5f4 commit 90ba4e9
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 358 deletions.
2 changes: 1 addition & 1 deletion src/Tqdev/PhpCrudUi/Client/CrudApi.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Client;

class CrudApi
Expand Down Expand Up @@ -59,5 +60,4 @@ private function call(string $method, string $path, array $args = [], $data = fa
curl_close($ch);
return json_decode($response, true);
}

}
3 changes: 1 addition & 2 deletions src/Tqdev/PhpCrudUi/Column/SpecificationService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Column;

use Tqdev\PhpCrudUi\Client\CrudApi;
Expand Down Expand Up @@ -114,7 +115,6 @@ private function getDisplayColumn($columns)
if (in_array($name, $columns)) {
return $name;
}

}
return $columns[0];
}
Expand Down Expand Up @@ -157,5 +157,4 @@ public function referenceId(string $table, /* object */ $record)
$primaryKey = $this->getPrimaryKey($table, 'read');
return $record[$primaryKey];
}

}
1 change: 1 addition & 0 deletions src/Tqdev/PhpCrudUi/Config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi;

class Config
Expand Down
2 changes: 1 addition & 1 deletion src/Tqdev/PhpCrudUi/Controller/CrudController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Controller;

use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -141,5 +142,4 @@ public function _list(ServerRequestInterface $request): ResponseInterface
$result = $this->service->_list($table, $action, $field, $id, $name, $params);
return $this->responder->success($result);
}

}
2 changes: 1 addition & 1 deletion src/Tqdev/PhpCrudUi/Controller/TemplateResponder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Controller;

use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -41,5 +42,4 @@ public function success($result): ResponseInterface
$result->setTemplatePath($this->templatePath);
return ResponseFactory::fromHtml(ResponseFactory::OK, $result);
}

}
33 changes: 24 additions & 9 deletions src/Tqdev/PhpCrudUi/Document/TemplateDocument.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Document;

use Tqdev\PhpCrudUi\Template\Template;
Expand All @@ -16,20 +17,34 @@ public function __construct(string $masterTemplate, string $contentTemplate, arr
$this->masterTemplate = $masterTemplate;
$this->contentTemplate = $contentTemplate;
$this->variables = $variables;
$this->template = new Template('html',$this->getFunctions());
$this->template = new Template('html', $this->getFunctions());
$this->templatePath = '';
}

private function getFunctions(): array
{
return array(
'lt' => function ($a, $b) {return $a < $b;},
'gt' => function ($a, $b) {return $a > $b;},
'le' => function ($a, $b) {return $a <= $b;},
'ge' => function ($a, $b) {return $a >= $b;},
'eq' => function ($a, $b) {return $a == $b;},
'add' => function ($a, $b) {return $a + $b;},
'sub' => function ($a, $b) {return $a - $b;},
'lt' => function ($a, $b) {
return $a < $b;
},
'gt' => function ($a, $b) {
return $a > $b;
},
'le' => function ($a, $b) {
return $a <= $b;
},
'ge' => function ($a, $b) {
return $a >= $b;
},
'eq' => function ($a, $b) {
return $a == $b;
},
'add' => function ($a, $b) {
return $a + $b;
},
'sub' => function ($a, $b) {
return $a - $b;
},
);
}

Expand All @@ -40,7 +55,7 @@ public function addVariables(array $variables)/*: void*/

public function setTemplatePath(string $path)/*: void*/
{
$this->templatePath = rtrim($path,'/');
$this->templatePath = rtrim($path, '/');
}

private function getHtmlFileContents(string $template): string
Expand Down
3 changes: 2 additions & 1 deletion src/Tqdev/PhpCrudUi/Record/CrudService.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Record;

use Tqdev\PhpCrudUi\Client\CrudApi;
Expand Down Expand Up @@ -227,7 +228,7 @@ public function _list(string $table, string $action, string $field, string $id,
}

$maxPage = ceil($data['results'] / $pageSize);

$variables = array(
'table' => $table,
'action' => $action,
Expand Down
16 changes: 8 additions & 8 deletions src/Tqdev/PhpCrudUi/Template/Template.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Template;

class Template
Expand Down Expand Up @@ -142,7 +143,7 @@ private function createSyntaxTree(array $tokens)/*: object*/
return $root;
}

private function renderChildren(/*object*/ $node, array $data): string
private function renderChildren(/*object*/$node, array $data): string
{
$result = '';
$ifNodes = array();
Expand Down Expand Up @@ -177,7 +178,7 @@ private function renderChildren(/*object*/ $node, array $data): string
return $result;
}

private function renderIfNode(/*object*/ $node, array $data): string
private function renderIfNode(/*object*/$node, array $data): string
{
$parts = $this->explode('|', $node->expression);
$path = array_shift($parts);
Expand All @@ -195,7 +196,7 @@ private function renderIfNode(/*object*/ $node, array $data): string
return $result;
}

private function renderElseIfNode(/*object*/ $node, array $ifNodes, array $data): string
private function renderElseIfNode(/*object*/$node, array $ifNodes, array $data): string
{
if (count($ifNodes) < 1 || $ifNodes[0]->type != 'if') {
return $this->escape("{{elseif!!could not find matching `if`}}");
Expand All @@ -222,7 +223,7 @@ private function renderElseIfNode(/*object*/ $node, array $ifNodes, array $data)
return $result;
}

private function renderElseNode(/*object*/ $node, array $ifNodes, array $data): string
private function renderElseNode(/*object*/$node, array $ifNodes, array $data): string
{
if (count($ifNodes) < 1 || $ifNodes[0]->type != 'if') {
return $this->escape("{{else!!could not find matching `if`}}");
Expand All @@ -238,7 +239,7 @@ private function renderElseNode(/*object*/ $node, array $ifNodes, array $data):
return $result;
}

private function renderForNode(/*object*/ $node, array $data): string
private function renderForNode(/*object*/$node, array $data): string
{
$parts = $this->explode('|', $node->expression);
$pathParts = $this->explode(':', array_shift($parts), 3);
Expand Down Expand Up @@ -267,7 +268,7 @@ private function renderForNode(/*object*/ $node, array $data): string
return $result;
}

private function renderVarNode(/*object*/ $node, array $data): string
private function renderVarNode(/*object*/$node, array $data): string
{
$parts = $this->explode('|', $node->expression);
$path = array_shift($parts);
Expand Down Expand Up @@ -295,7 +296,7 @@ private function resolvePath(string $path, array $data)/*: object*/
return $current;
}

private function applyFunctions(/*object*/ $value, array $parts, array $data)/*: object*/
private function applyFunctions(/*object*/$value, array $parts, array $data)/*: object*/
{
foreach ($parts as $part) {
$function = $this->explode('(', rtrim($part, ')'), 2);
Expand All @@ -320,5 +321,4 @@ private function applyFunctions(/*object*/ $value, array $parts, array $data)/*:
}
return $value;
}

}
1 change: 1 addition & 0 deletions src/Tqdev/PhpCrudUi/Template/TemplateString.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi\Template;

class TemplateString
Expand Down
1 change: 1 addition & 0 deletions src/Tqdev/PhpCrudUi/Ui.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Tqdev\PhpCrudUi;

use Psr\Http\Message\ResponseInterface;
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ext-memcached": "*",
"ext-redis": "*"
},
"time": "2019-07-28T18:20:24+00:00",
"time": "2019-07-23T12:13:57+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down
Loading

0 comments on commit 90ba4e9

Please sign in to comment.