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

Commit

Permalink
* **05.06.2018** - [0.9.9] Interface implements for Utility Classes
Browse files Browse the repository at this point in the history
* **05.06.2018** - [0.9.9] + Datastorage()
  • Loading branch information
Sascha Ende committed Jun 5, 2018
1 parent 7e93a4e commit ec7fc0f
Show file tree
Hide file tree
Showing 26 changed files with 128 additions and 24 deletions.
7 changes: 7 additions & 0 deletions Classes/Controller/AbstractActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use SaschaEnde\T3helpers\Utilities\Configuration;
use SaschaEnde\T3helpers\Utilities\Data;
use SaschaEnde\T3helpers\Utilities\Database;
use SaschaEnde\T3helpers\Utilities\Datastorage;
use SaschaEnde\T3helpers\Utilities\Debug;
use SaschaEnde\T3helpers\Utilities\Filesystem;
use SaschaEnde\T3helpers\Utilities\FrontendUser;
Expand Down Expand Up @@ -47,6 +48,12 @@ class AbstractActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionC
*/
protected $Data;

/**
* @var Datastorage
* @inject
*/
protected $Datastorage;

/**
* @var Database
* @inject
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/BackendUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Backend Userdata is only available in Backend and on pages where the backend user has permissions. Otherwise this will return null
* @package SaschaEnde\T3helpers\Utilities
*/
class BackendUser implements SingletonInterface {
class BackendUser implements BackendUserInterface, SingletonInterface {

protected $beUser;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository;

class Category implements SingletonInterface {
class Category implements CategoryInterface, SingletonInterface {

/**
* CategoryRepository
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use TYPO3\CMS\Core\SingletonInterface;

class Command implements SingletonInterface {
class Command implements CommandInterface, SingletonInterface {

/**
* Call this in "ext_localconf.php"
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package SaschaEnde\T3helpers\Utilities
* @ignore
*/
class Configuration implements SingletonInterface {
class Configuration implements ConfigurationInterface, SingletonInterface {

private $configurationManager;
private $extensionConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class Data implements SingletonInterface {
class Data implements DataInterface, SingletonInterface {

/**
* Example: t3h::Data()->sortObjectStorage($users,'getUsername','asc')
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class Database implements SingletonInterface {
class Database implements DatabaseInterface, SingletonInterface {

/**
* @param bool $setRespectStoragePage
Expand Down
52 changes: 52 additions & 0 deletions Classes/Utilities/Datastorage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace SaschaEnde\T3helpers\Utilities;

use TYPO3\CMS\Core\SingletonInterface;

class Datastorage implements DatastorageInterface, SingletonInterface {

protected $Data = [];
protected $extension = '';

/**
* @param $extension
* @return $this
*/
public function extension($extension){
$this->extension = $extension;
return $this;
}

/**
* @param $key
* @param $data
*/
public function set($key,$data){
$this->Data[$this->extension][$key] = $data;
}


/**
* @param $key
* @param $data
* @return mixed|bool
*/
public function get($key,$data){
if($this->exists($key)){
return $this->Data[$this->extension][$key];
}else{
return false;
}
}

/**
* @param $key
* @return bool
*/
public function exists($key){
return isset($this->Data[$this->extension][$key]);
}


}
33 changes: 33 additions & 0 deletions Classes/Utilities/DatastorageInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace SaschaEnde\T3helpers\Utilities;

interface DatastorageInterface {


/**
* @param $extension
* @return $this
*/
public function extension($extension);

/**
* @param $key
* @param $data
*/
public function set($key,$data);


/**
* @param $key
* @param $data
* @return mixed|bool
*/
public function get($key,$data);

/**
* @param $key
* @return bool
*/
public function exists($key);
}
2 changes: 1 addition & 1 deletion Classes/Utilities/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

class Debug implements SingletonInterface {
class Debug implements DebugInterface, SingletonInterface {

/**
* @param $data
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

class Filesystem implements SingletonInterface {
class Filesystem implements FilesystemInterface, SingletonInterface {

/**
* Check if file exists in a folder
Expand Down
4 changes: 3 additions & 1 deletion Classes/Utilities/FrontendUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace SaschaEnde\T3helpers\Utilities;

class FrontendUser {
use TYPO3\CMS\Core\SingletonInterface;

class FrontendUser implements FrontendUserInterface, SingletonInterface {

/**
* @return User
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use TYPO3\CMS\Core\SingletonInterface;

class Google implements SingletonInterface {
class Google implements GoogleInterface, SingletonInterface {

/**
* @param $googleApiKey
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Injections.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class Injections implements SingletonInterface {
class Injections implements InjectionsInterface, SingletonInterface {

protected $extension;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use TYPO3\CMS\Core\SingletonInterface;

class Language implements SingletonInterface {
class Language implements LanguageInterface, SingletonInterface {

/**
* Get the current language
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class Mail implements SingletonInterface {
class Mail implements MailInterface, SingletonInterface {

/**
* @param $recipient
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

class Page implements SingletonInterface {
class Page implements PageInterface, SingletonInterface {

/**
* @return mixed|string
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use TYPO3\CMS\Saltedpasswords\Salt\SaltFactory;
use TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility;

class Password implements SingletonInterface {
class Password implements PasswordInterface, SingletonInterface {

/**
* Get the hashed password
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use TYPO3\CMS\Core\SingletonInterface;

class Session implements SingletonInterface {
class Session implements SessionInterface, SingletonInterface {

protected $extension;
protected $sessiondata = [];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;

class Settings implements SingletonInterface {
class Settings implements SettingsInterface, SingletonInterface {

/**
* @param $extensionName
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Fluid\View\StandaloneView;

class Template implements SingletonInterface {
class Template implements TemplateInterface, SingletonInterface {

public function render($extension, $path, $variables = []) {
$templatePathAndFilename = t3h::Filesystem()->getFileExtPath($extension,$path);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Tsfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class Tsfe implements SingletonInterface {
class Tsfe implements TsfeInterface, SingletonInterface {

/*
* Initialise tsfe
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utilities/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

use TYPO3\CMS\Core\SingletonInterface;

class Upload implements SingletonInterface {
class Upload implements UploadInterface, SingletonInterface {

}
2 changes: 1 addition & 1 deletion Classes/Utilities/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @link http://wissen.netzhaut.de/typo3/extensionentwicklung/typolink-realurl-in-scheduler-tasks/
* @package SaschaEnde\T3helpers\Utilities
*/
class Uri implements SingletonInterface {
class Uri implements UriInterface, SingletonInterface {

public function __construct() {
if (TYPO3_MODE == 'BE') {
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Helpers for Extbase: Simple and easy functions that make your TYPO3 life with ex

# Changelog

* **05.06.2018** - [0.9.9] Interface implements for Utility Classes
* **05.06.2018** - [0.9.9] + Datastorage()
* **01.06.2018** - [0.9.9] Settings()->getExtension($extensionName, $part = 'settings')
* **24.05.2018** - [0.9.9] Database()->getQuerybuilder($table, $addFrom = true)

Expand Down
14 changes: 11 additions & 3 deletions Resources/Private/Libraries/t3helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use SaschaEnde\T3helpers\Utilities\ConfigurationInterface;
use SaschaEnde\T3helpers\Utilities\DatabaseInterface;
use SaschaEnde\T3helpers\Utilities\DataInterface;
use SaschaEnde\T3helpers\Utilities\DatastorageInterface;
use SaschaEnde\T3helpers\Utilities\DebugInterface;
use SaschaEnde\T3helpers\Utilities\FilesystemInterface;
use SaschaEnde\T3helpers\Utilities\FrontendUserInterface;
Expand Down Expand Up @@ -157,24 +158,31 @@ public static function Tsfe() {
/**
* @return CategoryInterface
*/
public static function Category(){
public static function Category() {
return self::injectClass(CategoryInterface::class);
}

/**
* @return CommandInterface
*/
public static function Command(){
public static function Command() {
return self::injectClass(CommandInterface::class);
}

/**
* @return FrontendUserInterface
*/
public static function FrontendUser(){
public static function FrontendUser() {
return self::injectClass(FrontendUserInterface::class);
}

/**
* @return DatastorageInterface
*/
public static function Datastorage() {
return self::injectClass(DatastorageInterface::class);
}

// ---------------------------------------------------------------------------------
// Objectmanager
// ---------------------------------------------------------------------------------
Expand Down

0 comments on commit ec7fc0f

Please sign in to comment.