Skip to content

Commit

Permalink
Merge pull request mnabialek#6 from mnabialek/changes
Browse files Browse the repository at this point in the history
Changes
  • Loading branch information
mnabialek authored Sep 3, 2017
2 parents 9d65ecf + b9750b6 commit 9de7e67
Show file tree
Hide file tree
Showing 19 changed files with 187 additions and 83 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service_name: travis-ci
114 changes: 93 additions & 21 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,96 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in([__DIR__ . '/src']);
$rules = [
'blank_line_after_opening_tag' => true,
'braces' => true,
'concat_space' => ['spacing' => 'one'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_empty_statement' => true,
'elseif' => true,
'encoding' => true,
'single_blank_line_at_eof' => true,
'no_spaces_after_function_name' => true,
'function_declaration' => true,
'include' => true,
'indentation_type' => true,
'no_alias_functions' => true,
'blank_line_after_namespace' => true,
'line_ending' => true,
'no_trailing_comma_in_list_call' => true,
'not_operator_with_successor_space' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'method_argument_space' => true,
'trailing_comma_in_multiline_array' => true,
'no_multiline_whitespace_before_semicolons' => true,
'single_import_per_statement' => true,
'no_leading_namespace_whitespace' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'no_spaces_inside_parenthesis' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_no_alias_tag' => ['type' => 'var'],
'phpdoc_var_without_name' => true,
'no_leading_import_slash' => true,
'no_extra_consecutive_blank_lines' => ['extra', 'use'],
'blank_line_before_return' => true,
'array_syntax' => ['syntax' => 'short'],
'no_short_echo_tag' => true,
'full_opening_tag' => true,
'no_trailing_comma_in_singleline_array' => true,
'single_blank_line_before_namespace' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'cast_spaces' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'no_trailing_whitespace' => true,
'trim_array_spaces' => true,
'binary_operator_spaces' => ['align_equals' => false, 'align_double_arrow' => false],
'unary_operator_spaces' => true,
'no_unused_imports' => true,
'visibility_required' => true,
'no_whitespace_in_blank_line' => true,
'new_with_braces' => true,
'mb_str_functions' => true,
'class_definition' => true,
'combine_consecutive_unsets' => true,
'dir_constant' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'is_null' => true,
'lowercase_cast' => true,
'method_separation' => true,
'modernize_types_casting' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_useless_else' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'ordered_class_elements' => true,
'phpdoc_no_useless_inheritdoc' => true,
'pow_to_exponentiation' => true,
'psr4' => true,
'short_scalar_cast' => true,
];

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers([
'short_array_syntax',
'duplicate_semicolon',
'return',
'single_quote',
'standardize_not_equal',
'new_with_braces',
'multiline_array_trailing_comma',
'phpdoc_scalar',
'remove_leading_slash_use',
'blankline_after_open_tag',
'single_blank_line_before_namespace',
'trailing_spaces',
'-psr0',
])
->setUsingCache(true)
->finder($finder);
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

return PhpCsFixer\Config::create()
->setRules($rules)
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true);
11 changes: 11 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
preset: laravel

enabled:
- concat_with_spaces

disabled:
- phpdoc_summary
- unary_operator_spaces
- cast_spaces
- concat_without_spaces
- not_operator_with_successor_space
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php
php:
- 7.0
- 7.1

# Commands to be run before your environment runs.
before_script:
- composer self-update
- composer install --no-interaction

script:
- mkdir -p build/logs
- phpunit --coverage-clover build/logs/clover.xml

after_script:
- php vendor/bin/coveralls -v
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"license": "MIT",
"authors": [
{
"name": "mnabialek",
"email": "gitre@nabialek.org"
"name": "Marcin Nabiałek",
"email": "dev@nabialek.org"
}
],
"autoload": {
Expand All @@ -30,6 +30,7 @@
},
"require-dev": {
"phpunit/phpunit": "^5.4",
"mockery/mockery": "^0.9.5"
"mockery/mockery": "^0.9.5",
"friendsofphp/php-cs-fixer": "2.5"
}
}
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Laravel Eloquent Filter
===
#Laravel Eloquent Filter

[![Build Status](https://travis-ci.org/mnabialek/laravel-eloquent-filter.svg?branch=master)](https://travis-ci.org/mnabialek/laravel-eloquent-filter)
[![Coverage Status](https://coveralls.io/repos/github/mnabialek/laravel-eloquent-filter/badge.svg)](https://coveralls.io/github/mnabialek/laravel-eloquent-filter)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mnabialek/laravel-eloquent-filter/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mnabialek/laravel-eloquent-filter/badges/quality-score.png?b=master)
[![StyleCI](https://styleci.io/repos/60950927/shield?style=flat&branch=master)](https://styleci.io/repos/60950927)

This module lets you filter Eloquent data using query filters. You can apply WHERE filters and also set order of results

Expand Down
12 changes: 6 additions & 6 deletions src/Contracts/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@
interface Filter
{
/**
* Get filter field
* Get filter field.
*
* @return string
*/
public function getField();

/**
* Set filter field
* Set filter field.
*
* @param string $field
*/
public function setField($field);

/**
* Get filter operator
* Get filter operator.
*
* @return string
*/
public function getOperator();

/**
* Set filter operator
* Set filter operator.
*
* @param string $operator
*/
public function setOperator($operator);

/**
* Get filter field value
* Get filter field value.
*
* @return mixed
*/
public function getValue();

/**
* Set filter field value
* Set filter field value.
*
* @param mixed $value
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Contracts/InputParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
interface InputParser
{
/**
* Get filters
* Get filters.
*
* @return Collection
*/
public function getFilters();

/**
* Get parameters for sorting
* Get parameters for sorting.
*
* @return Collection
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Contracts/QueryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
interface QueryFilter
{
/**
* Apply all filters (both conditions and sorts) to given query
* Apply all filters (both conditions and sorts) to given query.
*
* @param Builder $query
*
Expand All @@ -16,7 +16,7 @@ interface QueryFilter
public function apply($query);

/**
* Apply condition filters only to given query
* Apply condition filters only to given query.
*
* @param Builder $query
*
Expand All @@ -25,7 +25,7 @@ public function apply($query);
public function applyFilters($query);

/**
* Apply sorting filters only to given query
* Apply sorting filters only to given query.
*
* @param Builder $query
*
Expand Down
8 changes: 4 additions & 4 deletions src/Contracts/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
interface Sort
{
/**
* Set sort field
* Set sort field.
*
* @param string $field
*/
public function setField($field);

/**
* Get sort field
* Get sort field.
*
* @return string
*/
public function getField();

/**
* Set order for field
* Set order for field.
*
* @param string $order
*/
public function setOrder($order);

/**
* Get sort order for field
* Get sort order for field.
*
* @return string
*/
Expand Down
Loading

0 comments on commit 9de7e67

Please sign in to comment.