LaravelRUS /
SleepingOwlAdmin
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SleepingOwl\Admin\Display; |
||
| 4 | |||
| 5 | use Illuminate\Contracts\Support\Renderable; |
||
| 6 | use Illuminate\Database\Eloquent\Builder; |
||
| 7 | use Illuminate\Support\Collection; |
||
| 8 | use SleepingOwl\Admin\Contracts\Display\DisplayExtensionInterface; |
||
| 9 | use SleepingOwl\Admin\Contracts\Display\Placable; |
||
| 10 | use SleepingOwl\Admin\Contracts\Initializable; |
||
| 11 | |||
| 12 | class ExtensionCollection extends Collection |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @return static |
||
| 16 | */ |
||
| 17 | public function placable() |
||
| 18 | { |
||
| 19 | return $this->filter(function (DisplayExtensionInterface $extension) { |
||
| 20 | return $extension instanceof Placable; |
||
| 21 | }); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | public function placableBlocks() |
||
| 28 | { |
||
| 29 | $blocks = []; |
||
| 30 | |||
| 31 | foreach ($this->placable() as $extension) { |
||
| 32 | $blocks[$extension->getPlacement()][] = app('sleeping_owl.template')->view( |
||
|
0 ignored issues
–
show
|
|||
| 33 | $extension->getView(), |
||
| 34 | $extension->toArray() |
||
| 35 | )->render(); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $blocks; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return static |
||
| 43 | */ |
||
| 44 | public function renderable() |
||
| 45 | { |
||
| 46 | return $this->filter(function (DisplayExtensionInterface $extension) { |
||
| 47 | return $extension instanceof Renderable; |
||
| 48 | }); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return static |
||
| 53 | */ |
||
| 54 | public function sortByOrder() |
||
| 55 | { |
||
| 56 | return $this->sortBy(function (DisplayExtensionInterface $extension) { |
||
| 57 | return $extension->getOrder(); |
||
| 58 | }); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return $this |
||
| 63 | */ |
||
| 64 | public function initialize() |
||
| 65 | { |
||
| 66 | $this->each(function (DisplayExtensionInterface $extension) { |
||
| 67 | if ($extension instanceof Initializable) { |
||
| 68 | $extension->initialize(); |
||
| 69 | } |
||
| 70 | }); |
||
| 71 | |||
| 72 | return $this; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
| 77 | * @return $this |
||
| 78 | */ |
||
| 79 | public function modifyQuery(Builder $query) |
||
| 80 | { |
||
| 81 | $this->each(function (DisplayExtensionInterface $extension) use ($query) { |
||
| 82 | $extension->modifyQuery($query); |
||
| 83 | }); |
||
| 84 | |||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | } |
||
| 88 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.