Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Some updates to comply with PSR-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Fonseca committed Dec 30, 2014
1 parent 00b1c0c commit 83124f4
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/vendor
composer.phar
composer.lock
.DS_Store
/nbproject
/node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class UploadFileValidator {

public function Validate($command) {
public function validate($command) {
$rules = [
'file' => "image|required|between:1," . \Config::get('image-manager::maxFileSize') . ""
];
Expand Down
4 changes: 0 additions & 4 deletions src/Joselfonseca/ImageManager/ImageManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public function boot() {
\App::bind('Joselfonseca\ImageManager\Interfaces\ImageRepositoryInterface', 'Joselfonseca\ImageManager\Repositories\ImageRepository');
\App::bind('Joselfonseca\ImageManager\Interfaces\ImageDbStorageInterface', 'Joselfonseca\ImageManager\Models\ImageManagerFiles');

/** register event listeners * */
//This may be use in the future. for now lets forget about it
//Event::listen('Joselfonseca\ImageManager.*', 'Joselfonseca\ImageManager\Listeners\EmailNotifier');

/** include the routes * */
require_once __DIR__ . '/../../routes.php';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Joselfonseca/ImageManager/Models/ImageManagerFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getFileInfo() {
];
}

public function DeleteFile() {
public function deleteFile() {
return $this->delete();
}

Expand Down
10 changes: 5 additions & 5 deletions src/Joselfonseca/ImageManager/Repositories/ImageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ public function getFiles() {
return $this->model->orderBy('created_at', 'desc')->paginate(12);
}

public function DeleteFile($comand) {
public function deleteFile($comand) {
try {
$this->file = $this->model->getFileById($comand->id);
} catch (ModelNotFoundException $e) {
throw new JoseModelNotFoundException;
}
$this->_removeFileFromDisk();
$this->_removeFileFromDb();
$this->removeFileFromDisk();
$this->removeFileFromDb();
}

private function _removeFileFromDisk() {
private function removeFileFromDisk() {
$file = $this->destination . '/' . $this->file->path;
unlink($file);
$this->raise(new FileWasRemovedFromDisc($this->file));
}

private function _removeFileFromDb() {
private function removeFileFromDb() {
$file = $this->file->getFileInfo();
$this->file->DeleteFile();
$this->raise(new FileWasRemovedFromDb($file));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ImageManagerFilesTable extends Migration {
Expand Down
2 changes: 1 addition & 1 deletion src/views/images_collection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
<div class="center-block images-paginator" style="text-align: center">
{{$files->links()}}
</div>
</div>
</div>

0 comments on commit 83124f4

Please sign in to comment.