Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Released fourlabs/qbjs-parser v1.0.0 #10

Merged
merged 2 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Model/Builder/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getClassName(): string
*
* @return Builder
*/
public function setClassName(string $className): Builder
public function setClassName(string $className): self
{
if (!class_exists($className)) {
throw new \InvalidArgumentException(sprintf(
Expand All @@ -75,7 +75,7 @@ public function getJsonString(): string
*
* @return Builder
*/
public function setJsonString(string $jsonString): Builder
public function setJsonString(string $jsonString): self
{
$this->jsonString = $jsonString;

Expand All @@ -95,7 +95,7 @@ public function getHumanReadableName(): string
*
* @return Builder
*/
public function setHumanReadableName(string $humanReadableName): Builder
public function setHumanReadableName(string $humanReadableName): self
{
$this->humanReadableName = $humanReadableName;

Expand All @@ -115,7 +115,7 @@ public function getBuilderId(): string
*
* @return Builder
*/
public function setBuilderId(string $builderId): Builder
public function setBuilderId(string $builderId): self
{
$this->builderId = $builderId;

Expand All @@ -135,7 +135,7 @@ public function getResultColumns(): \SplObjectStorage
*
* @return Builder
*/
public function addResultColumn(ResultColumn $resultColumn): Builder
public function addResultColumn(ResultColumn $resultColumn): self
{
// prevent columns with the same machine_name or human_readable_name to be added
foreach ($this->resultColumns as $column) {
Expand All @@ -157,7 +157,7 @@ public function addResultColumn(ResultColumn $resultColumn): Builder
*
* @return Builder
*/
public function removeResultColumn(ResultColumn $resultColumn): Builder
public function removeResultColumn(ResultColumn $resultColumn): self
{
$this->resultColumns->detach($resultColumn);

Expand Down
6 changes: 5 additions & 1 deletion Model/Filter/FilterInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
class FilterInput
{
const INPUT_TYPE_TEXT = 'text';

const INPUT_TYPE_TEXTAREA = 'textarea';

const INPUT_TYPE_RADIO = 'radio';

const INPUT_TYPE_CHECKBOX = 'checkbox';

const INPUT_TYPE_SELECT = 'select';

const VALID_INPUT_TYPES = [
Expand Down Expand Up @@ -52,7 +56,7 @@ public function getInputType(): string
*
* @return FilterInput
*/
public function setInputType(string $inputType): FilterInput
public function setInputType(string $inputType): self
{
$this->inputType = $inputType;
$this->validate();
Expand Down
10 changes: 5 additions & 5 deletions Model/Filter/FilterOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getOperators(): array
*
* @throws \InvalidArgumentException
*/
public function setOperators(array $operators): FilterOperators
public function setOperators(array $operators): self
{
foreach ($operators as $operator) {
$this->validateOperator($operator);
Expand All @@ -48,7 +48,7 @@ public function setOperators(array $operators): FilterOperators
*
* @throws \InvalidArgumentException
*/
public function addOperator(string $operator): FilterOperators
public function addOperator(string $operator): self
{
$this->validateOperator($operator);
if (!in_array($operator, $this->operators)) {
Expand All @@ -65,10 +65,10 @@ public function addOperator(string $operator): FilterOperators
*
* @throws \InvalidArgumentException
*/
public function removeOperator(string $operator): FilterOperators
public function removeOperator(string $operator): self
{
$this->validateOperator($operator);
if (($key = array_search($operator, $this->operators)) !== false) {
if (false !== ($key = array_search($operator, $this->operators))) {
unset($this->operators[$key]);
}

Expand All @@ -78,7 +78,7 @@ public function removeOperator(string $operator): FilterOperators
/**
* @return FilterOperators
*/
public function clearOperators(): FilterOperators
public function clearOperators(): self
{
$this->operators = [];

Expand Down
11 changes: 9 additions & 2 deletions Service/JavascriptBuilders.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private function filtersDefaultOperators(array $filters): array
'equal', 'not_equal', 'is_null', 'is_not_null',
'begins_with', 'not_begins_with', 'contains', 'not_contains', 'ends_with', 'not_ends_with', 'is_empty', 'is_not_empty', // specific to strings
];

break;
case 'integer':
case 'double':
Expand All @@ -94,11 +95,13 @@ private function filtersDefaultOperators(array $filters): array
'equal', 'not_equal', 'is_null', 'is_not_null',
'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between', 'not_between', // specific to numbers and dates
];

break;
case 'boolean':
$filter['operators'] = [
'equal', 'not_equal', 'is_null', 'is_not_null',
];

break;
}
}
Expand Down Expand Up @@ -162,6 +165,7 @@ private function filtersBooleanOverride(array $filters): array
1 => 'success',
0 => 'danger',
];

break;
}

Expand Down Expand Up @@ -193,6 +197,7 @@ private function filtersDateOverrides(array $filters): array
$filter['plugin_config'] = [
'format' => 'YYYY/MM/DD',
];

break;
case 'datetime':
$filter['validation'] = [
Expand All @@ -202,6 +207,7 @@ private function filtersDateOverrides(array $filters): array
$filter['plugin_config'] = [
'format' => 'YYYY/MM/DD HH:mm',
];

break;
case 'time':
$filter['validation'] = [
Expand All @@ -211,6 +217,7 @@ private function filtersDateOverrides(array $filters): array
$filter['plugin_config'] = [
'format' => 'HH:mm',
];

break;
}

Expand Down Expand Up @@ -249,7 +256,7 @@ private function validateValueCollectionAgainstInput(FilterValueCollection $coll
{
if (
in_array($input->getInputType(), FilterInput::INPUT_TYPES_REQUIRE_NO_VALUES) &&
$collection->getFilterValues()->count() !== 0
0 !== $collection->getFilterValues()->count()
) {
throw new \LogicException(sprintf(
'Too many values found, While building, Builder with ID %s and Filter with ID %s.',
Expand All @@ -259,7 +266,7 @@ private function validateValueCollectionAgainstInput(FilterValueCollection $coll
}
if (
in_array($input->getInputType(), FilterInput::INPUT_TYPES_REQUIRE_MULTIPLE_VALUES) &&
$collection->getFilterValues()->count() === 0
0 === $collection->getFilterValues()->count()
) {
throw new \LogicException(sprintf(
'Not enough values found, While building, Builder with ID %s and Filter with ID %s.',
Expand Down
2 changes: 1 addition & 1 deletion Util/Validator/BuildersToMappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ final private static function validateClassHasProperty(string $className, string
$propertyInfo = new PropertyInfoExtractor([new ReflectionExtractor()]);
$properties = $propertyInfo->getProperties($className);

if (strpos($classProperty, '.') === false) { // not yet checking associations - Property Accessor can't do this
if (false === strpos($classProperty, '.')) { // not yet checking associations - Property Accessor can't do this
if (!in_array($classProperty, $properties)) {
throw new \InvalidArgumentException(
sprintf(
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
"homepage": "https://fourlabs.co.uk/"
}
],
"minimum-stability": "dev",
"require": {
"php": "^7.0",
"fourlabs/qbjs-parser": "dev-master",
"fourlabs/qbjs-parser": "1.0.0",
"symfony/config": "~2.8|~3.0|~3.1",
"symfony/dependency-injection": "~2.8|~3.0|~3.1",
"symfony/http-kernel": "~2.8|~3.0|~3.1",
Expand Down