Skip to content

Commit

Permalink
chore: Add laravel ide helper
Browse files Browse the repository at this point in the history
  • Loading branch information
keriati committed Dec 1, 2022
1 parent bd76efc commit 52620bc
Show file tree
Hide file tree
Showing 512 changed files with 89,443 additions and 31 deletions.
2,080 changes: 2,080 additions & 0 deletions .phpstorm.meta.php

Large diffs are not rendered by default.

20,867 changes: 20,867 additions & 0 deletions _ide_helper.php

Large diffs are not rendered by default.

37 changes: 35 additions & 2 deletions app/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,42 @@
namespace App;

use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;

/**
* App\Application
*
* @property string $appid
* @property string $name
* @property string|null $sha
* @property string|null $icon
* @property string|null $website
* @property string|null $license
* @property string|null $description
* @property int $enhanced
* @property string $tile_background
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property string|null $class
* @method static Builder|Application newModelQuery()
* @method static Builder|Application newQuery()
* @method static Builder|Application query()
* @method static Builder|Application whereAppid($value)
* @method static Builder|Application whereClass($value)
* @method static Builder|Application whereCreatedAt($value)
* @method static Builder|Application whereDescription($value)
* @method static Builder|Application whereEnhanced($value)
* @method static Builder|Application whereIcon($value)
* @method static Builder|Application whereLicense($value)
* @method static Builder|Application whereName($value)
* @method static Builder|Application whereSha($value)
* @method static Builder|Application whereTileBackground($value)
* @method static Builder|Application whereUpdatedAt($value)
* @method static Builder|Application whereWebsite($value)
*/
class Application extends Model
{
/**
Expand Down Expand Up @@ -79,9 +112,9 @@ public static function classFromName($name): string
}

/**
* @return \Illuminate\Support\Collection
* @return Collection
*/
public static function apps(): \Illuminate\Support\Collection
public static function apps(): Collection
{
$json = json_decode(file_get_contents(storage_path('app/supportedapps.json'))) ?? [];
$apps = collect($json->apps);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/RegisterApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct()
/**
* Execute the console command.
*
* @return mixed
* @return void
*/
public function handle()
{
Expand Down
47 changes: 35 additions & 12 deletions app/Http/Controllers/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
use App\Item;
use App\Jobs\ProcessApps;
use App\User;
use Artisan;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ServerException;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;

class ItemController extends Controller
{
Expand Down Expand Up @@ -105,11 +107,11 @@ public function pinToggle($id, $ajax = false, $tag = false)
$new = !(((bool)$item->pinned === true));
$item->pinned = $new;
$item->save();
if ($ajax) {

if ($ajax) {
$item = Item::whereId($tag)->first();

$data['apps'] = new \Illuminate\Database\Eloquent\Collection;
$data['apps'] = new Collection;

if ((int)$tag === 0) {
$tags = Item::where('type', 1)->pinned()->orderBy('order', 'asc')->get();
Expand All @@ -133,9 +135,10 @@ public function pinToggle($id, $ajax = false, $tag = false)
/**
* Display a listing of the resource.
*
* @param Request $request
* @return View
*/
public function index(Request $request)
public function index(Request $request): View
{
$trash = (bool) $request->input('trash');

Expand Down Expand Up @@ -411,6 +414,10 @@ public function appload(Request $request): ?string
return json_encode($output);
}

/**
* @param Request $request
* @return void
*/
public function testConfig(Request $request)
{
$data = $request->input('data');
Expand All @@ -419,8 +426,7 @@ public function testConfig(Request $request)
$app = $single->class;

// If password is not resubmitted fill it from the database when in edit mode
if (
array_key_exists('password', $data) &&
if (array_key_exists('password', $data) &&
$data['password'] === null &&
array_key_exists('id', $data)
) {
Expand All @@ -436,10 +442,15 @@ public function testConfig(Request $request)
$app_details->test();
}

public function execute($url, $attrs = [], $overridevars = false)
/**
* @param $url
* @param array $attrs
* @param array|bool $overridevars
* @return ResponseInterface|null
* @throws GuzzleException
*/
public function execute($url, array $attrs = [], $overridevars = false): ?ResponseInterface
{
$res = null;

$vars = ($overridevars !== false) ?
$overridevars : [
'http_errors' => false,
Expand All @@ -461,17 +472,26 @@ public function execute($url, $attrs = [], $overridevars = false)
Log::debug($e->getMessage());
}

return $res;
return null;
}

public function websitelookup($url)
/**
* @param $url
* @return StreamInterface
* @throws GuzzleException
*/
public function websitelookup($url): StreamInterface
{
$url = base64_decode($url);
$data = $this->execute($url);

return $data->getBody();
}

/**
* @param $id
* @return void
*/
public function getStats($id)
{
$item = Item::find($id);
Expand All @@ -484,6 +504,9 @@ public function getStats($id)
}
}

/**
* @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector
*/
public function checkAppList()
{
ProcessApps::dispatch();
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/ItemRestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Item;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Collection;

class ItemRestController extends Controller
{
Expand All @@ -17,7 +18,7 @@ public function __construct()
/**
* Display a listing of the resource.
*
* @return Response
* @return Collection
*/
public function index()
{
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
namespace App\Http\Controllers;

use App\Search;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;

class SearchController extends Controller
{
/**
* @param Request $request
* @return Application|RedirectResponse|Redirector|mixed|void
*/
public function index(Request $request)
{
$requestprovider = $request->input('provider');
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Middleware/CheckAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\User;
use Closure;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
Expand All @@ -17,6 +18,7 @@ class CheckAllowed
* @param Request $request
* @param Closure $next
* @return mixed
* @throws AuthenticationException
*/
public function handle(Request $request, Closure $next)
{
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param Request $request
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
public function handle(Request $request, Closure $next, string $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect()->intended();
Expand Down
64 changes: 60 additions & 4 deletions app/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,62 @@
use stdClass;
use Symfony\Component\ClassLoader\ClassMapGenerator;

/**
* App\Item
*
* @property int $id
* @property string $title
* @property string|null $colour
* @property string|null $icon
* @property string $url
* @property string|null $description
* @property int $pinned
* @property int $order
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $type
* @property int $user_id
* @property string|null $class
* @property string|null $appid
* @property string|null $appdescription
* @property-read \Illuminate\Database\Eloquent\Collection|Item[] $children
* @property-read int|null $children_count
* @property-read string $droppable
* @property-read \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\UrlGenerator|mixed|string $link
* @property-read string $link_icon
* @property-read string $link_target
* @property-read string $link_type
* @property-read \Illuminate\Database\Eloquent\Collection|Item[] $parents
* @property-read int|null $parents_count
* @property-read \App\User|null $user
* @method static \Database\Factories\ItemFactory factory(...$parameters)
* @method static Builder|Item newModelQuery()
* @method static Builder|Item newQuery()
* @method static Builder|Item ofType($type)
* @method static \Illuminate\Database\Query\Builder|Item onlyTrashed()
* @method static Builder|Item pinned()
* @method static Builder|Item query()
* @method static Builder|Item whereAppdescription($value)
* @method static Builder|Item whereAppid($value)
* @method static Builder|Item whereClass($value)
* @method static Builder|Item whereColour($value)
* @method static Builder|Item whereCreatedAt($value)
* @method static Builder|Item whereDeletedAt($value)
* @method static Builder|Item whereDescription($value)
* @method static Builder|Item whereIcon($value)
* @method static Builder|Item whereId($value)
* @method static Builder|Item whereOrder($value)
* @method static Builder|Item wherePinned($value)
* @method static Builder|Item whereTitle($value)
* @method static Builder|Item whereType($value)
* @method static Builder|Item whereUpdatedAt($value)
* @method static Builder|Item whereUrl($value)
* @method static Builder|Item whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|Item withTrashed()
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
* @mixin \Eloquent
*/
class Item extends Model
{
use SoftDeletes;
Expand Down Expand Up @@ -294,9 +350,9 @@ public function getconfig()

/**
* @param $class
* @return false
* @return Application|null
*/
public static function applicationDetails($class): bool
public static function applicationDetails($class): ?Application
{
if (! empty($class)) {
$name = self::nameFromClass($class);
Expand All @@ -306,7 +362,7 @@ public static function applicationDetails($class): bool
}
}

return false;
return null;
}

/**
Expand All @@ -316,7 +372,7 @@ public static function applicationDetails($class): bool
public static function getApplicationDescription($class): string
{
$details = self::applicationDetails($class);
if ($details !== false) {
if ($details !== null) {
return $details->description.' - '.$details->license;
}

Expand Down
16 changes: 16 additions & 0 deletions app/ItemTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@

use Illuminate\Database\Eloquent\Relations\Pivot;

/**
* App\ItemTag
*
* @property int $item_id
* @property int $tag_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag query()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereItemId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereTagId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereUpdatedAt($value)
* @mixin \Eloquent
*/
class ItemTag extends Pivot
{
}
5 changes: 5 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Jobs\UpdateApps;
use App\Setting;
use App\User;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
Expand Down Expand Up @@ -116,6 +117,10 @@ public function genKey()
*/
public function register()
{
if ($this->app->isLocal()) {
$this->app->register(IdeHelperServiceProvider::class);
}

$this->app->singleton('settings', function () {
return new Setting();
});
Expand Down
Loading

0 comments on commit 52620bc

Please sign in to comment.