Completed
Branch master (f1d822)
by tac
03:30 queued 01:02
created

daydream.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 5 and the first side effect is on line 71.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
use Tacone\Bees\Test\Customer;
4
5
class Customers
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    public function anyIndex()
8
    {
9
        $collection = new EndpointCollection(new Customer());
10
        $collection->string('name', 'first_name');
11
        $collection->boolean('published', true);
12
        $collection->dateTime('updated', 'Last update');
13
14
        return $collection;
15
    }
16
17 View Code Duplication
    public function anyEdit()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        $endpoint = new Endpoint(new Customer());
20
        $endpoint->string('name', 'first_name');
21
        $endpoint->boolean('published');
22
        $endpoint->optional->dateTime('updated', 'Last update');
23
24
        return $endpoint;
25
    }
26
27
    public function anyOneMethod()
28
    {
29
        $collection = new Endpoint(new Customer());
30
        $collection->string('name', 'first_name');
31
        $collection->boolean('published', true);
32
        $collection->dateTime('updated', 'Last update');
33
34
        $endpoint = new Endpoint(new Customer());
35
        $endpoint->string('name', 'first_name');
36
        $endpoint->boolean('published');
37
        $endpoint->dateTime('updated', 'Last update');
38
39
        return $collection->and($endpoint);
40
    }
41
42
    public function anyProxy()
43
    {
44
    }
45
}
46
47
class UsersController extends ResourceController
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
48
{
49 View Code Duplication
    public function getResource()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        $endpoint = new Endpoint(new Customer());
52
        $endpoint->string('name', 'first_name');
53
        $endpoint->boolean('published');
54
        $endpoint->dateTime('updated', 'Last update');
55
56
        return $endpoint;
57
    }
58
59 View Code Duplication
    public function getResourcesCollection()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
    {
61
        $collection = new Endpoint(new Customer());
62
        $collection->string('name', 'first_name');
63
        $collection->boolean('published', true);
64
        $collection->dateTime('updated', 'Last update');
65
66
        return $collection;
67
    }
68
}
69
70
// add field
71
$e->string('name', 'user_name', $sortable)
72
    ->rules('required|min:4', function ($field) {
73
        return 'custom error string for field '.$field->name();
74
    })
75
    ->options(['enum', 'of', 'choices']);
76
77
// terminators
78
$e->errors();
79
$e->output($array);
80
81
// field types
82
$e->string('name');
83
$e->integer('age');
84
$e->float('age');
85
$e->object('location');
86
87
// field API
88
$newValue = 1;
89
$field = f();
90
91
$field->value();
92
$field->value($newValue);
93
$field->onValue(function () {
94
});
95
$field->onGetValue(function () {
96
});
97