Giter VIP home page Giter VIP logo

dcp-router's People

Contributors

esmith-pltw avatar estelsmith avatar

Stargazers

 avatar

Watchers

 avatar  avatar

dcp-router's Issues

Move To Evenement 2.0

It would be nice to move to Evenement 2.0 and utilize traits, so that instantiating the router itself is simplified, and not requiring a dependency to be fulfilled.

// Bad.
$emitter = new EventEmitter();
$router = new BaseRouter($emitter);

// Better!!
$router = new BaseRouter();

Move Controller Prefixes Into MvcRouter

Currently, BaseRouter has methods for setting and retrieving controller prefixes, even though the methods are only used by MvcRouter.

These methods should be moved into MvcRouter itself, to reduce the footprint of the BaseRouter.

Default Controller and Default Action Configuration

It would be nice if the default controller and default actions were configurable.

class BaseRouter extends MVCRouter
{
    public function __construct()
    {
        parent::__construct();

        $this->setDefaultController('home');
        $this->setDefaultAction('home');
    }
}

$router = new BaseRouter();
$router->dispatch('/'); //Should route to HomeController#homeAction

Consolidate Event Flow Into BaseRouter#dispatch()

Right now it's fairly difficult to follow the event flow in the codebase. In order to see what events are being called, you need to follow the event chain through the events themselves.

It would be easier to follow events that are being emitted by removing the event-emitting capability of the events themselves, and consolidate into the BaseRouter#dispatch() method.

This will give users a single place to see where things are happening inside the routers.

Add CREATING and DISPATCHING Events

Currently the CREATE and DISPATCH events contain all the logic required to find and also create/dispatch items. Instead, we should separate the logic of resolving and instantiation into two events. CREATING/DISPATCHING would be for resolving, and CREATE/DISPATCH would be for performing the actual dispatch and/or creation.

This would be useful for when events are overridden to work with DI containers and the like.

Ensure PSR-2 Compliance

The codebase is not compliant with PSR-2 whatsoever. It should be updated to adhere to these standards.

Create PHPUnit Tests

The codebase is lacking any sort of formal tests. Tests should be created to ensure that everything works properly.

Several DocBlocks Out of Date

There are several docblocks in the project that are out-of-date and missing argument and/or return information.

Methods I've noticed:

  • BaseRouter::__construct()
  • BaseRouter::convertUrlToArray()
  • BaseRouter::dispatch()
  • All docblocks in MvcRouter
  • RouterInterface::dispatch()

Add Travis-CI Automated Testing

It would be nice to have Travis-CI automatically perform tests against the codebase any time a commit it pushed to the repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.