@@ -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 ;
@@ -483,47 +478,87 @@ public function isCurrentMetadata(): bool
483478
484479 public function getReference (): ?string
485480 {
486- return $ this ->getSourceReference () ?? $ this ->getDistReference ();
481+ return $ this ->getSourceReference () ?? $ this ->getDistributionReference ();
487482 }
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 ;
502+ }
503+
504+ public function setSourceUrl (?string $ sourceUrl ): void
505+ {
506+ $ this ->sourceUrl = $ sourceUrl ;
507+ }
508+
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 hasDistribution (): bool
520+ {
521+ return null !== $ this ->distributionType ;
522+ }
523+
524+ public function getDistributionType (): ?string
525+ {
526+ return $ this ->distributionType ;
527+ }
528+
529+ public function setDistributionType (?string $ distributionType ): void
530+ {
531+ $ this ->distributionType = $ distributionType ;
532+ }
533+
534+ public function getDistributionUrl (): ?string
535+ {
536+ return $ this ->distributionUrl ;
537+ }
538+
539+ public function setDistributionUrl (?string $ distributionUrl ): void
540+ {
541+ $ this ->distributionUrl = $ distributionUrl ;
507542 }
508543
509- public function hasDist (): bool
544+ public function getDistributionReference (): ? string
510545 {
511- return null !== $ this ->dist ;
546+ return $ this ->distributionReference ;
512547 }
513548
514- public function getDistReference ( ): ? string
549+ public function setDistributionReference (? string $ distributionReference ): void
515550 {
516- return $ this ->dist [ ' reference ' ] ?? null ;
551+ $ this ->distributionReference = $ distributionReference ;
517552 }
518553
519- public function getDistType (): ?string
554+ public function getDistributionSha1Checksum (): ?string
520555 {
521- return $ this ->dist [ ' type ' ] ?? null ;
556+ return $ this ->distributionSha1Checksum ;
522557 }
523558
524- public function getDistUrl ( ): ? string
559+ public function setDistributionSha1Checksum (? string $ distributionSha1Checksum ): void
525560 {
526- return $ this ->dist [ ' url ' ] ?? null ;
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 ->hasDistribution () ? 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