Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Oct 12, 2023
1 parent 3b9546d commit e8d8e20
Show file tree
Hide file tree
Showing 193 changed files with 778 additions and 759 deletions.
2 changes: 0 additions & 2 deletions demo/app/Sharp/Posts/PostList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
use Code16\Sharp\EntityList\Fields\EntityListField;
use Code16\Sharp\EntityList\Fields\EntityListFieldsContainer;
use Code16\Sharp\EntityList\SharpEntityList;
use Code16\Sharp\Enums\PageAlertLevel;
use Code16\Sharp\Utils\Links\LinkToEntityList;
use Code16\Sharp\Utils\PageAlerts\PageAlert;
use Code16\Sharp\Utils\Transformers\Attributes\Eloquent\SharpUploadModelThumbnailUrlTransformer;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Pagination\Paginator;

class PostList extends SharpEntityList
{
Expand Down
8 changes: 4 additions & 4 deletions demo/config/sharp.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
],
'forgotten_password' => [
'enabled' => true,
// 'password_broker' => null,
// 'remember_token_attribute' => 'remember_token',
// 'reset_password_callback' => null,
// 'password_broker' => null,
// 'remember_token_attribute' => 'remember_token',
// 'reset_password_callback' => null,
],
'display_attribute' => 'name',
// "check_handler" => \App\Sharp\Auth\MySharpCheckHandler::class,
// "check_handler" => \App\Sharp\Auth\MySharpCheckHandler::class,
],

'theme' => [
Expand Down
1 change: 0 additions & 1 deletion src/Dashboard/SharpDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Code16\Sharp\Utils\Filters\HandleFilters;
use Code16\Sharp\Utils\Traits\HandlePageAlertMessage;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;

abstract class SharpDashboard
{
Expand Down
1 change: 0 additions & 1 deletion src/Data/BreadcrumbData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data;


final class BreadcrumbData extends Data
{
public function __construct(
Expand Down
1 change: 0 additions & 1 deletion src/Data/BreadcrumbItemData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data;


final class BreadcrumbItemData extends Data
{
public function __construct(
Expand Down
1 change: 0 additions & 1 deletion src/Data/Commands/CommandData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\CommandType;
use Code16\Sharp\Enums\InstanceSelectionMode;
use Spatie\TypeScriptTransformer\Attributes\Optional;

final class CommandData extends Data
{
Expand Down
3 changes: 0 additions & 3 deletions src/Data/Commands/CommandFormData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

namespace Code16\Sharp\Data\Commands;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;
use Code16\Sharp\Data\Form\Fields\FormFieldData;
use Code16\Sharp\Data\Form\FormConfigData;
use Code16\Sharp\Data\Form\FormLayoutData;
use Code16\Sharp\Data\InstanceAuthorizationsData;
use Code16\Sharp\Data\PageAlertData;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;

Expand Down
4 changes: 0 additions & 4 deletions src/Data/Commands/CommandReturnData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\CommandAction;
use Code16\Sharp\Enums\FilterType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
use Spatie\TypeScriptTransformer\Attributes\TypeScript;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Types\StructType;

// download & streamDownload actions returns the file directly in the response
#[LiteralTypeScriptType(
Expand Down
4 changes: 0 additions & 4 deletions src/Data/Commands/ConfigCommandsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

namespace Code16\Sharp\Data\Commands;


use Code16\Sharp\Data\Dashboard\DashboardConfigData;
use Code16\Sharp\Data\Dashboard\Widgets\WidgetData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;
use Code16\Sharp\Enums\CommandType;
use Spatie\TypeScriptTransformer\Attributes\RecordTypeScriptType;

Expand Down
2 changes: 0 additions & 2 deletions src/Data/Dashboard/DashboardConfigData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Code16\Sharp\Data\Dashboard;


use Code16\Sharp\Data\Commands\ConfigCommandsData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\Filters\ConfigFiltersData;
use Spatie\TypeScriptTransformer\Attributes\Optional;

final class DashboardConfigData extends Data
{
Expand Down
1 change: 0 additions & 1 deletion src/Data/Dashboard/DashboardData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;
use Code16\Sharp\Data\PageAlertData;
use Spatie\TypeScriptTransformer\Attributes\Optional;

final class DashboardData extends Data
{
Expand Down
2 changes: 0 additions & 2 deletions src/Data/Dashboard/DashboardLayoutData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Code16\Sharp\Data\Dashboard;


use Code16\Sharp\Data\Dashboard\Widgets\WidgetData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;

Expand Down
6 changes: 2 additions & 4 deletions src/Data/Dashboard/DashboardLayoutSectionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Code16\Sharp\Data\Dashboard;


use Code16\Sharp\Data\Dashboard\Widgets\WidgetData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;

Expand All @@ -22,8 +20,8 @@ public static function from(array $section): self
$section = [
...$section,
'rows' => collect($section['rows'] ?? [])
->map(function(array $row) {
return collect($row)->map(function(array $widget) {
->map(function (array $row) {
return collect($row)->map(function (array $widget) {
return DashboardLayoutWidgetData::from($widget);
});
})
Expand Down
3 changes: 0 additions & 3 deletions src/Data/Dashboard/DashboardLayoutWidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

namespace Code16\Sharp\Data\Dashboard;


use Code16\Sharp\Data\Dashboard\Widgets\WidgetData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;

final class DashboardLayoutWidgetData extends Data
{
Expand Down
3 changes: 0 additions & 3 deletions src/Data/Dashboard/Widgets/FigureWidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

namespace Code16\Sharp\Data\Dashboard\Widgets;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
use Spatie\TypeScriptTransformer\Attributes\TypeScriptType;


final class FigureWidgetData extends Data
{
#[Optional]
Expand Down
4 changes: 1 addition & 3 deletions src/Data/Dashboard/Widgets/GraphWidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

namespace Code16\Sharp\Data\Dashboard\Widgets;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
use Spatie\TypeScriptTransformer\Attributes\TypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Types\RecordType;

final class GraphWidgetData extends Data
{
Expand Down
2 changes: 0 additions & 2 deletions src/Data/Dashboard/Widgets/OrderedListWidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Code16\Sharp\Data\Dashboard\Widgets;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
Expand Down
2 changes: 0 additions & 2 deletions src/Data/Dashboard/Widgets/PanelWidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Code16\Sharp\Data\Dashboard\Widgets;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
Expand Down
5 changes: 2 additions & 3 deletions src/Data/Dashboard/Widgets/WidgetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Code16\Sharp\Data\Dashboard\Widgets;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\TypeScriptType;

Expand All @@ -16,7 +14,8 @@
)]
final class WidgetData extends Data
{
public function __construct() {
public function __construct()
{
}

public static function from(array $widget): Data
Expand Down
16 changes: 7 additions & 9 deletions src/Data/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
namespace Code16\Sharp\Data;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use JsonSerializable;
use ReflectionClass;
use ReflectionParameter;
use ReflectionProperty;
use Spatie\TypeScriptTransformer\Attributes\Optional;
use function Pest\Laravel\json;

abstract class Data implements Arrayable
{
Expand All @@ -21,19 +16,21 @@ public static function collection($payload): DataCollection
{
return DataCollection::make($payload)
->map(function ($item) {
if(is_array($item)) {
if(method_exists(static::class, 'from')) {
if (is_array($item)) {
if (method_exists(static::class, 'from')) {
return static::from($item);
}

return new static(...$item);
}

return $item;
});
}

public static function optional(mixed $payload): ?static
{
if(is_null($payload)) {
if (is_null($payload)) {
return null;
}

Expand Down Expand Up @@ -82,9 +79,10 @@ protected function transformValues(array $values): array
{
return collect($values)
->map(function ($value) {
if($value instanceof \BackedEnum) {
if ($value instanceof \BackedEnum) {
return $value->value;
}

return $value;
})
->toArray();
Expand Down
4 changes: 0 additions & 4 deletions src/Data/Embeds/EmbedFormData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

namespace Code16\Sharp\Data\Embeds;


use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;
use Code16\Sharp\Data\Form\Fields\FormFieldData;
use Code16\Sharp\Data\Form\FormConfigData;
use Code16\Sharp\Data\Form\FormLayoutData;
use Code16\Sharp\Data\InstanceAuthorizationsData;
use Code16\Sharp\Data\PageAlertData;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;

final class EmbedFormData extends Data
Expand Down
8 changes: 2 additions & 6 deletions src/Data/EntityList/EntityListConfigData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@

namespace Code16\Sharp\Data\EntityList;

use Code16\Sharp\Data\Commands\CommandData;
use Code16\Sharp\Data\Commands\ConfigCommandsData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\EntityStateData;
use Code16\Sharp\Data\Filters\ConfigFiltersData;
use Code16\Sharp\Enums\CommandType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
use Spatie\TypeScriptTransformer\Attributes\RecordTypeScriptType;

final class EntityListConfigData extends Data
{
public function __construct(
public string $instanceIdAttribute,
public string $instanceIdAttribute,
public bool $searchable,
public bool $reorderable,
public ?string $defaultSort,
public ?string $defaultSortDir,
public bool $hasShowPage,
public string $deleteConfirmationText,
public string $deleteConfirmationText,
public bool $deleteHidden,
public ?string $multiformAttribute,
public ?ConfigFiltersData $filters = null,
Expand Down
4 changes: 0 additions & 4 deletions src/Data/EntityList/EntityListData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

namespace Code16\Sharp\Data\EntityList;


use Code16\Sharp\Data\BreadcrumbData;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Data\DataCollection;
use Code16\Sharp\Data\EntityAuthorizationsData;
use Code16\Sharp\Data\NotificationData;
use Code16\Sharp\Data\PageAlertData;
use Code16\Sharp\Data\PaginatorMetaData;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;

final class EntityListData extends Data
{
Expand Down
1 change: 0 additions & 1 deletion src/Data/EntityList/EntityListFieldData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data\EntityList;


use Code16\Sharp\Data\Data;

final class EntityListFieldData extends Data
Expand Down
1 change: 0 additions & 1 deletion src/Data/EntityList/EntityListMultiformData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data\EntityList;


use Code16\Sharp\Data\Data;

final class EntityListMultiformData extends Data
Expand Down
1 change: 0 additions & 1 deletion src/Data/EntityList/EntityListQueryParamsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data\EntityList;


use Code16\Sharp\Data\Data;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
Expand Down
3 changes: 1 addition & 2 deletions src/Data/EntityStateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data;


final class EntityStateData extends Data
{
public function __construct(
Expand All @@ -13,7 +12,7 @@ public function __construct(
public mixed $authorization,
) {
}

public static function from(array $state): self
{
return new self(
Expand Down
1 change: 0 additions & 1 deletion src/Data/EntityStateValueData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Code16\Sharp\Data;


final class EntityStateValueData extends Data
{
public function __construct(
Expand Down
Loading

0 comments on commit e8d8e20

Please sign in to comment.