收藏的文章
@param int $id
@return string
@throws NotFoundHttpException
435306
public function actionCollected($id)
    {
        $user = $this->findModel($id);
        $query = Article::find()->innerJoinWith([
            'collections' => function ($query) use ($id) {
                /** @var \yii\db\ActiveQuery $query */
                $query->where([
                    Collection::tableName() . '.user_id' => $id]);
            }
        ])->orderBy(['created_at' => SORT_DESC]);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        return $this->render('collected', [
            'user' => $user,
            'dataProvider' => $dataProvider
        ]);
    }
984103
protected function getAddress($id)
    {
        $address = $this->addressManager->findOneBy(['id' => $id]);

        if (null === $address) {
            throw new NotFoundHttpException(sprintf('Address (%d) not found', $id));
        }

        return $address;
    }
626874
function getContent( $id ) {
		global $wpdb;
		$post = $wpdb->get_row( $wpdb->prepare( "SELECT post_content FROM {$wpdb->posts} WHERE id=%d", $id ) );
		return $post->post_content;
	}
1090980
protected function findModel($id)
    {
        $model = $this->module->model('Content')->findOne($id);
        if ($model !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
389365
protected function getPost($id)
    {
        $post = $this->postManager->find($id);

        if (null === $post) {
            throw new NotFoundHttpException(sprintf('Post (%d) not found', $id));
        }

        return $post;
    }
1207567
protected function findModel($id)
    {
        if (($model = TermType::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
231156
public function getArticle($id)
    {
        /** @var ArticleFbApi $response */
        $response = $this->call(new Request('article.get', array('article_id' => $id)), 'DVelopment\FastBill\Model\ArticleFbApi');

        return reset($response->getResponse()->getArticles());
    }
608662
protected function getSite($id)
    {
        $site = $this->siteManager->findOneBy(['id' => $id]);

        if (null === $site) {
            throw new NotFoundHttpException(sprintf('Site (%d) not found', $id));
        }

        return $site;
    }
395442
public function getDocument(string $id): Document
    {
        if (isset($this->documents[$id])) {
            return $this->documents[$id];
        }

        if ($this->hasDocument($id)) {
            $path = $this->getDocumentPath($id);
            $source = $this->filesystem->read($path);

            if (is_string($source)) {
                return $this->documents[$id] = new Document($this->format->parse($source));
            }

            throw new RuntimeException(sprintf('Format error in the file "%s"', $path));
        }

        throw new RuntimeException(sprintf('File "%s" not found', $id));
    }
1056974
public function getImagesByArticles($id)
    {
        $uri = Article::$object_endpoint . '/' . $id . '/' . Image::$object_endpoint;
        return $this->get($uri);
    }
605486
public function getPathForDocument($id)
    {
        if(!$this->validateId($id)) {
            throw new \Exception(sprintf('`%s` is not a valid document ID.', $id));
        }

        if($this->isNestedId($id)) {
            $path = DIRECTORY_SEPARATOR . str_replace(self::SEPERATOR, DIRECTORY_SEPARATOR, dirname($id));
        } else {
            $path = '';
        }

        return  $this->path . $path . DIRECTORY_SEPARATOR . $this->getFilename($id);
    }
510868
public function getContentById($id)
    {
        return $this->om->getRepository($this->configurationManager->getEntityClass('content'))->find($id);
    }
1008407
public function findDocument($id)
    {
        $documentPath = '/'.$this->databaseName.'/'.urlencode($id);

        return $this->httpClient->request('GET', $documentPath);
    }
832849
public function showArticle($id)
    {
        try {
            $post = Article::with('user', 'category')
                           ->whereId(intval($id))
                           ->orWhere('slug', $id)
                           ->firstOrFail();

            $view = \Config::get('admin.views.post');

            return \View::make($view, compact('post'));
        } catch (ModelNotFoundException $e) {
            return \App::abort(404);
        }
    }
364230
public function getDocument($id)
    {
        $body = $this->request([
            'url' => '/data/doc/' . $this->clientConfig['dataset'] . '/' . $id,
            'cdnAllowed' => true
        ]);
        return $body['documents'][0];
    }
1146757
public function convert($id)
    {
        if (null === $application = $this->repository->find((int) $id)) {
            throw new NotFoundHttpException(sprintf('Application %s not found.', $id));
        }

        return $application;
    }
1084040
protected function getFileName($id)
    {
        if (is_dir($id)) {
            return sprintf('%1$s/%2$s.%3$s', rtrim($id, DIRECTORY_SEPARATOR), StringUtils::random(20), $this->extension);
        }

        $dirName = dirname($id);

        if (!file_exists($id) && $dirName === '.') {
             return sprintf('%1$s/%2$s', $this->directory, $id);
        }

        if (!file_exists($id) && !is_writable($dirName)) {
            throw new NotWritableException(sprintf('File could not be written to system as target is not writable: %s', $id));
        }

        return $id;
    }