Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
tidy up (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdowdy authored Apr 9, 2017
1 parent a9e3e47 commit 1de311c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Controller/TinyPNGBackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function allImages( Application $app, Request $request, $directory )

protected function getAllDirectories( $app, $fileList )
{
$filesystem = $this->fsSetup( $app );
$filesystem = $this->fsSetup( $app );

$files = [];

Expand Down Expand Up @@ -637,7 +637,8 @@ public function uploadImage( Application $app, Request $request, $directory )
if ( $fileExists ) {
$fileParts = pathinfo( $fileName );
$normalizedFilename = $this->normalizeFileName( $fileName );
$newName = $this->renameExisting( $normalizedFilename, $uploadDir, $fileParts['extension'] );
$newName = $this->renameExisting( $normalizedFilename, $uploadDir,
$fileParts['extension'] );
} else {
$newName = $this->normalizeFileName( $fileName );
}
Expand Down Expand Up @@ -712,8 +713,8 @@ private function normalizeFileName( $filename )
*/
private function renameExisting( $normalizedName, $directory, $extension )
{
$parts = pathinfo($normalizedName);
$fileName = isset( $directory )
$parts = pathinfo( $normalizedName );
$fileName = isset( $directory )
? $directory . $parts['filename']
: $parts['filename'];

Expand Down

0 comments on commit 1de311c

Please sign in to comment.