@param string $fid

@return array

@throws InvalidFidException
1386
public static function getTypes($fid)
  {
    $parts = explode(':', $fid);
    switch(count($parts))
    {
      case 5:
        return [$parts[1], $parts[2]];
      case 4:
        return [$parts[1], $parts[1]];
      default:
        throw new InvalidFidException("Invalid FID Passed '$fid'", 500);
    }
  }
463255
public static function getByName($fsName, $uID = false)
    {
        $db = Database::connection();
        if ($uID !== false) {
            $row = $db->fetchAssoc('SELECT * FROM FileSets WHERE fsName = ? AND uID = ?', array($fsName, $uID));
        } else {
            $row = $db->fetchAssoc('SELECT * FROM FileSets WHERE fsName = ?', array($fsName));
        }
        if (is_array($row) && count($row)) {
            $fs = new static();
            $fs = array_to_object($fs, $row);

            return $fs;
        }
    }
461426
public function getFallBackDevices($deviceId)
    {
        $fallBackDevices = $this->getDeviceRepository()->getDeviceHierarchy($deviceId);

        array_shift($fallBackDevices);

        return array_map(array($this, 'deviceId'), $fallBackDevices);
    }
850048
public function my_getUidInfo($uid)
    {
        $node_name = $this->searchUid($uid);
        if ($node_name) {
            if (!isset($this->client[$node_name])) return null;
            $token = $this->client[$node_name]->getUidInfo($uid);
            $fdInfo = $this->client[$node_name]->getTokenResult($token);
            return $fdInfo;
        }
        return null;
    }
257531
public function getAllSubordinates($guid = null, $limit = CAKE_LDAP_SYNC_AD_LIMIT) {
		$result = [];
		$conditions = [];
		$contain = [];
		if (!empty($guid)) {
			$conditions[$this->Employee->alias . '.' . CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID] = $guid;
			$contain[] = 'Employee';
		}
		$fields = [
			$this->alias . '.id',
			$this->alias . '.parent_id',
			$this->alias . '.lft',
			$this->alias . '.rght',
			$this->alias . '.name',
		];
		$order = [
			$this->alias . '.id' => 'asc',
		];
		$result = $this->find('all', compact('fields', 'conditions', 'order', 'limit', 'contain'));

		return $result;
	}
565169
public function th_getUidTopics($uid)
    {
        $arr = [];
        foreach ($this->subArr as $topic => $set) {
            if ($set->contains($uid)) {
                $arr[] = $topic;
            }
        }
        return $arr;
    }
271523
public function get_key($keyid)
    {
        $list = $this->list_keys($keyid);

        if (is_array($list)) {
            return $list[key($list)];
        }

        // error
        return $list;
    }
650494
protected function _getPidRecursive($ppid) {
		if (!$ppid) {
			return array();
		}
		$allPids = $pids = array_filter(preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`));

		foreach ($pids as $pid) {
			$allPids = array_merge($allPids, $this->_getPidRecursive($pid));
		}
		return $allPids;
	}
862448
public function getByUID($uid)
    {
        return array_filter($this->getComponents(), function ($item) use ($uid) {
            if (!$itemUid = $item->select('UID')) {
                return false;
            }
            $itemUid = current($itemUid)->getValue();

            return $uid === $itemUid;
        });
    }
302581
public function loadById($pId)
    {
        if (! $pId instanceof Id) {
            $id = new Id($pId);
        } else {
            $id = $pId;
        }

        return $this->_loadByAttribute(static::IDFIELD, $id->getOrig());
    }
543537
public function run( $cid, $fid ) {

		$model		= $this->model;
		$gallery	= $this->galleryService->getById( $cid );

		if( isset( $gallery ) && ( $this->direct || $gallery->belongsTo( $model ) ) ) {

			if( $this->minItems > 0 ) {

				$items = $gallery->files;

				if( count( $items ) <= $this->minItems ) {

					// Trigger Ajax Failure
					return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_REQUEST ), [ 'limit' => "Minimum $this->minItems items are required for a gallery." ] );
				}
			}

			$modelFile = $this->modelFileService->getFirstByParentModelId( $gallery->id, CoreGlobal::TYPE_GALLERY, $fid );

			if( isset( $modelFile ) ) {

				$data = [ 'mid' => $modelFile->id ];

				$this->modelFileService->delete( $modelFile );

				// Trigger Ajax Success
				return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
			}
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
1092994
public function getMap($uid)
    {
        /** @var Map $map */
        $map = AssociativeArray::getFromKey($this->maps, $uid, new Map());

        if ($map->fileName && $map->lapRace === null) {
            $map = $this->factory->getConnection()->getMapInfo($map->fileName);
            $this->maps[$map->uId] = $map;
        }

        return $map;
    }
162787
public function findByGuid($guid, $columns = [])
    {
        try {
            return $this->findByGuidOrFail($guid, $columns);
        } catch (ModelNotFoundException $e) {
            return false;
        }
    }
307734
public static function parse($iniString)
    {
        $values = parse_ini_string($iniString);
        if (!empty($values)) {
            foreach ($values as &$value) {
                $value = (bool) $value ? true : false;
            }

            return $values;
        }

        return [];
    }
766680
public function clientGetByUid($uid)
  {
    foreach($this->clientList() as $client)
    {
      if($client["client_unique_identifier"] == $uid) return $client;
    }

    throw new Exception("invalid clientID", 0x200);
  }
81821
protected function ensureMongoId($rawId)
    {
        if (is_array($rawId)) {
            $result = [];
            foreach ($rawId as $key => $value) {
                $result[$key] = $this->ensureMongoId($value);
            }

            return $result;
        } elseif (is_object($rawId)) {
            if ($rawId instanceof ObjectID) {
                return $rawId;
            } else {
                $rawId = (string) $rawId;
            }
        }
        try {
            $mongoId = new ObjectID($rawId);
        } catch (InvalidArgumentException $e) {
            // invalid id format
            $mongoId = $rawId;
        }

        return $mongoId;
    }
1013034
public static function getClientIdByUid($uid)
    {
        $gateway_data             = GatewayProtocol::$empty;
        $gateway_data['cmd']      = GatewayProtocol::CMD_GET_CLIENT_ID_BY_UID;
        $gateway_data['ext_data'] = $uid;
        $client_list              = array();
        $all_buffer_array         = self::getBufferFromAllGateway($gateway_data);
        foreach ($all_buffer_array as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $connection_id_array) {
                if ($connection_id_array) {
                    foreach ($connection_id_array as $connection_id) {
                        $client_list[] = Context::addressToClientId($local_ip, $local_port, $connection_id);
                    }
                }
            }
        }
        return $client_list;
    }