Skip to content

Commit

Permalink
Fix compatibility issue from v0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Dec 9, 2023
1 parent 2a10eac commit c254f51
Show file tree
Hide file tree
Showing 28 changed files with 426 additions and 301 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ All notable changes to `Slytherin` will be documented in this file.
- `UnexpectedValueException` to `BadMethodCallException` in `DispatcherInterface`
- Conformed `Middleware` to the official `PSR-15` package (`psr/http-server-middleware`)
- `Application` class to `System`
- `ERROR_HANDLER` constant to `ERREPORT` in `System`

### Fixed
- Type hinting of all classes using `PHPStan` (up to `level 9`)
Expand Down
42 changes: 5 additions & 37 deletions src/Component/AbstractComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

namespace Rougin\Slytherin\Component;

use Psr\Container\ContainerInterface as PsrContainerInterface;
use Rougin\Slytherin\Container\ContainerInterface;
use Rougin\Slytherin\Integration\Configuration;

/**
* Component Abstract
*
* Methods used for integrating a component to Slytherin.
* NOTE: To be removed in v1.0.0. Use "Integration" instead.
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*/
abstract class AbstractComponent implements ComponentInterface
{
/**
* The type of component can be the following:
* dispatcher, error_handler, http, middleware
*
* Type of the component:
* container, dispatcher, debugger, http, middleware, template
*
* @var string
*/
protected $type = '';
Expand All @@ -30,35 +25,8 @@ abstract class AbstractComponent implements ComponentInterface
*
* @return string
*/
public function type()
{
// Converts the string from "snake_case" to "camelCase"
$words = ucwords(str_replace('_', ' ', $this->type));

return lcfirst(str_replace(' ', '', $words));
}

/**
* Defines the specified integration.
*
* @param \Rougin\Slytherin\Container\ContainerInterface $container
* @param \Rougin\Slytherin\Integration\Configuration $config
* @return \Rougin\Slytherin\Container\ContainerInterface
*/
public function define(ContainerInterface $container, Configuration $config)
{
$this->set($container);

return $container;
}

/**
* Sets the component. Has also an option to add it to the container.
*
* @param \Psr\Container\ContainerInterface $container
* @return void
*/
public function set(PsrContainerInterface &$container)
public function getType()
{
return $this->type;
}
}
Loading

0 comments on commit c254f51

Please sign in to comment.