Skip to content

Commit

Permalink
Images typos changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atishhamte committed Apr 19, 2019
1 parent 7f88934 commit a5971a6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 16 deletions.
4 changes: 2 additions & 2 deletions system/Exceptions/FrameworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public static function forInvalidFile(string $path)
return new static(lang('Core.invalidFile', [$path]));
}

public static function forCopyError()
public static function forCopyError(string $path)
{
return new static(lang('Core.copyError'));
return new static(lang('Core.copyError', [$path]));
}

public static function forMissingExtension(string $extension)
Expand Down
2 changes: 2 additions & 0 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ protected abstract function process(string $action);
*
* @param string $name
* @param array $args
*
* @return mixed
*/
public function __call(string $name, array $args = [])
{
Expand Down
16 changes: 11 additions & 5 deletions system/Images/Handlers/GDHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct($config = null)
*
* @return boolean
*/
protected function _rotate(int $angle)
protected function _rotate(int $angle): bool
{
// Create the image handle
$srcImg = $this->createImage();
Expand Down Expand Up @@ -311,7 +311,7 @@ protected function process(string $action)
*
* @return boolean
*/
public function save(string $target = null, int $quality = 90)
public function save(string $target = null, int $quality = 90): bool
{
$target = empty($target) ? $this->image->getPathname() : $target;

Expand Down Expand Up @@ -370,12 +370,12 @@ public function save(string $target = null, int $quality = 90)
* This simply creates an image resource handle
* based on the type of image being processed
*
* @param string
* @param string
* @param string $path
* @param string $imageType
*
* @return resource|boolean
*/
protected function createImage($path = '', $imageType = '')
protected function createImage(string $path = '', string $imageType = '')
{
if ($this->resource !== null)
{
Expand Down Expand Up @@ -422,6 +422,12 @@ protected function createImage($path = '', $imageType = '')

//--------------------------------------------------------------------

/**
* @param string $text
* @param array $options
*
* @return void
*/
protected function _text(string $text, array $options = [])
{
// Reverse the vertical offset
Expand Down
17 changes: 11 additions & 6 deletions system/Images/Handlers/ImageMagickHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
namespace CodeIgniter\Images\Handlers;

use CodeIgniter\Images\Exceptions\ImageException;
use CodeIgniter\Images\Image;

/**
* Class ImageMagickHandler
Expand Down Expand Up @@ -89,6 +88,7 @@ public function __construct($config = null)
* @param boolean $maintainRatio
*
* @return ImageMagickHandler
* @throws \Exception
*/
public function _resize(bool $maintainRatio = false)
{
Expand All @@ -114,6 +114,7 @@ public function _resize(bool $maintainRatio = false)
* Crops the image.
*
* @return boolean|\CodeIgniter\Images\Handlers\ImageMagickHandler
* @throws \Exception
*/
public function _crop()
{
Expand All @@ -136,6 +137,7 @@ public function _crop()
* @param integer $angle
*
* @return $this
* @throws \Exception
*/
protected function _rotate(int $angle)
{
Expand All @@ -161,6 +163,7 @@ protected function _rotate(int $angle)
* @param integer $blue
*
* @return $this
* @throws \Exception
*/
public function _flatten(int $red = 255, int $green = 255, int $blue = 255)
{
Expand All @@ -184,6 +187,7 @@ public function _flatten(int $red = 255, int $green = 255, int $blue = 255)
* @param string $direction
*
* @return $this
* @throws \Exception
*/
public function _flip(string $direction)
{
Expand All @@ -204,9 +208,9 @@ public function _flip(string $direction)
/**
* Get GD version
*
* @return mixed
* @return string
*/
public function getVersion()
public function getVersion(): string
{
$result = $this->process('-version');

Expand Down Expand Up @@ -274,7 +278,7 @@ protected function process(string $action, int $quality = 100)
*
* @return boolean
*/
public function save(string $target = null, int $quality = 90)
public function save(string $target = null, int $quality = 90): bool
{
$target = empty($target) ? $this->image : $target;

Expand Down Expand Up @@ -314,6 +318,7 @@ public function save(string $target = null, int $quality = 90)
* during the process, we'll use a PNG as the temp file type.
*
* @return resource|boolean
* @throws \Exception
*/
protected function getResourcePath()
{
Expand All @@ -334,6 +339,8 @@ protected function getResourcePath()
*
* @param string $text
* @param array $options
*
* @throws \Exception
*/
protected function _text(string $text, array $options = [])
{
Expand Down Expand Up @@ -430,8 +437,6 @@ protected function _text(string $text, array $options = [])

//--------------------------------------------------------------------

//--------------------------------------------------------------------

public function _getWidth()
{
return imagesx($this->resource);
Expand Down
4 changes: 2 additions & 2 deletions system/Images/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Image extends File
*
* @return boolean
*/
public function copy(string $targetPath, string $targetName = null, int $perms = 0644)
public function copy(string $targetPath, string $targetName = null, int $perms = 0644): bool
{
$targetPath = rtrim($targetPath, '/ ') . '/';

Expand Down Expand Up @@ -132,7 +132,7 @@ public function copy(string $targetPath, string $targetName = null, int $perms =
*
* @return mixed
*/
public function getProperties($return = false)
public function getProperties(bool $return = false)
{
$path = $this->getPathname();

Expand Down
2 changes: 1 addition & 1 deletion system/Language/en/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

return [
'invalidFile' => 'Invalid file: {0}',
'copyError' => 'An error was encountered while attempting to replace the file. Please make sure your file directory is writable.',
'copyError' => 'An error was encountered while attempting to replace the file({0}). Please make sure your file directory is writable.',
'missingExtension' => '{0} extension is not loaded.',
'noHandlers' => '{0} must provide at least one Handler.',
];

0 comments on commit a5971a6

Please sign in to comment.