f6db13d96fffc5ccf4237340875f19df60e176be
[yaffs-website] / web / modules / contrib / hacked / src / ParamConverter / HackedProjectConverter.php
1 <?php
2
3 namespace Drupal\hacked\ParamConverter;
4
5 use Drupal\Core\ParamConverter\ParamConverterInterface;
6 use Drupal\hacked\hackedProject;
7 use Symfony\Component\Routing\Route;
8
9 /**
10  * Parameter converter for upcasting entity ids to full objects.
11  */
12 class HackedProjectConverter implements ParamConverterInterface {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function convert($value, $definition, $name, array $defaults) {
18     return new hackedProject($value);
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   public function applies($definition, $name, Route $route) {
25     return (!empty($definition['type']) && $definition['type'] === 'hacked_project');
26   }
27
28 }