22
33namespace Netgen \Bundle \EnhancedBinaryFileBundle \FieldHandler ;
44
5- use DOMDocument ;
65use eZ \Publish \API \Repository \Values \ContentType \FieldDefinition ;
76use eZ \Publish \Core \FieldType \Value ;
8- use eZ \Publish \Core \IO \IOServiceInterface ;
97use Netgen \Bundle \EnhancedBinaryFileBundle \Core \FieldType \EnhancedBinaryFile \Value as EnhancedBinaryFileValue ;
8+ use eZ \Publish \Core \IO \IOServiceInterface ;
109use Netgen \Bundle \InformationCollectionBundle \FieldHandler \Custom \CustomLegacyFieldHandlerInterface ;
1110use Netgen \Bundle \InformationCollectionBundle \Value \LegacyData ;
11+ use DOMDocument ;
1212
1313class EnhancedBinaryFileHandler implements CustomLegacyFieldHandlerInterface
1414{
@@ -28,23 +28,23 @@ public function __construct(IOServiceInterface $IOService)
2828 }
2929
3030 /**
31- * {@inheritdoc}
31+ * @inheritDoc
3232 */
3333 public function supports (Value $ value )
3434 {
3535 return $ value instanceof EnhancedBinaryFileValue;
3636 }
3737
3838 /**
39- * {@inheritdoc}
39+ * @inheritDoc
4040 */
4141 public function toString (Value $ value , FieldDefinition $ fieldDefinition )
4242 {
43- return (string ) $ value ;
43+ return (string )$ value ;
4444 }
4545
4646 /**
47- * {@inheritdoc}
47+ * @inheritDoc
4848 */
4949 public function getLegacyValue (Value $ value , FieldDefinition $ fieldDefinition )
5050 {
@@ -58,7 +58,7 @@ public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
5858
5959 /**
6060 * Create XML doc string
61- * and save file to filesystem.
61+ * and save file to filesystem
6262 *
6363 * @param EnhancedBinaryFileValue $value
6464 * @param FieldDefinition $fieldDefinition
@@ -69,19 +69,19 @@ protected function store(EnhancedBinaryFileValue $value, FieldDefinition $fieldD
6969 {
7070 $ binaryFile = $ this ->storeBinaryFileToPath ($ value );
7171
72- $ doc = new DOMDocument ('1.0 ' , 'utf-8 ' );
73- $ root = $ doc ->createElement ('binaryfile-info ' );
74- $ binaryFileList = $ doc ->createElement ('binaryfile-attributes ' );
72+ $ doc = new DOMDocument ( '1.0 ' , 'utf-8 ' );
73+ $ root = $ doc ->createElement ( 'binaryfile-info ' );
74+ $ binaryFileList = $ doc ->createElement ( 'binaryfile-attributes ' );
7575
7676 $ fileInfo = [
7777 'Filename ' => htmlentities ($ binaryFile ->uri ),
7878 'OriginalFilename ' => htmlentities ($ value ->fileName ),
7979 'Size ' => $ value ->fileSize ,
8080 ];
8181
82- foreach ($ fileInfo as $ key => $ binaryFileItem ) {
82+ foreach ($ fileInfo as $ key => $ binaryFileItem ) {
8383 $ binaryFileElement = $ doc ->createElement ($ key , $ binaryFileItem );
84- $ binaryFileList ->appendChild ($ binaryFileElement );
84+ $ binaryFileList ->appendChild ( $ binaryFileElement );
8585 }
8686
8787 $ root ->appendChild ($ binaryFileList );
@@ -91,7 +91,7 @@ protected function store(EnhancedBinaryFileValue $value, FieldDefinition $fieldD
9191 }
9292
9393 /**
94- * Stores file to filesystem.
94+ * Stores file to filesystem
9595 *
9696 * @param EnhancedBinaryFileValue $value
9797 * @param string $storagePrefix
@@ -102,12 +102,13 @@ protected function storeBinaryFileToPath(EnhancedBinaryFileValue $value, $storag
102102 {
103103 $ binaryCreateStruct = $ this ->IOService
104104 ->newBinaryCreateStructFromLocalFile ($ value ->inputUri );
105-
106- $ encodedFilename = uniqid ();
107- $ binaryCreateStruct ->id = $ storagePrefix . $ encodedFilename ;
105+ $ encodedFilename = uniqid ();
106+ $ binaryCreateStruct ->id = $ storagePrefix . $ encodedFilename ;
108107
109108 $ binaryFile = $ this ->IOService ->createBinaryFile ($ binaryCreateStruct );
110109
111110 return $ binaryFile ;
112111 }
113112}
113+
114+
0 commit comments