These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\SeoBundle\Controller; |
||
4 | |||
5 | use Kunstmaan\SeoBundle\Entity\Robots; |
||
6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
||
7 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||
8 | use Symfony\Component\HttpFoundation\Request; |
||
9 | use Symfony\Component\Routing\Annotation\Route; |
||
10 | |||
11 | class RobotsController extends Controller |
||
0 ignored issues
–
show
|
|||
12 | { |
||
13 | /** |
||
14 | * Generates the robots.txt content when available in the database and falls back to normal robots.txt if exists |
||
15 | * |
||
16 | * @Route(path="/robots.txt", name="KunstmaanSeoBundle_robots", defaults={"_format": "txt"}) |
||
17 | * @Template(template="@KunstmaanSeo/Admin/Robots/index.html.twig") |
||
18 | * |
||
19 | * @return array |
||
20 | */ |
||
21 | public function indexAction(Request $request) |
||
22 | { |
||
23 | $entity = $this->getDoctrine()->getRepository(Robots::class)->findOneBy([]); |
||
24 | $robots = $this->getParameter('robots_default'); |
||
25 | |||
26 | if ($entity && $entity->getRobotsTxt()) { |
||
27 | $robots = $entity->getRobotsTxt(); |
||
28 | } else { |
||
29 | $file = $request->getBasePath() . 'robots.txt'; |
||
30 | if (file_exists($file)) { |
||
31 | $robots = file_get_contents($file); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return ['robots' => $robots]; |
||
36 | } |
||
37 | } |
||
38 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.