Skip to content

Commit

Permalink
refactor code style
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosocarvalho committed Jul 30, 2019
1 parent 4189f29 commit b96204b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Adapter for theleague php flysystem for Cloudinary
[![Author](https://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/carlosocarvalho)
[![Latest Stable Version](https://poser.pugx.org/carlosocarvalho/flysystem-cloudinary/v/stable)](https://packagist.org/packages/carlosocarvalho/flysystem-cloudinary) [![Total Downloads](https://poser.pugx.org/carlosocarvalho/flysystem-cloudinary/downloads)](https://packagist.org/packages/carlosocarvalho/flysystem-cloudinary) [![Latest Unstable Version](https://poser.pugx.org/carlosocarvalho/flysystem-cloudinary/v/unstable)](https://packagist.org/packages/carlosocarvalho/flysystem-cloudinary) [![License](https://poser.pugx.org/carlosocarvalho/flysystem-cloudinary/license)](https://packagist.org/packages/carlosocarvalho/flysystem-cloudinary)
[![Build Status](https://travis-ci.org/carlosocarvalho/flysystem-cloudinary.svg?branch=master)](https://travis-ci.org/carlosocarvalho/flysystem-cloudinary)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/40851dce873643d4b8c4f720694237da)](https://www.codacy.com/app/carlosocarvalho-git/flysystem-cloudinary?utm_source=github.com&utm_medium=referral&utm_content=carlosocarvalho/flysystem-cloudinary&utm_campaign=Badge_Grade)

Install

Expand Down
24 changes: 12 additions & 12 deletions src/CloudinaryAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function __construct(array $options)
public function write($path, $contents, Config $options)
{
// 1. Save to temporary local file -- it will be destroyed automatically
$tempfile = tmpfile();
fwrite($tempfile, $contents);
$tempFile = tmpfile();
fwrite($tempFile, $contents);
// 2. Use Cloudinary to send
$uploaded_metadata = $this->writeStream($path, $tempfile, $options);
return $uploaded_metadata;
$uploadedMetadata = $this->writeStream($path, $tempFile, $options);
return $uploadedMetadata;
}
/**
* Write a new file using a stream.
Expand All @@ -66,8 +66,8 @@ public function write($path, $contents, Config $options)
public function writeStream($path, $resource, Config $options)
{
$resourceMetadata = stream_get_meta_data($resource);
$uploaded_metadata = Uploader::upload($resourceMetadata['uri'], ['public_id' => $path]);
return $uploaded_metadata;
$uploadedMetadata = Uploader::upload($resourceMetadata['uri'], ['public_id' => $path]);
return $uploadedMetadata;
}
/**
* Update a file.
Expand Down Expand Up @@ -114,14 +114,14 @@ public function rename($path, $newpath)
} else {
$pathRemote = $pathInfo['filename'];
}
$newpathinfo = pathinfo($newpath);
if ($newpathinfo['dirname'] != '.') {
$newpath_remote = $newpathinfo['dirname'] . '/' . $newpathinfo['filename'];
$newPathInfo = pathinfo($newpath);
if ($newPathInfo['dirname'] != '.') {
$newPathRemote = $newPathInfo['dirname'] . '/' . $newPathInfo['filename'];
} else {
$newpath_remote = $newpathinfo['filename'];
$newPathRemote = $newPathInfo['filename'];
}
$result = Uploader::rename($pathRemote, $newpath_remote);
return $result['public_id'] == $newpathinfo['filename'];
$result = Uploader::rename($pathRemote, $newPathRemote);
return $result['public_id'] == $newPathInfo['filename'];
}
/**
* Copy a file.
Expand Down

0 comments on commit b96204b

Please sign in to comment.