Code Duplication    Length = 17-17 lines in 2 locations

code/forms/SiteTreeCheckboxSetField.php 1 location

@@ 110-126 (lines=17) @@
107
     * @param Int
108
     * @return Array
109
     */
110
    private function getAllChildrenForSiteTreeParent($parentID)
111
    {
112
        $children = SiteTree::get()->filter(array("ParentID" => $parentID));
113
        if ($children && $children->count()) {
114
            foreach ($children as $child) {
115
                foreach ($this->classNamesForItems as $matchingCLassName) {
116
                    //debug::log("has child");
117
                    if ($child instanceof $matchingCLassName) {
118
                        //debug::log("we now have ".count($this->siteTreeParentAllChildren)." children");
119
                        $this->siteTreeParentAllChildren[$child->ID] = $child->MenuTitle;
120
                    }
121
                }
122
                $this->getAllChildrenForSiteTreeParent($child->ID);
123
            }
124
        }
125
        return $this->siteTreeParentAllChildren;
126
    }
127
}
128

code/forms/SiteTreeListboxField.php 1 location

@@ 139-155 (lines=17) @@
136
     * @param Int
137
     * @return Array
138
     */
139
    private function getAllChildrenForSiteTreeParent($parentID)
140
    {
141
        $children = SiteTree::get()->filter(array("ParentID" => $parentID));
142
        if ($children && $children->count()) {
143
            foreach ($children as $child) {
144
                foreach ($this->classNamesForItems as $matchingCLassName) {
145
                    //debug::log("has child");
146
                    if ($child instanceof $matchingCLassName) {
147
                        //debug::log("we now have ".count($this->siteTreeParentAllChildren)." children");
148
                        $this->siteTreeParentAllChildren[$child->ID] = $child->ID;
149
                    }
150
                }
151
                $this->getAllChildrenForSiteTreeParent($child->ID);
152
            }
153
        }
154
        return $this->siteTreeParentAllChildren;
155
    }
156
}
157