bristol-su /
upload-file
| 1 | <?php |
||||
| 2 | |||||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||
| 3 | namespace BristolSU\Module\UploadFile\Events; |
||||
| 4 | |||||
| 5 | use BristolSU\Module\UploadFile\Models\File; |
||||
| 6 | use BristolSU\Support\Action\Contracts\TriggerableEvent; |
||||
| 7 | |||||
| 8 | class DocumentUpdated implements TriggerableEvent |
||||
|
0 ignored issues
–
show
|
|||||
| 9 | { |
||||
| 10 | |||||
| 11 | /** |
||||
|
0 ignored issues
–
show
|
|||||
| 12 | * @var File |
||||
| 13 | */ |
||||
| 14 | public $file; |
||||
| 15 | |||||
| 16 | 14 | public function __construct(File $file) |
|||
|
0 ignored issues
–
show
|
|||||
| 17 | { |
||||
| 18 | 14 | $this->file = $file; |
|||
| 19 | 14 | } |
|||
| 20 | |||||
| 21 | /** |
||||
|
0 ignored issues
–
show
|
|||||
| 22 | * @inheritDoc |
||||
| 23 | */ |
||||
|
0 ignored issues
–
show
|
|||||
| 24 | 2 | public function getFields(): array |
|||
| 25 | { |
||||
| 26 | return [ |
||||
| 27 | 2 | 'file_id' => $this->file->id, |
|||
| 28 | 2 | 'title' => $this->file->title, |
|||
| 29 | 2 | 'description' => $this->file->description, |
|||
| 30 | 2 | 'filename' => $this->file->filename, |
|||
| 31 | 2 | 'mime' => $this->file->mime, |
|||
| 32 | 2 | 'size' => $this->file->size, |
|||
| 33 | 2 | 'uploaded_by_id' => $this->file->uploaded_by->id(), |
|||
|
0 ignored issues
–
show
The method
id() does not exist on integer.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. Loading history...
|
|||||
| 34 | 2 | 'uploaded_by_email' => $this->file->uploaded_by->data()->email(), |
|||
| 35 | 2 | 'uploaded_by_first_name' => $this->file->uploaded_by->data()->firstName(), |
|||
| 36 | 2 | 'uploaded_by_last_name' => $this->file->uploaded_by->data()->lastName(), |
|||
| 37 | 2 | 'uploaded_by_preferred_name' => $this->file->uploaded_by->data()->preferredName(), |
|||
| 38 | 2 | 'module_instance_id' => $this->file->module_instance_id, |
|||
| 39 | 2 | 'activity_instance_id' => $this->file->activity_instance_id, |
|||
| 40 | 2 | 'uploaded_at' => $this->file->created_at->format('Y-m-d H:i:s'), |
|||
| 41 | 2 | 'updated_at' => $this->file->updated_at->format('Y-m-d H:i:s'), |
|||
| 42 | ]; |
||||
| 43 | } |
||||
| 44 | |||||
| 45 | /** |
||||
|
0 ignored issues
–
show
|
|||||
| 46 | * @inheritDoc |
||||
| 47 | */ |
||||
|
0 ignored issues
–
show
|
|||||
| 48 | 1 | public static function getFieldMetaData(): array |
|||
| 49 | { |
||||
| 50 | return [ |
||||
| 51 | 'file_id' => [ |
||||
| 52 | 1 | 'label' => 'File ID', |
|||
| 53 | 'helptext' => 'The ID of the file' |
||||
| 54 | ], |
||||
| 55 | 'title' => [ |
||||
| 56 | 'label' => 'Title', |
||||
| 57 | 'helptext' => 'The title given to the document when uploaded', |
||||
| 58 | ], |
||||
| 59 | 'description' => [ |
||||
| 60 | 'label' => 'Description', |
||||
| 61 | 'helptext' => 'A description of the file' |
||||
| 62 | ], |
||||
| 63 | 'filename' => [ |
||||
| 64 | 'label' => 'Filename', |
||||
| 65 | 'helptext' => 'The original filename of the document' |
||||
| 66 | ], |
||||
| 67 | 'mime' => [ |
||||
| 68 | 'label' => 'Mimetype', |
||||
| 69 | 'helptext' => 'The mime type of the file' |
||||
| 70 | ], |
||||
| 71 | 'size' => [ |
||||
| 72 | 'label' => 'File Size', |
||||
| 73 | 'helptext' => 'The size of the file in bytes' |
||||
| 74 | ], |
||||
| 75 | 'uploaded_by_id' => [ |
||||
| 76 | 'label' => 'User ID', |
||||
| 77 | 'helptext' => 'ID of the user who uploaded the file' |
||||
| 78 | ], |
||||
| 79 | 'uploaded_by_email' => [ |
||||
| 80 | 'label' => 'User Email', |
||||
| 81 | 'helptext' => 'Email of the user who uploaded the file' |
||||
| 82 | ], |
||||
| 83 | 'uploaded_by_first_name' => [ |
||||
| 84 | 'label' => 'User First Name', |
||||
| 85 | 'helptext' => 'First Name of the user who uploaded the file' |
||||
| 86 | ], |
||||
| 87 | 'uploaded_by_last_name' => [ |
||||
| 88 | 'label' => 'User Last Name', |
||||
| 89 | 'helptext' => 'Last Name of the user who uploaded the file' |
||||
| 90 | ], |
||||
| 91 | 'uploaded_by_preferred_name' => [ |
||||
| 92 | 'label' => 'User Preferred Name', |
||||
| 93 | 'helptext' => 'Preferred Name of the user who uploaded the file' |
||||
| 94 | ], |
||||
| 95 | 'module_instance_id' => [ |
||||
| 96 | 'label' => 'Module Instance ID', |
||||
| 97 | 'helptext' => 'ID of the module instance the file was uploaded to' |
||||
| 98 | ], |
||||
| 99 | 'activity_instance_id' => [ |
||||
| 100 | 'label' => 'Activity Instance ID', |
||||
| 101 | 'helptext' => 'ID of the activity instance that uploaded the file' |
||||
| 102 | ], |
||||
| 103 | 'uploaded_at' => [ |
||||
| 104 | 'label' => 'Uploaded At', |
||||
| 105 | 'helptext' => 'Time and date the file was uploaded at' |
||||
| 106 | ], |
||||
| 107 | 'updated_at' => [ |
||||
| 108 | 'label' => 'Updated At', |
||||
| 109 | 'helptext' => 'Time and date the file was last updated' |
||||
| 110 | ] |
||||
| 111 | ]; |
||||
| 112 | } |
||||
| 113 | } |