Skip to content

Commit 5c73404

Browse files
committed
[WIP] Refactorings
1 parent c2d9080 commit 5c73404

File tree

13 files changed

+293
-161
lines changed

13 files changed

+293
-161
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.idea
2+
.Build
3+
composer.lock

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
How to contribute
2+
=================
3+
Hey, great you want to contribute to ``personio``.
4+
5+
Submitting feedback
6+
===================
7+
Please report feedback, bugs and feature requests on [GitHub](https://github.com/dauskonzept/personio/issues)
8+
Note, that the GitHub issue tracker is not a support forum.
9+
10+
I'm always willing to help user of ``personio`` with potential problems, but please understand, that I will
11+
not fix templates, code or misconfigured TYPO3 websites in commercial projects for free. If you need
12+
commercial support, please contact me by email.
13+
14+
Submitting new features
15+
=======================
16+
Not every feature is relevant for the bulk of ``personio`` users, so please discuss new features in the
17+
issue tracker on [GitHub](https://github.com/dauskonzept/personio/issues) before starting to code.
18+
19+
Submitting changes
20+
==================
21+
* Create a fork of the ``personio`` repository on GitHub
22+
* Create a new branch from the current main branch
23+
* Make your changes
24+
* Make sure your code complies with the coding standard
25+
* Make sure all unit- and functional tests are working (will also automatically be checked by GitHub Actions)
26+
* Add new unit-, functional and/or acceptance tests for your new code
27+
* Extend the existing documentation if required
28+
* Commit your changes and make sure to add a proper commit message
29+
* Examples for a proper [commit message](https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/Appendix/GeneralTopics/CommitMessage.html)
30+
* Create a Pull Request on GitHub
31+
* Describe your changes. The better you describe your change and the reasons for it the more likely it is that it will be accepted.
32+
33+
Coding Standards
34+
================
35+
The ``personio`` codebase follows [PSR-1](https://www.php-fig.org/psr/psr-1/),
36+
[PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-12](https://www.php-fig.org/psr/psr-12/) standards for code formatting.
37+
38+
Testing
39+
=======
40+
A wide range of the codebase of ``personio`` is covered by unit- and functional tests. If you submit a pull
41+
request without tests, this is ok, but please note, that it may take longer time to merge your pull requests in
42+
this case, since I may have to create the tests for your code.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

3-
namespace DSKZPT\Personio\Service;
3+
declare(strict_types=1);
44

5+
namespace DSKZPT\Personio\Client;
6+
7+
use Psr\Http\Message\RequestFactoryInterface;
58
use SimpleXMLElement;
69
use TYPO3\CMS\Core\Utility\GeneralUtility;
7-
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
8-
use Psr\Http\Message\RequestFactoryInterface;
910

10-
class PersonioService extends ActionController
11+
class PersonioApiClient
1112
{
1213
private RequestFactoryInterface $requestFactory;
1314

14-
public function __construct()
15-
{
15+
public function __construct() {
1616
$this->requestFactory = GeneralUtility::makeInstance(RequestFactoryInterface::class);
1717
}
1818

Classes/Controller/PersonioController.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DSKZPT\Personio\Controller;
46

57
use TYPO3\CMS\Core\Utility\GeneralUtility;
68
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
7-
use DSKZPT\Personio\Service\PersonioService;
9+
use DSKZPT\Personio\Client\PersonioApiClient;
810

911
class PersonioController extends ActionController
1012
{
1113
private string $feedUrl = '';
1214

13-
protected ?PersonioService $personioService = null;
15+
protected ?PersonioApiClient $personioApiClient = null;
1416

1517
protected function initializeAction(): void
1618
{
1719
$this->buildSettings();
18-
$this->personioService = GeneralUtility::makeInstance(PersonioService::class);
20+
$this->personioApiClient = GeneralUtility::makeInstance(PersonioApiClient::class);
1921
$this->feedUrl = sprintf('%s?language=%s', $this->settings['feedUrl'], $this->settings['language']);
2022
}
2123

@@ -27,7 +29,7 @@ public function listAction(): void
2729
}
2830
}
2931

30-
$items = $this->personioService->fetchFeedItems($this->feedUrl);
32+
$items = $this->personioApiClient->fetchFeedItems($this->feedUrl);
3133

3234
if (!empty($this->settings['filter'])) {
3335
$items = array_filter($items, array($this, 'filterItems'), ARRAY_FILTER_USE_BOTH);
@@ -46,7 +48,7 @@ public function showAction(): void
4648

4749
$uid = $this->request->getArgument('uid');
4850

49-
$items = $this->personioService->fetchFeedItems($this->feedUrl);
51+
$items = $this->personioApiClient->fetchFeedItems($this->feedUrl);
5052
$item = $items[array_search($uid, array_column($items, 'id'))];
5153

5254
$this->view->assignMultiple([

Classes/Hook/ItemsProcFunc.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DSKZPT\Personio\Hook;
46

5-
use DSKZPT\Personio\Service\PersonioService;
7+
use DSKZPT\Personio\Client\PersonioApiClient;
8+
use TYPO3\CMS\Core\Utility\GeneralUtility;
69

710
class ItemsProcFunc
811
{
@@ -21,8 +24,8 @@ public function getFilterValues(array &$params): void
2124
return;
2225
}
2326

24-
$personioService = new PersonioService();
25-
$items = $personioService->fetchFeedItems($feedUrl);
27+
$personioApiClient = GeneralUtility::makeInstance(PersonioApiClient::class);
28+
$items = $personioApiClient->fetchFeedItems($feedUrl);
2629

2730
$explode = explode('.', $params['field']);
2831

Configuration/FlexForms/List.xml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,6 @@
101101
</config>
102102
</TCEforms>
103103
</settings.overwrite.showPageUid>
104-
<!-- Custom Text -->
105-
<settings.text>
106-
<TCEforms>
107-
<label>
108-
LLL:EXT:personio/Resources/Private/Language/locallang_be.xlf:flexforms_settings.text
109-
</label>
110-
<config>
111-
<type>input</type>
112-
<size>255</size>
113-
<max>255</max>
114-
<eval>trim</eval>
115-
</config>
116-
</TCEforms>
117-
</settings.text>
118104
</el>
119105
</ROOT>
120106
</sDEF>

Configuration/TCA/Overrides/tt_content.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
2-
defined('TYPO3') or die();
32

4-
(static function() {
3+
defined('TYPO3_MODE') or die();
54

5+
(static function() {
66
// List Plugin
77
$pluginSignature = 'personio_list';
88
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(

Configuration/TsConfig/ContentElementWizard.tsconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ mod.wizards.newContentElement.wizardItems.plugins {
44
iconIdentifier = ext-personio-element-list
55
title = LLL:EXT:personio/Resources/Private/Language/locallang_be.xlf:element_personio_list_title
66
description = LLL:EXT:personio/Resources/Private/Language/locallang_be.xlf:element_personio_list_description
7+
78
tt_content_defValues {
89
CType = list
910
list_type = personio_list
1011
}
1112
}
13+
1214
personio_show {
1315
iconIdentifier = ext-personio-element-show
1416
title = LLL:EXT:personio/Resources/Private/Language/locallang_be.xlf:element_personio_show_title
1517
description = LLL:EXT:personio/Resources/Private/Language/locallang_be.xlf:element_personio_show_description
18+
1619
tt_content_defValues {
1720
CType = list
1821
list_type = personio_show
1922
}
2023
}
2124
}
22-
}
25+
}

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
1-
**Route Enhancers**
1+
TYPO3 Extension "personio"
2+
=================================
3+
4+
## What does it do?
5+
Display job offers via the offical Personio XML Feed.
6+
7+
## Installation
8+
The recommended way to install the extension is by
9+
using [Composer](https://getcomposer.org/). In your Composer based TYPO3 project
10+
root, just run:
11+
<pre>composer require dskzpt/personio</pre>
12+
13+
## Setup
14+
15+
1. Install the extension
16+
2. Include the provided static typoscript
17+
3. Add a "Personio: Job List" to any page of your choice
18+
4. Configure the Plugin via it's flexform
19+
20+
## Route Enhancers
21+
In order to generate a nicer URL you can use the following Route Enhancer.
22+
The UID of the Job offering will then be use for the detail page URL.
23+
224
```
325
routeEnhancers:
426
Personio:
527
limitToPages:
6-
- 26
28+
- XX
729
type: Extbase
830
extension: Personio
931
plugin: Show
@@ -13,4 +35,11 @@ routeEnhancers:
1335
_controller: 'Personio::show'
1436
defaultController: 'Personio::show'
1537
```
16-
*26=Uid of your page with a show plugin
38+
*XX = Uid of your page with a show plugin
39+
40+
41+
## Contributing
42+
43+
Please refer to the [contributing](CONTRIBUTING.md) document included in this
44+
repository.
45+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
22

33
<div class="tx-personio">
4-
<f:render section="main" />
4+
<f:render section="main"/>
55
</div>
66

77
</html>

0 commit comments

Comments
 (0)