• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CPS-IT / personio-jobs / 30881335721

04 Aug 2026 05:38AM UTC coverage: 3.194% (+0.06%) from 3.138%
30881335721

push

github

web-flow
Merge pull request #336 from CPS-IT/task/require-schema

[!!!][TASK] Move EXT:schema from suggestion to requirement

0 of 5 new or added lines in 2 files covered. (0.0%)

4 existing lines in 2 files now uncovered.

23 of 720 relevant lines covered (3.19%)

0.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Classes/Controller/JobController.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "personio_jobs".
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17

18
namespace CPSIT\Typo3PersonioJobs\Controller;
19

20
use Brotkrueml\Schema\Manager\SchemaManager;
21
use CPSIT\Typo3PersonioJobs\Cache\CacheManager;
22
use CPSIT\Typo3PersonioJobs\Domain\Factory\SchemaFactory;
23
use CPSIT\Typo3PersonioJobs\Domain\Model\Dto\ListDemand;
24
use CPSIT\Typo3PersonioJobs\Domain\Model\Job;
25
use CPSIT\Typo3PersonioJobs\Domain\Repository\JobRepository;
26
use CPSIT\Typo3PersonioJobs\PageTitle\JobPageTitleProvider;
27
use CPSIT\Typo3PersonioJobs\Service\PersonioApiService;
28
use Psr\Http\Message\ResponseInterface;
29
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
30
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
31

32
/**
33
 * JobController
34
 *
35
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
36
 * @license GPL-2.0-or-later
37
 */
38
class JobController extends ActionController
39
{
40
    public function __construct(
×
41
        protected readonly JobRepository $jobRepository,
42
        protected readonly MetaTagManagerRegistry $metaTagManagerRegistry,
43
        protected readonly JobPageTitleProvider $pageTitleProvider,
44
        protected readonly CacheManager $cacheManager,
45
        protected readonly PersonioApiService $personioApiService,
46
        protected readonly SchemaFactory $schemaFactory,
47
        protected readonly SchemaManager $schemaManager,
UNCOV
48
    ) {}
×
49

50
    public function listAction(): ResponseInterface
×
51
    {
52
        $this->cacheManager->addTag();
×
53

54
        $demand = ListDemand::fromArray($this->settings);
×
55
        $jobs = $this->jobRepository->findByDemand($demand);
×
56

57
        $this->view->assign('jobs', $jobs);
×
58

59
        return $this->htmlResponse();
×
60
    }
61

62
    public function showAction(Job $job): ResponseInterface
×
63
    {
64
        $this->cacheManager->addTag($job);
×
65

66
        $this->overwritePageTitle($job);
×
67
        $this->addMetaTags($job);
×
68
        $this->addSchema($job);
×
69

70
        $this->view->assign('job', $job);
×
71
        $this->view->assign('applyUrl', (string)$this->personioApiService->getApplyUrl($job));
×
72

73
        return $this->htmlResponse();
×
74
    }
75

76
    protected function overwritePageTitle(Job $job): void
×
77
    {
78
        $this->pageTitleProvider->setJob($job);
×
79
    }
80

81
    protected function addMetaTags(Job $job): void
×
82
    {
83
        $description = trim($this->generateDescription($job));
×
84
        $keywords = trim($job->getKeywords());
×
85

86
        // Add description
87
        if ($description !== '') {
×
88
            $this->addMetaTag('description', $description);
×
89
            $this->addMetaTag('og:description', $description);
×
90
            $this->addMetaTag('twitter:description', $description);
×
91
        }
92

93
        // Add keywords
94
        if ($keywords !== '') {
×
95
            $this->addMetaTag('keywords', $keywords);
×
96
        }
97
    }
98

99
    protected function addMetaTag(string $property, string $content): void
×
100
    {
101
        $metaTagManager = $this->metaTagManagerRegistry->getManagerForProperty($property);
×
102
        $metaTagManager->addProperty($property, $content);
×
103
    }
104

105
    protected function generateDescription(Job $job, int $maxLength = 150): string
×
106
    {
107
        $description = '';
×
108

109
        foreach ($job->getJobDescriptions() as $jobDescription) {
×
110
            $rawJobDescription = strip_tags($jobDescription->getBodytext());
×
111
            $description .= $rawJobDescription . ' ';
×
112

113
            if (mb_strlen($description) >= $maxLength) {
×
114
                break;
×
115
            }
116
        }
117

118
        return mb_strimwidth($description, 0, $maxLength, '…');
×
119
    }
120

121
    protected function addSchema(Job $job): void
×
122
    {
NEW
123
        $this->schemaManager->addType($this->schemaFactory->createJobPosting($job));
×
124
    }
125
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc