Code Duplication    Length = 15-16 lines in 3 locations

src/AppserverIo/Server/Configuration/ServerJsonConfiguration.php 3 locations

@@ 712-727 (lines=16) @@
709
     *
710
     * @return array
711
     */
712
    public function prepareRewrites(\stdClass $data)
713
    {
714
        $rewrites = array();
715
        if (isset($data->rewrites)) {
716
            // prepare the array with the rewrite rules
717
            foreach ($data->rewrites as $rewrite) {
718
                // Build up the array entry
719
                $rewrites[] = array(
720
                    'condition' => $rewrite->condition,
721
                    'target' => $rewrite->target,
722
                    'flag' => $rewrite->flag
723
                );
724
            }
725
        }
726
        return $rewrites;
727
    }
728
729
    /**
730
     * Prepares the environmentVariables array based on a data object
@@ 736-750 (lines=15) @@
733
     *
734
     * @return array
735
     */
736
    public function prepareEnvironmentVariables(\stdClass $data)
737
    {
738
        $environmentVariables = array();
739
        if (isset($data->environmentVariables)) {
740
            // prepare the array with the environment variables
741
            foreach ($data->environmentVariables as $environmentVariable) {
742
                // Build up the array entry
743
                $environmentVariables[] = array(
744
                    'condition' => $environmentVariable->condition,
745
                    'definition' => $environmentVariable->definition
746
                );
747
            }
748
        }
749
        return $environmentVariables;
750
    }
751
752
    /**
753
     * Prepares the authentications array based on a data object
@@ 841-855 (lines=15) @@
838
     *
839
     * @return array
840
     */
841
    public function prepareLocations(\stdClass $data)
842
    {
843
        $locations = array();
844
        if (isset($data->locations)) {
845
            // prepare the array with the location variables
846
            foreach ($data->locations as $location) {
847
                // Build up the array entry
848
                $locations[] = array(
849
                    'condition' => $location->condition,
850
                    'handlers' => $this->prepareHandlers($location)
851
                );
852
            }
853
        }
854
        return $locations;
855
    }
856
857
    /**
858
     * Prepares the rewrite maps array based on a data object