src/CallmanagerAXL/Callmanager.php
public function get_object_type_by_site($SITE, $TYPE)
    {
        // Get our valid object types
        $TYPES = $this->object_types();

        // Check to see if the one we were passed is valid for this function
        if (!in_array($TYPE, $TYPES)) {
            throw new \Exception("Object type provided {$TYPE} is not supported");
        }

        // Lines is a special case due to highly nested indirect nature of its search selector relationships
        if ($TYPE == 'Line') {
            return $this->get_lines_by_site($SITE);
        }
        //$TYPES = array_diff($TYPES, ['Line']);

        //	This is the default search and return criteria for MOST object types. There are a few exceptions
        $FIND = ['name' => "%{$SITE}%"];
        $RETR = ['name' => ''];
        // Phone search uses a different search name field
        if ($TYPE == 'Phone') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
        } elseif ($TYPE == 'CtiRoutePoint') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
        } elseif ($TYPE == 'H323Gateway') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
            // So does route pattern search and returns a different field - Need to search by specific Partition;
        } elseif ($TYPE == 'RoutePattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => '', 'routePartitionName' => ''];
            // So does translation pattern search and returns a different field
        } elseif ($TYPE == 'TransPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
            // So does CallingPartyTransformationPattern pattern search and returns a different field
        } elseif ($TYPE == 'CallingPartyTransformationPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
            // So does CalledPartyTransformationPattern pattern search and returns a different field
        } elseif ($TYPE == 'CalledPartyTransformationPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
        } elseif ($TYPE == 'HuntPilot') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
		} elseif ($TYPE == 'CallPark') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
        } elseif ($TYPE == 'RemoteDestinationProfile') {
            $RETR = $this->get_remoteDestinationProfilesbySite($SITE);

            return $RETR;
        }

        $SEARCH = $this->axl_search_return_array($FIND, $RETR);

        $FUNCTION = 'list'.$TYPE;
        // Search the CUCM for matching SRST devices
        $BASETIME = $this->microtimeTicks();
        $RETURN = $this->SOAPCLIENT->$FUNCTION($SEARCH);
        $DIFFTIME = $this->microtimeTicks() - $BASETIME;
        // log our soap call
        $this->log_soap_call($FUNCTION, $DIFFTIME, $SEARCH, $RETURN);
        // Decode the reply into an array of results
        $RETURN = $this->decode_soap_reply($RETURN);

        // Turn the associative arrays into a single simensional array list
        $AKEYS = array_keys($RETR);
        $RESET = reset($AKEYS);
        $RETURN = $this->assoc_key_values_to_array($RETURN, $RESET);

        return $RETURN;
    }
public function get_object_type_by_site($SITE, $TYPE)
    {
        // Get our valid object types
        $TYPES = $this->object_types();

        // Check to see if the one we were passed is valid for this function
        if (!in_array($TYPE, $TYPES)) {
            throw new \Exception("Object type provided {$TYPE} is not supported");
        }

        // Lines is a special case due to highly nested indirect nature of its search selector relationships
        if ($TYPE == 'Line') {
            return $this->get_lines_by_site($SITE);
        }
        //$TYPES = array_diff($TYPES, ['Line']);

        //	This is the default search and return criteria for MOST object types. There are a few exceptions
        $FIND = ['name' => "%{$SITE}%"];
        $RETR = ['name' => ''];
        // Phone search uses a different search name field
        if ($TYPE == 'Phone') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
        } elseif ($TYPE == 'CtiRoutePoint') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
        } elseif ($TYPE == 'H323Gateway') {
            $FIND = ['devicePoolName' => "%{$SITE}%"];
            // So does route pattern search and returns a different field - Need to search by specific Partition;
        } elseif ($TYPE == 'RoutePattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => '', 'routePartitionName' => ''];
            // So does translation pattern search and returns a different field
        } elseif ($TYPE == 'TransPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
            // So does CallingPartyTransformationPattern pattern search and returns a different field
        } elseif ($TYPE == 'CallingPartyTransformationPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
            // So does CalledPartyTransformationPattern pattern search and returns a different field
        } elseif ($TYPE == 'CalledPartyTransformationPattern') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
        } elseif ($TYPE == 'HuntPilot') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
		} elseif ($TYPE == 'CallPark') {
            $FIND = ['routePartitionName' => "%{$SITE}%"];
            $RETR = ['pattern' => ''];
        } elseif ($TYPE == 'RemoteDestinationProfile') {
            $RETR = $this->get_remoteDestinationProfilesbySite($SITE);

            return $RETR;
        }

        $SEARCH = $this->axl_search_return_array($FIND, $RETR);

        $FUNCTION = 'list'.$TYPE;
        // Search the CUCM for matching SRST devices
        $BASETIME = $this->microtimeTicks();
        $RETURN = $this->SOAPCLIENT->$FUNCTION($SEARCH);
        $DIFFTIME = $this->microtimeTicks() - $BASETIME;
        // log our soap call
        $this->log_soap_call($FUNCTION, $DIFFTIME, $SEARCH, $RETURN);
        // Decode the reply into an array of results
        $RETURN = $this->decode_soap_reply($RETURN);

        // Turn the associative arrays into a single simensional array list
        $AKEYS = array_keys($RETR);
        $RESET = reset($AKEYS);
        $RETURN = $this->assoc_key_values_to_array($RETURN, $RESET);

        return $RETURN;
    }
Generalized function to return any type of object using the list/search functionality for a site