@@ -54,10 +54,25 @@ class Metadata extends TrackedEntity implements \Stringable
5454 private ?string $ targetDir = null ;
5555
5656 #[ORM \Column(nullable: true )]
57- private ?array $ source = null ;
57+ private ?string $ sourceType = null ;
5858
5959 #[ORM \Column(nullable: true )]
60- private ?array $ dist = null ;
60+ private ?string $ sourceUrl = null ;
61+
62+ #[ORM \Column(nullable: true )]
63+ private ?string $ sourceReference = null ;
64+
65+ #[ORM \Column(nullable: true )]
66+ private ?string $ distributionType = null ;
67+
68+ #[ORM \Column(nullable: true )]
69+ private ?string $ distributionUrl = null ;
70+
71+ #[ORM \Column(nullable: true )]
72+ private ?string $ distributionReference = null ;
73+
74+ #[ORM \Column(nullable: true )]
75+ private ?string $ distributionSha1Checksum = null ;
6176
6277 #[ORM \Column(nullable: true )]
6378 private ?array $ autoload = null ;
@@ -282,26 +297,6 @@ public function setTargetDir(?string $targetDir): void
282297 $ this ->targetDir = $ targetDir ;
283298 }
284299
285- public function getSource (): ?array
286- {
287- return $ this ->source ;
288- }
289-
290- public function setSource (?array $ source ): void
291- {
292- $ this ->source = $ source ;
293- }
294-
295- public function getDist (): ?array
296- {
297- return $ this ->dist ;
298- }
299-
300- public function setDist (?array $ dist ): void
301- {
302- $ this ->dist = $ dist ;
303- }
304-
305300 public function getAutoload (): ?array
306301 {
307302 return $ this ->autoload ;
@@ -488,42 +483,82 @@ public function getReference(): ?string
488483
489484 public function hasSource (): bool
490485 {
491- return null !== $ this ->source ;
486+ return null !== $ this ->sourceType ;
492487 }
493488
494- public function getSourceReference (): ?string
489+ public function getSourceType (): ?string
495490 {
496- return $ this ->source [ ' reference ' ] ?? null ;
491+ return $ this ->sourceType ;
497492 }
498493
499- public function getSourceType ( ): ? string
494+ public function setSourceType (? string $ sourceType ): void
500495 {
501- return $ this ->source [ ' type ' ] ?? null ;
496+ $ this ->sourceType = $ sourceType ;
502497 }
503498
504499 public function getSourceUrl (): ?string
505500 {
506- return $ this ->source [ ' url ' ] ?? null ;
501+ return $ this ->sourceUrl ;
507502 }
508503
509- public function hasDist ( ): bool
504+ public function setSourceUrl (? string $ sourceUrl ): void
510505 {
511- return null !== $ this ->dist ;
506+ $ this ->sourceUrl = $ sourceUrl ;
512507 }
513508
514- public function getDistReference (): ?string
509+ public function getSourceReference (): ?string
510+ {
511+ return $ this ->sourceReference ;
512+ }
513+
514+ public function setSourceReference (?string $ sourceReference ): void
515+ {
516+ $ this ->sourceReference = $ sourceReference ;
517+ }
518+
519+ public function hasDist (): bool
515520 {
516- return $ this ->dist [ ' reference ' ] ?? null ;
521+ return null !== $ this ->distributionType ;
517522 }
518523
519524 public function getDistType (): ?string
520525 {
521- return $ this ->dist ['type ' ] ?? null ;
526+ return $ this ->distributionType ;
527+ }
528+
529+ public function setDistType (?string $ distType ): void
530+ {
531+ $ this ->distributionType = $ distType ;
522532 }
523533
524534 public function getDistUrl (): ?string
525535 {
526- return $ this ->dist ['url ' ] ?? null ;
536+ return $ this ->distributionUrl ;
537+ }
538+
539+ public function setDistUrl (?string $ distUrl ): void
540+ {
541+ $ this ->distributionUrl = $ distUrl ;
542+ }
543+
544+ public function getDistReference (): ?string
545+ {
546+ return $ this ->distributionReference ;
547+ }
548+
549+ public function setDistReference (?string $ distReference ): void
550+ {
551+ $ this ->distributionReference = $ distReference ;
552+ }
553+
554+ public function getDistributionSha1Checksum (): ?string
555+ {
556+ return $ this ->distributionSha1Checksum ;
557+ }
558+
559+ public function setDistributionSha1Checksum (?string $ distributionSha1Checksum ): void
560+ {
561+ $ this ->distributionSha1Checksum = $ distributionSha1Checksum ;
527562 }
528563
529564 public function hasVersionAlias (): bool
@@ -637,8 +672,17 @@ public function toComposerArray(): array
637672 'version_normalized ' => $ this ->normalizedVersionName ,
638673 'license ' => $ this ->license ,
639674 'authors ' => $ this ->getAuthorsSorted (),
640- 'source ' => $ this ->source ,
641- 'dist ' => $ this ->dist ,
675+ 'source ' => !$ this ->hasSource () ? null : [
676+ 'type ' => $ this ->sourceType ,
677+ 'url ' => $ this ->sourceUrl ,
678+ 'reference ' => $ this ->sourceReference ,
679+ ],
680+ 'dist ' => !$ this ->hasDist () ? null : [
681+ 'type ' => $ this ->distributionType ,
682+ 'url ' => $ this ->distributionUrl ,
683+ 'reference ' => $ this ->distributionReference ,
684+ 'shasum ' => $ this ->distributionSha1Checksum ,
685+ ],
642686 'type ' => $ this ->type ,
643687 'autoload ' => $ this ->autoload ,
644688 ];
0 commit comments