Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from pborreli/tabs
Browse files Browse the repository at this point in the history
Removed tabs
  • Loading branch information
dongilbert committed Nov 2, 2013
2 parents d724115 + d9cb4ca commit 3a8ff4d
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/League/StackRobots/Robots.php
Expand Up @@ -13,42 +13,42 @@ class Robots implements HttpKernelInterface
*/
private $app;

/**
* @var string
*/
private $env;

/**
* @var string
*/
private $envVar;

/**
* Constructor
*
* @param HttpKernelInterface $app
* @param string $env The environment variable to compare against.
* @param string $envVar The environment variable to inspect.
*/
public function __construct(HttpKernelInterface $app, $env = 'production', $envVar = 'SERVER_ENV')
/**
* @var string
*/
private $env;

/**
* @var string
*/
private $envVar;

/**
* Constructor
*
* @param HttpKernelInterface $app
* @param string $env The environment variable to compare against.
* @param string $envVar The environment variable to inspect.
*/
public function __construct(HttpKernelInterface $app, $env = 'production', $envVar = 'SERVER_ENV')
{
$this->app = $app;
$this->env = $env;
$this->envVar = $envVar;
$this->envVar = $envVar;
}

/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if (getenv($this->envVar) !== $this->env) {
// @TODO: Add support for X-Robots-Tag
if (getenv($this->envVar) !== $this->env) {
// @TODO: Add support for X-Robots-Tag

if ($request->getPathInfo() === '/robots.txt') {
return new Response("User-Agent: *\nDisallow: /", 200, array('Content-Type' => 'text/plain'));
}
}
if ($request->getPathInfo() === '/robots.txt') {
return new Response("User-Agent: *\nDisallow: /", 200, array('Content-Type' => 'text/plain'));
}
}

return $this->app->handle($request, $type, $catch);
}
Expand Down

0 comments on commit 3a8ff4d

Please sign in to comment.