Skip to content

Commit

Permalink
Consistently use namespace declaration and avoid namespaces in code
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Sep 13, 2023
1 parent 109c485 commit b6024d5
Show file tree
Hide file tree
Showing 53 changed files with 194 additions and 131 deletions.
5 changes: 3 additions & 2 deletions Classes/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;

Expand Down Expand Up @@ -68,7 +69,7 @@ class BaseCommand extends Command
protected $storagePid;

/**
* @var \Kitodo\Dlf\Domain\Model\Library
* @var Library
*/
protected $owner;

Expand All @@ -91,7 +92,7 @@ protected function initializeRepositories($storagePid)
{
if (MathUtility::canBeInterpretedAsInteger($storagePid)) {
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
$frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$frameworkConfiguration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);

$frameworkConfiguration['persistence']['storagePid'] = MathUtility::forceIntegerInRange((int) $storagePid, 0);
$configurationManager->setConfiguration($frameworkConfiguration);
Expand Down
6 changes: 3 additions & 3 deletions Classes/Common/Doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ abstract class Doc
/**
* This holds the singleton object of the document
*
* @var array (\Kitodo\Dlf\Common\Doc)
* @var array (Doc)
* @static
* @access protected
*/
Expand Down Expand Up @@ -402,7 +402,7 @@ public abstract function getFileMimeType($id);
* @param array $settings
* @param bool $forceReload: Force reloading the document instead of returning the cached instance
*
* @return \Kitodo\Dlf\Common\Doc|null Instance of this class, either MetsDocument or IiifManifest
* @return Doc|null Instance of this class, either MetsDocument or IiifManifest
*/
public static function &getInstance($location, $settings = [], $forceReload = false)
{
Expand Down Expand Up @@ -1168,7 +1168,7 @@ protected function _setCPid($value)

/**
* This is a singleton class, thus the constructor should be private/protected
* (Get an instance of this class by calling \Kitodo\Dlf\Common\Doc::getInstance())
* (Get an instance of this class by calling Doc::getInstance())
*
* @access protected
*
Expand Down
13 changes: 7 additions & 6 deletions Classes/Common/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;


/**
* Helper class for the 'dlf' extension
*
Expand Down Expand Up @@ -84,14 +86,13 @@ class Helper
* @param bool $session: Should the message be saved in the user's session?
* @param string $queue: The queue's unique identifier
*
* @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
* @return FlashMessageQueue The queue the message was added to
*/
public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
{
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
$flashMessage = GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class,
$message,
$title,
$severity,
Expand Down Expand Up @@ -650,7 +651,7 @@ public static function renderFlashMessages($queue = 'kitodo.default.flashMessage
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
$flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
$content = GeneralUtility::makeInstance(\Kitodo\Dlf\Common\KitodoFlashMessageRenderer::class)
$content = GeneralUtility::makeInstance(KitodoFlashMessageRenderer::class)
->render($flashMessages);
return $content;
}
Expand Down Expand Up @@ -860,7 +861,7 @@ public static function polyfillExtbaseClassesForTYPO3v9()

$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$frameworkConfiguration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);

$extbaseClassmap = &$frameworkConfiguration['persistence']['classes'];
if ($extbaseClassmap === null) {
Expand Down
10 changes: 5 additions & 5 deletions Classes/Common/IiifManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ final class IiifManifest extends Doc
protected $originalMetadataArray = [];

/**
* Holds the mime types of linked resources in the manifest (extreacted during parsing) for later use.
* Holds the mime types of linked resources in the manifest (extracted during parsing) for later use.
* @var array
* @access protected
*/
Expand Down Expand Up @@ -857,7 +857,7 @@ protected function loadLocation($location)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
* @see Doc::prepareMetadataArray()
*/
protected function prepareMetadataArray($cPid)
{
Expand All @@ -880,7 +880,7 @@ protected function setPreloadedDocument($preloadedDocument)

/**
* {@inheritDoc}
* @see Docu::ensureHasFulltextIsSet()
* @see Doc::ensureHasFulltextIsSet()
*/
protected function ensureHasFulltextIsSet()
{
Expand Down Expand Up @@ -927,7 +927,7 @@ protected function ensureHasFulltextIsSet()

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
* @see Doc::_getThumbnail()
*/
protected function _getThumbnail($forceReload = false)
{
Expand All @@ -936,7 +936,7 @@ protected function _getThumbnail($forceReload = false)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
* @see Doc::_getToplevelId()
*/
protected function _getToplevelId()
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/Common/IiifUrlReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IiifUrlReader implements UrlReaderInterface
/**
*
* {@inheritDoc}
* @see \Ubl\Iiif\Tools\UrlReaderInterface::getContent()
* @see UrlReaderInterface::getContent()
*/
public function getContent($url)
{
Expand Down
14 changes: 8 additions & 6 deletions Classes/Common/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Kitodo\Dlf\Common\Solr\Solr;
use Kitodo\Dlf\Domain\Repository\DocumentRepository;
use Kitodo\Dlf\Domain\Model\Document;
use Solarium\Core\Query\DocumentInterface;
use Solarium\QueryType\Update\Query\Query;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Messaging\FlashMessage;
Expand Down Expand Up @@ -87,7 +89,7 @@ class Indexer
*
* @access public
*
* @param \Kitodo\Dlf\Domain\Model\Document $document: The document to add
* @param Document $document: The document to add
*
* @return bool true on success or false on failure
*/
Expand Down Expand Up @@ -300,7 +302,7 @@ protected static function loadIndexConf($pid)
*
* @access protected
*
* @param \Kitodo\Dlf\Domain\Model\Document $document: The METS document
* @param Document $document: The METS document
* @param array $logicalUnit: Array of the logical unit to process
*
* @return bool true on success or false on failure
Expand Down Expand Up @@ -429,7 +431,7 @@ protected static function processLogical(Document $document, array $logicalUnit)
*
* @access protected
*
* @param \Kitodo\Dlf\Domain\Model\Document $document: The METS document
* @param Document $document: The METS document
* @param int $page: The page number
* @param array $physicalUnit: Array of the physical unit to process
*
Expand Down Expand Up @@ -545,12 +547,12 @@ protected static function solrConnect($core, $pid = 0)
*
* @access private
*
* @param \Solarium\QueryType\Update\Query\Query $updateQuery solarium query
* @param \Kitodo\Dlf\Domain\Model\Document $document: The METS document
* @param Query $updateQuery solarium query
* @param Document $document: The METS document
* @param array $unit: Array of the logical or physical unit to process
* @param string $fullText: Text containing full text for indexing
*
* @return \Solarium\Core\Query\DocumentInterface
* @return DocumentInterface
*/
private static function getSolrDocument($updateQuery, $document, $unit, $fullText = '') {
$solrDoc = $updateQuery->createDocument();
Expand Down
3 changes: 2 additions & 1 deletion Classes/Common/KitodoFlashMessageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Kitodo\Dlf\Common;

use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\Renderer\FlashMessageRendererInterface;

/**
* A class representing a bootstrap flash messages.
Expand All @@ -21,7 +22,7 @@
* The created output contains all classes which are required for
* the TYPO3 backend. Any kind of message contains also a nice icon.
*/
class KitodoFlashMessageRenderer implements \TYPO3\CMS\Core\Messaging\Renderer\FlashMessageRendererInterface
class KitodoFlashMessageRenderer implements FlashMessageRendererInterface
{
/**
* @var string The message severity class names
Expand Down
30 changes: 15 additions & 15 deletions Classes/Common/MetsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function addMetadataFromMets(&$metadata, $id)
/**
*
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::establishRecordId()
* @see Doc::establishRecordId()
*/
protected function establishRecordId($pid)
{
Expand All @@ -210,7 +210,7 @@ protected function establishRecordId($pid)
/**
*
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getDownloadLocation()
* @see Doc::getDownloadLocation()
*/
public function getDownloadLocation($id)
{
Expand All @@ -236,7 +236,7 @@ public function getDownloadLocation($id)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getFileLocation()
* @see Doc::getFileLocation()
*/
public function getFileLocation($id)
{
Expand All @@ -254,7 +254,7 @@ public function getFileLocation($id)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getFileMimeType()
* @see Doc::getFileMimeType()
*/
public function getFileMimeType($id)
{
Expand All @@ -272,7 +272,7 @@ public function getFileMimeType($id)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getLogicalStructure()
* @see Doc::getLogicalStructure()
*/
public function getLogicalStructure($id, $recursive = false)
{
Expand Down Expand Up @@ -421,7 +421,7 @@ protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recurs

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getMetadata()
* @see Doc::getMetadata()
*/
public function getMetadata($id, $cPid = 0)
{
Expand Down Expand Up @@ -700,7 +700,7 @@ protected function getMetadataIds($id)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::getFullText()
* @see Doc::getFullText()
*/
public function getFullText($id)
{
Expand Down Expand Up @@ -730,7 +730,7 @@ public function getStructureDepth($logId)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::init()
* @see Doc::init()
*/
protected function init($location)
{
Expand All @@ -755,7 +755,7 @@ protected function init($location)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::loadLocation()
* @see Doc::loadLocation()
*/
protected function loadLocation($location)
{
Expand All @@ -774,7 +774,7 @@ protected function loadLocation($location)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet()
* @see Doc::ensureHasFulltextIsSet()
*/
protected function ensureHasFulltextIsSet()
{
Expand Down Expand Up @@ -974,7 +974,7 @@ protected function _getFileInfos()

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray()
* @see Doc::prepareMetadataArray()
*/
protected function prepareMetadataArray($cPid)
{
Expand Down Expand Up @@ -1002,7 +1002,7 @@ protected function _getMets()

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure()
* @see Doc::_getPhysicalStructure()
*/
protected function _getPhysicalStructure()
{
Expand Down Expand Up @@ -1065,7 +1065,7 @@ protected function _getPhysicalStructure()

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getSmLinks()
* @see Doc::_getSmLinks()
*/
protected function _getSmLinks()
{
Expand All @@ -1084,7 +1084,7 @@ protected function _getSmLinks()

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getThumbnail()
* @see Doc::_getThumbnail()
*/
protected function _getThumbnail($forceReload = false)
{
Expand Down Expand Up @@ -1164,7 +1164,7 @@ protected function _getThumbnail($forceReload = false)

/**
* {@inheritDoc}
* @see \Kitodo\Dlf\Common\Doc::_getToplevelId()
* @see Doc::_getToplevelId()
*/
protected function _getToplevelId()
{
Expand Down
Loading

0 comments on commit b6024d5

Please sign in to comment.