Code Duplication    Length = 7-9 lines in 3 locations

classes/PodsMeta.php 3 locations

@@ 348-356 (lines=9) @@
345
        if ( !isset( self::$queue[ $type ] ) )
346
            self::$queue[ $type ] = array();
347
348
        if ( is_array( $pod ) && !empty( $pod ) && !isset( $pod[ 'name' ] ) ) {
349
            $data = array();
350
351
            foreach ( $pod as $p ) {
352
                $data[] = $this->register( $type, $p );
353
            }
354
355
            return $data;
356
        }
357
358
        $pod[ 'type' ] = $pod_type;
359
        $pod = pods_api()->save_pod( $pod, false, false );
@@ 373-381 (lines=9) @@
370
    }
371
372
    public function register_field ( $pod, $field ) {
373
        if ( is_array( $pod ) && !empty( $pod ) && !isset( $pod[ 'name' ] ) ) {
374
            $data = array();
375
376
            foreach ( $pod as $p ) {
377
                $data[] = $this->register_field( $p, $field );
378
            }
379
380
            return $data;
381
        }
382
383
        if ( empty( self::$current_pod_data ) || !is_object( self::$current_pod_data ) || self::$current_pod_data[ 'name' ] != $pod )
384
            self::$current_pod_data = pods_api()->load_pod( array( 'name' => $pod ), false );
@@ 594-600 (lines=7) @@
591
     * @return mixed|void
592
     */
593
    public function group_add ( $pod, $label, $fields, $context = 'normal', $priority = 'default' ) {
594
        if ( is_array( $pod ) && !empty( $pod ) && !isset( $pod[ 'name' ] ) ) {
595
            foreach ( $pod as $p ) {
596
                $this->group_add( $pod, $label, $fields, $context, $priority );
597
            }
598
599
            return true;
600
        }
601
602
        if ( !is_array( $pod ) ) {
603
            if ( empty( self::$current_pod_data ) || !is_object( self::$current_pod_data ) || self::$current_pod_data[ 'name' ] != $pod )