Fixed code style.

This commit is contained in:
Jan Böhmer 2020-01-04 20:24:09 +01:00
parent 1aed1d1d26
commit 9a7223a301
142 changed files with 534 additions and 716 deletions

View file

@ -61,8 +61,6 @@ class AttachmentManager
* or is not existing.
*
* @param Attachment $attachment The attachment for which the filepath should be determined
*
* @return string|null
*/
public function toAbsoluteFilePath(Attachment $attachment): ?string
{
@ -96,7 +94,7 @@ class AttachmentManager
*
* @param Attachment $attachment The attachment for which the existence should be checked
*
* @return bool True if the file is existing.
* @return bool true if the file is existing
*/
public function isFileExisting(Attachment $attachment): bool
{
@ -111,9 +109,7 @@ class AttachmentManager
* Returns the filesize of the attachments in bytes.
* For external attachments or not existing attachments, null is returned.
*
* @param Attachment $attachment The filesize for which the filesize should be calculated.
*
* @return int|null
* @param Attachment $attachment the filesize for which the filesize should be calculated
*/
public function getFileSize(Attachment $attachment): ?int
{

View file

@ -44,11 +44,11 @@ class AttachmentPathResolver
/**
* AttachmentPathResolver constructor.
*
* @param string $project_dir The kernel that should be used to resolve the project dir.
* @param string $media_path The path where uploaded attachments should be stored.
* @param string $project_dir the kernel that should be used to resolve the project dir
* @param string $media_path the path where uploaded attachments should be stored
* @param string|null $footprints_path The path where builtin attachments are stored.
* Set to null if this ressource should be disabled.
* @param string|null $models_path Set to null if this ressource should be disabled.
* @param string|null $models_path set to null if this ressource should be disabled
*/
public function __construct(string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path)
{
@ -83,8 +83,6 @@ class AttachmentPathResolver
* @internal
*
* @param string|null $param_path The parameter value that should be converted to a absolute path
*
* @return string|null
*/
public function parameterToAbsolutePath(?string $param_path): ?string
{
@ -120,8 +118,6 @@ class AttachmentPathResolver
* Create an array usable for preg_replace out of an array of placeholders or pathes.
* Slashes and other chars become escaped.
* For example: '%TEST%' becomes '/^%TEST%/'.
*
* @return array
*/
protected function arrayToRegexArray(array $array): array
{
@ -139,7 +135,7 @@ class AttachmentPathResolver
* Converts an relative placeholder filepath (with %MEDIA% or older %BASE%) to an absolute filepath on disk.
* The directory separator is always /. Relative pathes are not realy possible (.. is striped).
*
* @param string $placeholder_path The filepath with placeholder for which the real path should be determined.
* @param string $placeholder_path the filepath with placeholder for which the real path should be determined
*
* @return string|null The absolute real path of the file, or null if the placeholder path is invalid
*/
@ -175,7 +171,7 @@ class AttachmentPathResolver
/**
* Converts an real absolute filepath to a placeholder version.
*
* @param string $real_path The absolute path, for which the placeholder version should be generated.
* @param string $real_path the absolute path, for which the placeholder version should be generated
* @param bool $old_version By default the %MEDIA% placeholder is used, which is directly replaced with the
* media directory. If set to true, the old version with %BASE% will be used, which is the project directory.
*
@ -213,7 +209,7 @@ class AttachmentPathResolver
/**
* The path where uploaded attachments is stored.
*
* @return string The absolute path to the media folder.
* @return string the absolute path to the media folder
*/
public function getMediaPath(): string
{
@ -224,7 +220,7 @@ class AttachmentPathResolver
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
* via the attachment controller.
*
* @return string The absolute path to the secure path.
* @return string the absolute path to the secure path
*/
public function getSecurePath(): string
{

View file

@ -51,7 +51,7 @@ class AttachmentReverseSearch
*
* @param \SplFileInfo $file The file for which is searched
*
* @return Attachment[] An list of attachments that use the given file.
* @return Attachment[] an list of attachments that use the given file
*/
public function findAttachmentsByFile(\SplFileInfo $file): array
{
@ -69,7 +69,7 @@ class AttachmentReverseSearch
* Deletes the given file if it is not used by more than $threshold attachments.
*
* @param \SplFileInfo $file The file that should be removed
* @param int $threshold The threshold used, to determine if a file should be deleted or not.
* @param int $threshold the threshold used, to determine if a file should be deleted or not
*
* @return bool True, if the file was delete. False if not.
*/

View file

@ -89,7 +89,7 @@ class AttachmentSubmitHandler
* @param Attachment $attachment The attachment that should be used for generating an attachment
* @param string $extension The extension that the new file should have (must only contain chars allowed in pathes)
*
* @return string The new filename.
* @return string the new filename
*/
public function generateAttachmentFilename(Attachment $attachment, string $extension): string
{
@ -114,7 +114,7 @@ class AttachmentSubmitHandler
* @param Attachment $attachment The attachment that should be used for
* @param bool $secure_upload True if the file path should be located in a safe location
*
* @return string The absolute path for the attachment folder.
* @return string the absolute path for the attachment folder
*/
public function generateAttachmentPath(Attachment $attachment, bool $secure_upload = false): string
{
@ -143,7 +143,7 @@ class AttachmentSubmitHandler
* Handle the submit of an attachment form.
* This function will move the uploaded file or download the URL file to server, if needed.
*
* @param Attachment $attachment The attachment that should be used for handling.
* @param Attachment $attachment the attachment that should be used for handling
* @param UploadedFile|null $file If given, that file will be moved to the right location
* @param array $options The options to use with the upload. Here you can specify that an URL should be downloaded,
* or an file should be moved to a secure location.
@ -181,8 +181,8 @@ class AttachmentSubmitHandler
/**
* Move the given attachment to secure location (or back to public folder) if needed.
*
* @param Attachment $attachment The attachment for which the file should be moved.
* @param bool $secure_location This value determines, if the attachment is moved to the secure or public folder.
* @param Attachment $attachment the attachment for which the file should be moved
* @param bool $secure_location this value determines, if the attachment is moved to the secure or public folder
*
* @return Attachment The attachment with the updated filepath
*/

View file

@ -53,7 +53,7 @@ class AttachmentURLGenerator
* Converts the absolute file path to a version relative to the public folder, that can be passed to asset
* Asset Component functions.
*
* @param string $absolute_path The absolute path that should be converted.
* @param string $absolute_path the absolute path that should be converted
* @param string|null $public_path The public path to which the relative pathes should be created.
* The path must NOT have a trailing slash!
* If this is set to null, the global public/ folder is used.
@ -78,8 +78,6 @@ class AttachmentURLGenerator
/**
* Returns a URL under which the attachment file can be viewed.
*
* @return string
*/
public function getViewURL(Attachment $attachment): string
{
@ -101,8 +99,6 @@ class AttachmentURLGenerator
/**
* Returns a URL to an thumbnail of the attachment file.
*
* @return string
*/
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): string
{
@ -137,8 +133,6 @@ class AttachmentURLGenerator
/**
* Returns a download link to the file associated with the attachment.
*
* @return string
*/
public function getDownloadURL(Attachment $attachment): string
{

View file

@ -55,7 +55,7 @@ class BuiltinAttachmentsFinder
* The array is a list of the relative filenames using the %PLACEHOLDERS%.
* The list contains the files from all configured valid ressoureces.
*
* @return array The list of the ressources, or an empty array if an error happened.
* @return array the list of the ressources, or an empty array if an error happened
*/
public function getListOfRessources(): array
{
@ -92,9 +92,9 @@ class BuiltinAttachmentsFinder
/**
* Find all ressources which are matching the given keyword and the specified options.
*
* @param string $keyword The keyword you want to search for.
* @param string $keyword the keyword you want to search for
* @param array $options Here you can specify some options (see configureOptions for list of options)
* @param array|null $base_list The list from which should be used as base for filtering.
* @param array|null $base_list the list from which should be used as base for filtering
*
* @return array The list of the results matching the specified keyword and options
*/

View file

@ -53,9 +53,9 @@ class FileTypeFilterTools
/**
* Check if a filetype filter string is valid.
*
* @param string $filter The filter string that should be validated.
* @param string $filter the filter string that should be validated
*
* @return bool Returns true, if the string is valid.
* @return bool returns true, if the string is valid
*/
public function validateFilterString(string $filter): bool
{
@ -84,7 +84,7 @@ class FileTypeFilterTools
* Normalize a filter string. All extensions are converted to lowercase, too much whitespaces are removed.
* The filter string is not validated.
*
* @param string $filter The filter string that should be normalized.
* @param string $filter the filter string that should be normalized
*
* @return string The normalized filter string
*/
@ -131,7 +131,7 @@ class FileTypeFilterTools
/**
* Get a list of all file extensions that matches the given filter string.
*
* @param string $filter A valid filetype filter string.
* @param string $filter a valid filetype filter string
*
* @return string[] An array of allowed extensions ['txt', 'csv', 'gif']
*/
@ -166,10 +166,10 @@ class FileTypeFilterTools
/**
* Check if the given extension matches the filter.
*
* @param string $filter The filter which should be used for checking.
* @param string $extension The extension that should be checked.
* @param string $filter the filter which should be used for checking
* @param string $extension the extension that should be checked
*
* @return bool Returns true, if the extension is allowed with the given filter.
* @return bool returns true, if the extension is allowed with the given filter
*/
public function isExtensionAllowed(string $filter, string $extension): bool
{

View file

@ -38,7 +38,7 @@ class PartPreviewGenerator
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
*
* @param Part $part The part for which the attachments should be determined.
* @param Part $part the part for which the attachments should be determined
*
* @return Attachment[]
*/
@ -97,8 +97,6 @@ class PartPreviewGenerator
* The returned attachment is guaranteed to be existing and be a picture.
*
* @param Part $part The part for which the attachment should be determined
*
* @return Attachment|null
*/
public function getTablePreviewAttachment(Part $part): ?Attachment
{
@ -123,9 +121,9 @@ class PartPreviewGenerator
/**
* Checks if a attachment is exising and a valid picture.
*
* @param Attachment|null $attachment The attachment that should be checked.
* @param Attachment|null $attachment the attachment that should be checked
*
* @return bool True if the attachment is valid.
* @return bool true if the attachment is valid
*/
protected function isAttachmentValidPicture(?Attachment $attachment): bool
{