private function getMembershipTypeName(\stdClass $membership_type) {
    $map = [
      [
        'needle' => '*Program Member',
        'replace' => 'Program Member',
      ],
      [
        'needle' => '1 Adult (30-64)',
        'replace' => '1 Adult',
      ],
      [
        'needle' => '1 Adult with Kids',
        'replace' => '1 Adult with Kids',
      ],
      [
        'needle' => '2 Adults (30-64)',
        'replace' => '2 Adults',
      ],
      [
        'needle' => '2 Adults with Kids',
        'replace' => '2 Adults with Kids',
      ],
      [
        'needle' => 'College Student',
        'replace' => 'College Student',
      ],
      [
        'needle' => 'Complimentary',
        'replace' => 'Complimentary',
      ],
      [
        'needle' => 'Military Adult',
        'replace' => 'Military Adult',
      ],
      [
        'needle' => 'Military Family',
        'replace' => 'Military Family',
      ],
      [
        'needle' => 'Senior 1 Adult',
        'replace' => '1 Senior',
      ],
      [
        'needle' => 'Senior 2 Adults',
        'replace' => '2 Seniors',
      ],
      [
        'needle' => 'Student',
        'replace' => 'Student',
      ],
      [
        'needle' => 'Young Adult',
        'replace' => 'Young Adult',
      ],
    ];

    foreach ($map as $item) {
      if (strpos($membership_type->name, $item['needle']) !== FALSE) {
        return $item['replace'];
      }
    }

    throw new \Exception(sprintf('Failed to get membership type name for type "%s"', $membership_type->name));
  }
private function getMembershipTypeName(\stdClass $membership_type) {
    $map = [
      [
        'needle' => '*Program Member',
        'replace' => 'Program Member',
      ],
      [
        'needle' => '1 Adult (30-64)',
        'replace' => '1 Adult',
      ],
      [
        'needle' => '1 Adult with Kids',
        'replace' => '1 Adult with Kids',
      ],
      [
        'needle' => '2 Adults (30-64)',
        'replace' => '2 Adults',
      ],
      [
        'needle' => '2 Adults with Kids',
        'replace' => '2 Adults with Kids',
      ],
      [
        'needle' => 'College Student',
        'replace' => 'College Student',
      ],
      [
        'needle' => 'Complimentary',
        'replace' => 'Complimentary',
      ],
      [
        'needle' => 'Military Adult',
        'replace' => 'Military Adult',
      ],
      [
        'needle' => 'Military Family',
        'replace' => 'Military Family',
      ],
      [
        'needle' => 'Senior 1 Adult',
        'replace' => '1 Senior',
      ],
      [
        'needle' => 'Senior 2 Adults',
        'replace' => '2 Seniors',
      ],
      [
        'needle' => 'Student',
        'replace' => 'Student',
      ],
      [
        'needle' => 'Young Adult',
        'replace' => 'Young Adult',
      ],
    ];

    foreach ($map as $item) {
      if (strpos($membership_type->name, $item['needle']) !== FALSE) {
        return $item['replace'];
      }
    }

    throw new \Exception(sprintf('Failed to get membership type name for type "%s"', $membership_type->name));
  }
private function getMembershipTypeName ( \ stdClass $ membership_type ) { $ map = [ [ 'needle' => '*Program Member' , 'replace' => 'Program Member' , ] , [ 'needle' => '1 Adult (30-64)' , 'replace' => '1 Adult' , ] , [ 'needle' => '1 Adult with Kids' , 'replace' => '1 Adult with Kids' , ] , [ 'needle' => '2 Adults (30-64)' , 'replace' => '2 Adults' , ] , [ 'needle' => '2 Adults with Kids' , 'replace' => '2 Adults with Kids' , ] , [ 'needle' => 'College Student' , 'replace' => 'College Student' , ] , [ 'needle' => 'Complimentary' , 'replace' => 'Complimentary' , ] , [ 'needle' => 'Military Adult' , 'replace' => 'Military Adult' , ] , [ 'needle' => 'Military Family' , 'replace' => 'Military Family' , ] , [ 'needle' => 'Senior 1 Adult' , 'replace' => '1 Senior' , ] , [ 'needle' => 'Senior 2 Adults' , 'replace' => '2 Seniors' , ] , [ 'needle' => 'Student' , 'replace' => 'Student' , ] , [ 'needle' => 'Young Adult' , 'replace' => 'Young Adult' , ] , ] ; foreach ( $ map as $ item ) { if ( strpos ( $ membership_type -> name , $ item [ 'needle' ] ) !== FALSE ) { return $ item [ 'replace' ] ; } } throw new \ Exception ( sprintf ( 'Failed to get membership type name for type "%s"' , $ membership_type -> name ) ) ; }
Calculate membership type name.

@param \stdClass $membership_type
Membership type.

@return string
Membership type name.

@throws \Exception
Calculate membership type name .