Skip to content

Commit

Permalink
[#14213] - Renaming Dispatcher; Refactoring Image/Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Jul 4, 2019
1 parent 278b52a commit d7804ef
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 76 deletions.
4 changes: 2 additions & 2 deletions phalcon/Dispatcher.zep → phalcon/Dispatcher/Dispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Phalcon;
namespace Phalcon\Dispatcher;

use Exception;
use Phalcon\DiInterface;
Expand All @@ -26,7 +26,7 @@ use Phalcon\Mvc\Model\BinderInterface;
* This class can't be instantiated directly, you can use it to create your own
* dispatchers.
*/
abstract class Dispatcher implements DispatcherInterface, InjectionAwareInterface, EventsAwareInterface
abstract class AbstractDispatcher implements DispatcherInterface, InjectionAwareInterface, EventsAwareInterface
{
const EXCEPTION_ACTION_NOT_FOUND = 5;
const EXCEPTION_CYCLIC_ROUTING = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

namespace Phalcon;
namespace Phalcon\Dispatcher;

/**
* Interface for Phalcon\Dispatcher
Expand Down
26 changes: 13 additions & 13 deletions phalcon/Image/Adapter/AbstractAdapter.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Phalcon\Image\Adapter;

use Phalcon\Image;
use Phalcon\Image\Enum;
use Phalcon\Image\Exception;

/**
Expand Down Expand Up @@ -145,8 +145,8 @@ abstract class AbstractAdapter implements AdapterInterface
*/
public function flip(int direction) -> <Adapter>
{
if direction != Image::HORIZONTAL && direction != Image::VERTICAL {
let direction = Image::HORIZONTAL;
if direction != Enum::HORIZONTAL && direction != Enum::VERTICAL {
let direction = Enum::HORIZONTAL;
}

this->{"processFlip"}(direction);
Expand Down Expand Up @@ -240,38 +240,38 @@ abstract class AbstractAdapter implements AdapterInterface
/**
* Resize the image to the given size
*/
public function resize(int width = null, int height = null, int master = Image::AUTO) -> <Adapter>
public function resize(int width = null, int height = null, int master = Enum::AUTO) -> <Adapter>
{
var ratio;

if master == Image::TENSILE {
if master == Enum::TENSILE {

if unlikely (!width || !height) {
throw new Exception("width and height must be specified");
}

} else {
if master == Image::AUTO {
if master == Enum::AUTO {

if unlikely (!width || !height) {
throw new Exception("width and height must be specified");
}

let master = (this->width / width) > (this->height / height) ? Image::WIDTH : Image::HEIGHT;
let master = (this->width / width) > (this->height / height) ? Enum::WIDTH : Enum::HEIGHT;
}

if master == Image::INVERSE {
if master == Enum::INVERSE {

if unlikely (!width || !height) {
throw new Exception("width and height must be specified");
}

let master = (this->width / width) > (this->height / height) ? Image::HEIGHT : Image::WIDTH;
let master = (this->width / width) > (this->height / height) ? Enum::HEIGHT : Enum::WIDTH;
}

switch master {

case Image::WIDTH:
case Enum::WIDTH:
if unlikely !width {
throw new Exception("width must be specified");
}
Expand All @@ -280,7 +280,7 @@ abstract class AbstractAdapter implements AdapterInterface

break;

case Image::HEIGHT:
case Enum::HEIGHT:
if unlikely !height {
throw new Exception("height must be specified");
}
Expand All @@ -289,7 +289,7 @@ abstract class AbstractAdapter implements AdapterInterface

break;

case Image::PRECISE:
case Enum::PRECISE:
if unlikely (!width || !height) {
throw new Exception(
"width and height must be specified"
Expand All @@ -306,7 +306,7 @@ abstract class AbstractAdapter implements AdapterInterface

break;

case Image::NONE:
case Enum::NONE:
if !width {
let width = (int) this->width;
}
Expand Down
3 changes: 2 additions & 1 deletion phalcon/Image/Adapter/Gd.zep
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Phalcon\Image\Adapter;

use Phalcon\Image\Enum;
use Phalcon\Image\Adapter\AbstractAdapter;
use Phalcon\Image\Exception;

Expand Down Expand Up @@ -224,7 +225,7 @@ class Gd extends AbstractAdapter

protected function processFlip(int direction)
{
if direction == \Phalcon\Image::HORIZONTAL {
if direction == Enum::HORIZONTAL {
imageflip(this->image, IMG_FLIP_HORIZONTAL);
} else {
imageflip(this->image, IMG_FLIP_VERTICAL);
Expand Down
Loading

0 comments on commit d7804ef

Please sign in to comment.