Code Duplication    Length = 26-26 lines in 3 locations

src/POData/Providers/Metadata/SimpleMetadataProvider.php 3 locations

@@ 589-614 (lines=26) @@
586
     * @param string             $sourceProperty     The name of the property to add, on source type
587
     * @param string             $targetProperty     The name of the property to add, on target type
588
     */
589
    public function addResourceReferencePropertyBidirectional(
590
        ResourceEntityType $sourceResourceType,
591
        ResourceEntityType $targetResourceType,
592
        $sourceProperty,
593
        $targetProperty
594
    ) {
595
        $this->addReferencePropertyInternalBidirectional(
596
            $sourceResourceType,
597
            $targetResourceType,
598
            $sourceProperty,
599
            $targetProperty,
600
            '*',
601
            '1'
602
        );
603
        // verify resource property types are what we expect them to be
604
        $sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind();
605
        assert(
606
            ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind,
607
            '1 side of 1:N relationship not pointing to resource reference'
608
        );
609
        $targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind();
610
        assert(
611
            ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind,
612
            'N side of 1:N relationship not pointing to resource set reference'
613
        );
614
    }
615
616
    /**
617
     * To add a navigation property (resource set or resource reference)
@@ 828-853 (lines=26) @@
825
     * @param string             $sourceProperty     The name of the property to add, on source type
826
     * @param string             $targetProperty     The name of the property to add, on target type
827
     */
828
    public function addResourceSetReferencePropertyBidirectional(
829
        ResourceEntityType $sourceResourceType,
830
        ResourceEntityType $targetResourceType,
831
        $sourceProperty,
832
        $targetProperty
833
    ) {
834
        $this->addReferencePropertyInternalBidirectional(
835
            $sourceResourceType,
836
            $targetResourceType,
837
            $sourceProperty,
838
            $targetProperty,
839
            '*',
840
            '*'
841
        );
842
        // verify resource property types are what we expect them to be
843
        $sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind();
844
        assert(
845
            ResourcePropertyKind::RESOURCESET_REFERENCE == $sourceResourceKind,
846
            'M side of M:N relationship not pointing to resource set reference'
847
        );
848
        $targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind();
849
        assert(
850
            ResourcePropertyKind::RESOURCESET_REFERENCE == $targetResourceKind,
851
            'N side of M:N relationship not pointing to resource set reference'
852
        );
853
    }
854
855
    /**
856
     * To add a 1-1 resource reference.
@@ 865-890 (lines=26) @@
862
     * @param string             $sourceProperty     The name of the property to add, on source type
863
     * @param string             $targetProperty     The name of the property to add, on target type
864
     */
865
    public function addResourceReferenceSinglePropertyBidirectional(
866
        ResourceEntityType $sourceResourceType,
867
        ResourceEntityType $targetResourceType,
868
        $sourceProperty,
869
        $targetProperty
870
    ) {
871
        $this->addReferencePropertyInternalBidirectional(
872
            $sourceResourceType,
873
            $targetResourceType,
874
            $sourceProperty,
875
            $targetProperty,
876
            '1',
877
            '0..1'
878
        );
879
        // verify resource property types are what we expect them to be
880
        $sourceResourceKind = $sourceResourceType->resolveProperty($sourceProperty)->getKind();
881
        assert(
882
            ResourcePropertyKind::RESOURCE_REFERENCE == $sourceResourceKind,
883
            '1 side of 1:1 relationship not pointing to resource reference'
884
        );
885
        $targetResourceKind = $targetResourceType->resolveProperty($targetProperty)->getKind();
886
        assert(
887
            ResourcePropertyKind::RESOURCE_REFERENCE == $targetResourceKind,
888
            '0..1 side of 1:1 relationship not pointing to resource reference'
889
        );
890
    }
891
892
    /**
893
     * To add a complex property to entity or complex type.