我是PHP新手并尝试使用Slim PHP框架。这是StrongAuth类的代码片段。 __construct
函数接受配置数组,第二个参数接受我无法理解的实际含义。有人可以帮忙吗
namespace Slim\Extras\Middleware;
class StrongAuth extends \Slim\Middleware
{
/**
* @var array
*/
protected $settings = array(
'login.url' => '/',
'auth.type' => 'http',
'realm' => 'Protected Area',
);
/**
* Constructor
*
* @param array $config Configuration for Strong and Login Details
* @param \Strong\Strong $strong
* @return void
*/
public function __construct(array $config = array(), \Strong\Strong $strong = null)
{
$this->config = array_merge($this->settings, $config);
$this->auth = (!empty($strong)) ? $strong : \Strong\Strong::factory($this->config);
}