Retrieve an item for this element.

@param int|string  $id Object ID.
@param array $args Not used.

@throws \UnexpectedValueException

@return \WP_Comment The item.
190659
public function get($id, $args = [])
    {
        $comment = get_comment($id);

        if (! $comment) {
            throw new UnexpectedValueException(sprintf('[W601] Could not find comment with ID %d', $id));
        }

        return $comment;
    }
281911
public function get($id)
    {
        if ($this->has($id) === false)
        {
            $message = (string) 'Class (%s) does not exists';

            throw new NotFoundException(sprintf($message, $id));
        }

        $reflection = new \ReflectionClass($id);

        if ($constructor = $reflection->getConstructor())
        {
            $arguments = $this->arguments($constructor);

            return $reflection->newInstanceArgs($arguments);
        }

        return new $id;
    }
886886
public function getArguments($id)
    {
        return (isset($this->argumentsById[$id])) ?
            $this->argumentsById[$id] :
            null;
    }
610879
public function get(...$args)
    {
        $record = $this->fetchSingle($args);
        if (!$record)
            return null;
        $obj = new $this->model_class;
        $obj->assignRecord($record, $this->db);
        return $obj;
    }
300994
public function update($id, $args = [])
    {
        $bin          = '';
        $command_args = sprintf(
            '--no-defaults --no-auto-rehash --host=%1$s --user=%2$s --database=%3$s --execute=%4$s',
            DB_HOST,
            DB_USER,
            DB_NAME,
            escapeshellarg(sprintf(
                'SET autocommit = 0; SET unique_checks = 0; SET foreign_key_checks = 0; SOURCE %1$s; COMMIT;',
                $args['path']
            ))
        );

        $old_pwd = getenv('MYSQL_PWD');
        putenv('MYSQL_PWD=' . DB_PASSWORD);

        // Support Windows.
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $bin = '/usr/bin/env ';
        }

        // Import DB via mysql-cli.
        $proc = proc_open(
            "{$bin}mysql {$command_args}",
            array(
                1 => ['pipe', 'w'],
                2 => ['pipe', 'w'],
            ),
            $pipes
        );

        $stdout = trim(stream_get_contents($pipes[1]));
        $stderr = trim(stream_get_contents($pipes[2]));
        fclose($pipes[1]);
        fclose($pipes[2]);
        $exit_code = proc_close($proc);
        putenv('MYSQL_PWD=' . $old_pwd);

        // Sometimes the error message is in stderr.
        if (! $stdout && $stderr) {
            $stdout = $stderr;
        }

        if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) {
            throw new RuntimeException(
                sprintf(
                    "[W607] Could not import database in method %1\$s(): \n\n%2\$s.\n(%3\$s)",
                    debug_backtrace()[1]['function'],
                    $stdout,
                    $exit_code
                )
            );
        }

        /*
         * clear the cache after restoration - this is probably only necessary
         * because of some kind of global state issue - the WPCLI driver doensn't
         * need it. There is some discussion about it here:
         *
         * https://github.com/paulgibbs/behat-wordpress-extension/pull/150
         */
        \wp_cache_flush();
    }
1198665
public static function retrieve($userId, $id, $options = null)
    {
        return self::_userBasedRetrieve($userId, $id, $options);
    }
1328147
public function get($id) {
        $id=($id==='')?"0":$id;
        if (!isset($this->items[$id])) {
            return new MessageItem(); // we returns an empty error.
        }
        return $this->items[$id];
    }
842089
public function get( array $args = [], array $assoc_args = [] ) {

		$site_id = (int) $args[ 0 ];
		$site    = get_blog_details( $site_id );
		if ( ! $site ) {
			WP_CLI::error( "A site with ID {$site_id} does not exist" );
		}

		// trailing-slash it, as URLs ends always with a trailing slash in context of the wp_blogs table
		WP_CLI::line( trailingslashit( $site->siteurl ) );
		exit( 0 );
	}
721341
public function get(string $id): ?\BearCMS\Internal\Data2\CommentsThread
    {
        $data = Internal\Data::getValue('bearcms/comments/thread/' . md5($id) . '.json');
        if ($data !== null) {
            return $this->makeCommentsThreadPostFromRawData($data);
        }
        return null;
    }
360162
public function find($app_id, $args = array())
    {
        $url = 'identities/' . $app_id . '/merchants';
        if (!isset($args['limit'])) {
            $args['limit'] = 10;
        }
        $api_response = $this->paylike->client->request('GET', $url, $args);
        $merchants = $api_response->json;
        return new Cursor($url, $args, $merchants, $this->paylike);
    }
464978
protected function pop($id, $args = array())
    {
        if (array_key_exists($id, $this->services)) {
            return $this->services[$id];
        }

        if (array_key_exists($id, $this->callables)) {
            $callback = $this->callables[$id];

            return call_user_func_array($callback, array_merge(array($this), $args));
        }

        throw new \Exception("The dependency with id of ({$id}) is missing.");
    }
875167
public function get($id, $args = [])
    {
        // Fetch all the user properties by default, for convenience.
        if (! isset($args['field']) && ! isset($args['fields'])) {
            $args['fields'] = implode(
                ',',
                array(
                    'ID',
                    'user_login',
                    'display_name',
                    'user_email',
                    'user_registered',
                    'roles',
                    'user_pass',
                    'user_nicename',
                    'user_url',
                    'user_activation_key',
                    'user_status',
                    'url'
                )
            );
        }

        $wpcli_args = buildCLIArgs(
            array(
                'field',
                'fields',
            ),
            $args
        );

        array_unshift($wpcli_args, $id, '--format=json');
        $user = $this->drivers->getDriver()->wpcli('user', 'get', $wpcli_args)['stdout'];
        $user = json_decode($user);

        if (! $user) {
            throw new UnexpectedValueException(sprintf('[W504] Could not find user with ID %d', $id));
        }

        // Convert CSVs to arrays for consistency with WP-PHP driver.
        if (isset($user->roles) && ! is_array($user->roles)) {
            $user->roles = array_map('trim', explode(',', $user->roles));
        }

        return $user;
    }
975360
public function add_section( $id, $args = [] ) {
		$section = $this->manager->add_section( $id, $args );

		$section->panel = $this->id;

		return $section;
	}
936634
public function get($id, $args = null) {
		if (isset($this->checkedIds[$id]) && ! $this->checkedIds[$id]) {
			throw new Exceptions\ServiceNotFound('Unable to found the service "' . $id . '"');
		}
		
		$args = $this->resolveArgs(func_get_args());
		
		try {
			$service = ($args === null)
				? $this->getService($id)
				: $this->getServiceByArgs($id, $args);
		}
		catch (Exceptions\ServiceNotFound $exception) {
			$this->checkedIds[$id] = false;
			throw $exception;
		}
		
		$this->checkedIds[$id] = true;
		return $service;
	}
837075
public function getById(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::GET,
            ResourceMethodEnum::GET_BY_ID,
            $params,
            $id
        );
    }
1136553
public function get($id)
    {
        if (empty($id)) {
            throw new \Exception('cannot load object with empty id');
        }

        $params = new RequestParams(RequestOps::GET, $this->resourceMetadata, $id);
        $jsonResponse = $this->request($params);

        if ($jsonResponse == false) {
            throw new Exception('Error retrieving data');
        }

        $inst = $this->createResourceInst($jsonResponse, $this->resourceMetadata->resourceClass);

        $this->postProcess($inst);

        return $inst;
    }
887735
public function getQuestion($id)
    {
        /** @var TemplateInterface $template */
        foreach ($this->data as $template) {
            if ($template->getQuestion()->getId() == $id) {
                return $template;
            }
        }

        throw new NotFoundHttpException(sprintf('Id question %s not found', $id));
    }