Skip to content

Commit

Permalink
use pint for code style
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Jul 3, 2024
1 parent 004d099 commit 9eb036f
Show file tree
Hide file tree
Showing 82 changed files with 667 additions and 814 deletions.
19 changes: 8 additions & 11 deletions app/Console/Commands/DumpFromGit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Console\Commands;


use App\Facades\EntityFacade;
use App\Models\Membership;
use App\Models\User;
Expand All @@ -14,17 +13,16 @@
use App\Traits\EdugainTrait;
use App\Traits\FederationTrait;
use App\Traits\GitTrait;
use App\Traits\ValidatorTrait;
use Exception;
use Illuminate\Console\Command;
use App\Traits\ValidatorTrait;


class DumpFromGit extends Command
{
use GitTrait, ValidatorTrait;
use CreateFederationTrait,CreateEntitiesTrait,CreateCategoriesAndGroupsTrait;
use UpdateEntity,FederationTrait,FixEntityTrait;
use CreateCategoriesAndGroupsTrait,CreateEntitiesTrait,CreateFederationTrait;
use EdugainTrait;
use FederationTrait,FixEntityTrait,UpdateEntity;
use GitTrait, ValidatorTrait;

/**
* The name and signature of the console command.
Expand All @@ -43,23 +41,23 @@ class DumpFromGit extends Command
private function createMetadataFiles(): void
{
$this->updateFederationFolders();
$membership = Membership::select('entity_id','federation_id')->whereApproved(1)->get();
$membership = Membership::select('entity_id', 'federation_id')->whereApproved(1)->get();
foreach ($membership as $member) {
EntityFacade::saveMetadataToFederationFolder($member->entity_id, $member->federation_id);
}
}


/**
* Execute the console command.
*
* @throws Exception no amin
*/
public function handle()
{
$firstAdminId = User::where('admin', 1)->first()->id;
if(empty($firstAdminId))
if (empty($firstAdminId)) {
throw new Exception('firstAdminId is null');

}

$this->initializeGit();
$this->createFederations();
Expand All @@ -72,6 +70,5 @@ public function handle()
$this->createMetadataFiles();
$this->makeEdu2Edugain();


}
}
38 changes: 13 additions & 25 deletions app/Console/Commands/ValidateMetaConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,71 +23,59 @@ class ValidateMetaConsole extends Command
*/
protected $description = 'Command description';


use ValidatorTrait,FixEntityTrait;
use FixEntityTrait,ValidatorTrait;

/**
* Execute the console command.
*/

private function doc()
{
foreach (Entity::select()->get() as $entity)
{
foreach (Entity::select()->get() as $entity) {
$ent = Entity::where('id', $entity->id)->select()->first();


// $res = json_decode($this->validateMetadata($ent->metadata),true);
$res = json_decode($this->validateMetadata($ent->xml_file,true),true);
$res = json_decode($this->validateMetadata($ent->xml_file, true), true);
$res['ent_id'] = $ent->id;
$errorArray = $res['errorArray'];


if($res['code']==1)
{
if ($res['code'] == 1) {
dump($res);
}
else
{
} else {
dump($res['ent_id']);
}
}
}

private function meta()
{
foreach (Entity::select()->get() as $entity)
{
foreach (Entity::select()->get() as $entity) {

$ent = Entity::where('id', $entity->id)->select()->first();

$curr = 345;

if($ent->id < $curr)
if ($ent->id < $curr) {
continue;
if($ent->id > $curr)
}
if ($ent->id > $curr) {
break;
}


$res = json_decode($this->validateMetadata($ent->metadata),true);
$res = json_decode($this->validateMetadata($ent->metadata), true);
$res['ent_id'] = $ent->id;


dump($res);
if( $res['code']==1)
{
if ($res['code'] == 1) {

}
}
}


public function handle()
{

// $this->fixEntities();
// $this->fixEntities();
$this->doc();


}
}
1 change: 0 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
4 changes: 0 additions & 4 deletions app/Events/CreateEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
namespace App\Events;

use App\Models\Entity;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

Expand Down
7 changes: 1 addition & 6 deletions app/Events/FederationApprove.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
namespace App\Events;

use App\Models\Federation;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

Expand All @@ -20,9 +16,8 @@ class FederationApprove
/**
* Create a new event instance.
*/
public function __construct(Federation $federation)
public function __construct(Federation $federation)
{
$this->federation = $federation;
}

}
4 changes: 0 additions & 4 deletions app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public function store(StoreCategory $request)
/**
* Display the specified resource.
*
* @param \App\Models\Category $category
* @return \Illuminate\Http\Response
*/
public function show(Category $category)
Expand All @@ -92,7 +91,6 @@ public function show(Category $category)
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Category $category
* @return \Illuminate\Http\Response
*/
public function edit(Category $category)
Expand All @@ -108,7 +106,6 @@ public function edit(Category $category)
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Category $category
* @return \Illuminate\Http\Response
*/
public function update(UpdateCategory $request, Category $category)
Expand All @@ -134,7 +131,6 @@ public function update(UpdateCategory $request, Category $category)
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Category $category
* @return \Illuminate\Http\Response
*/
public function destroy(Category $category)
Expand Down
Loading

0 comments on commit 9eb036f

Please sign in to comment.