Extending resolver

You may want to use this package in conjonction with a container ; let's take this use case as an example.

This can be done very easily, simply by using the inheritance feature of the OOP paradigm.

<?php

namespace My\Container;

use Abellion\Resolver\Resolver;

class Container extends Resolver
{
    //This method will be called each time the Resolver will try to resolve something.
    //It acts like an interceptor between this class and the Resolver.
    //So this is the perfect place to check if the given type is available within your container.
    public function resolve($subject, array $parameters = [])
    {
        //If available : return it directly
        //If not : return parent::resolve($subject, $parameters)
    }
}

results matching ""

    No results matching ""