diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-07-04 22:13:32 +0330 |
---|---|---|
committer | Faraz Samapoor <fsa@adlas.at> | 2023-07-12 18:29:32 +0330 |
commit | 5d242aa2f86f003bb5f0400188a440d2d5eea68f (patch) | |
tree | 514599caddf25a0b6d8414ce510f7b4c41f03b62 /apps/files/lib/Command/Object/Put.php | |
parent | 706c141fffce928d344fe2f039da549fad065393 (diff) | |
download | nextcloud-server-5d242aa2f86f003bb5f0400188a440d2d5eea68f.tar.gz nextcloud-server-5d242aa2f86f003bb5f0400188a440d2d5eea68f.zip |
Refactors files app commands.
To improve code readability.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
Diffstat (limited to 'apps/files/lib/Command/Object/Put.php')
-rw-r--r-- | apps/files/lib/Command/Object/Put.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/apps/files/lib/Command/Object/Put.php b/apps/files/lib/Command/Object/Put.php index dabc2b1ffc3..852d7c2225e 100644 --- a/apps/files/lib/Command/Object/Put.php +++ b/apps/files/lib/Command/Object/Put.php @@ -33,12 +33,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class Put extends Command { - private ObjectUtil $objectUtils; - private IMimeTypeDetector $mimeTypeDetector; - - public function __construct(ObjectUtil $objectUtils, IMimeTypeDetector $mimeTypeDetector) { - $this->objectUtils = $objectUtils; - $this->mimeTypeDetector = $mimeTypeDetector; + public function __construct( + private ObjectUtil $objectUtils, + private IMimeTypeDetector $mimeTypeDetector, + ) { parent::__construct(); } @@ -75,10 +73,10 @@ class Put extends Command { $source = $inputName === '-' ? STDIN : fopen($inputName, 'r'); if (!$source) { $output->writeln("<error>Failed to open $inputName</error>"); - return 1; + return self::FAILURE; } $objectStore->writeObject($object, $source, $this->mimeTypeDetector->detectPath($inputName)); - return 0; + return self::SUCCESS; } } |