@param string $reviewer
@param array  $params

@throws \Http\Client\Exception

@return array
541656
public function remove(string $reviewer, array $params = [])
    {
        $path = $this->buildDefaultReviewersPath($reviewer);

        return $this->delete($path, $params);
    }
662495
public function addReviews(ReviewCollection $reviews)
    {
        foreach ($reviews as $review) {
            $this->reviews->append($review);
        }

        return $this;
    }
42835
private function _initCriteriaSortations( MW_Common_Criteria_Interface $criteria, stdClass $params )
	{
		if( isset( $params->sort ) && isset( $params->dir ) )
		{
			$sortation = array();

			switch( $params->dir )
			{
				case 'ASC':
					$sortation[] = $criteria->sort( '+', $params->sort ); break;
				case 'DESC':
					$sortation[] = $criteria->sort( '-', $params->sort ); break;
				default:
					throw new Controller_ExtJS_Exception( sprintf( 'Invalid sort direction "%1$s"', $params->sort ) );
			}

			$criteria->setSortations( $sortation );
		}


		if( $this->_sort !== null )
		{
			$sort = $criteria->getSortations();
			$sort[] = $criteria->sort( '+', $this->_sort );
			$criteria->setSortations( $sort );
		}
	}
386240
public function get_examples_for_reviewer($reviewerid) {
        global $DB;

        if (empty($reviewerid)) {
            return false;
        }
        $sql = 'SELECT s.id, s.title,
                       a.id AS assessmentid, a.grade, a.gradinggrade
                  FROM {workshop_submissions} s
             LEFT JOIN {workshop_assessments} a ON (a.submissionid = s.id AND a.reviewerid = :reviewerid AND a.weight = 0)
                 WHERE s.example = 1 AND s.workshopid = :workshopid
              ORDER BY s.title';
        return $DB->get_records_sql($sql, array('workshopid' => $this->id, 'reviewerid' => $reviewerid));
    }
702846
public function listToIn(array $list, &$params, $currentParamCount) {
        $criteria = $this->query();
        $criteriaHelper = new CriteriaHelper($criteria);
        return $criteriaHelper->listToIn($list, $params, $currentParamCount);
    }
1278887
public function downloadPreview(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::GET,
            ResourceMethodEnum::DOWNLOAD_PREVIEW,
            $params,
            $id
        );
    }
648698
public function getPaginator($params = array()) 
	{
		$page = isset($params['page']) ? (int)$params['page'] : 1;
		$email = isset($params['email']) ? $params['email'] : null;
		$limit = isset($params['limit']) ? (int) $params['limit'] : 10;
		$offset = isset($params['offset']) ? (int) $params['offset'] : 0;
		
		
		$qb = $this->_em->createQueryBuilder();
		$qb->select(array('a'));
		$qb->from($this->getEntityName(), 'a');
		$qb->addOrderBy('a.dateInsert', 'DESC');
		
		if(null !== $email) {
			$qb->andWhere($qb->expr()->eq('a.email', ':paramEmail'));
			$qb->setParameter('paramEmail', $email);
		}
		
		$query = $qb->getQuery();
		$query->setFirstResult($offset);
		$query->setMaxResults($limit);
// 		$paginator = new DoctrinePaginator($query, $fetchJoinCollection = true);
// 		$result = array();
// 		foreach($paginator as $p) {
// 			$result[] = $p->getUserId();
// 		}
// 		$result = $query->getResult();
// 		$paginatorAdapter =  new RazorPaginator(
// 			$result,
// 			count($paginator)
// 		);
		$paginatorAdapter = new DoctrinePaginatorAdapter(new DoctrinePaginator($query));
		$paginator = new Paginator($paginatorAdapter);
		$paginator->setCurrentPageNumber($page);
		$paginator->setDefaultItemCountPerPage($limit);
		
		return $paginator;
	}
800920
public function call($method, $params = [])
    {
        if (null === $this->client) {
            $this->client = new Client([
                'base_uri' => static::API_URL,
                'content-type' => 'application/json',
            ]);
        }

        $requestParams = array_merge($this->defaultParams, [
            $method => [$params],
        ]);

        if ($this->sandbox) {
            $requestParams['apikey'] = self::SANDBOX_KEY;
        }

        $response = $this->client->post(null, ['body' => json_encode($requestParams)]);
        if ($response->getStatusCode() != 200) {
            throw new \Exception('Api http error: ' . $response->getStatusCode(), $response->getStatusCode());
        }

        $result = json_decode($response->getBody(), true);
        if (isset($result['error'])) {
            throw new \BadMethodCallException('Api error: ' . $result['error']['description'],
                $result['error']['code']);
        }

        return $result;
    }
571979
public function getListeRuesCompletes($params=array())
	{
		$pagination = new paginationObject();
		$adresse = new archiAdresse();
		$nbEnregistrementsParPage=10;


		$paginationHTML="";

		$sqlLimit="";

		if (isset($params['sqlLimit'])) {
			$sqlLimit = $params['sqlLimit'];
		}

		$titre = "";
		if (isset($params['setTitre'])) {
			$titre = $params['setTitre']."<br><br>";
		}


		if (!isset($params['noPagination']) || $params['noPagination']==false) {
			$reqRuesCount="
					SELECT r.idRue,  count(distinct ae.idAdresse) as nbAdresses
					FROM rue r
					LEFT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
					LEFT JOIN _adresseEvenement ae ON ae.idAdresse = ha.idAdresse
					WHERE ha.numero<>'0' and ha.numero<>'' AND ha.idAdresse IS NOT NULL
					GROUP BY r.idRue
					";

			$resRuesCount = $this->connexionBdd->requete($reqRuesCount);
			$nbEnregistrementTotaux = mysql_num_rows($resRuesCount);


			$arrayPagination=$pagination->pagination(
					array(
							'nomParamPageCourante'=>'archiPageCouranteRue',
							'nbEnregistrementsParPage'=>$nbEnregistrementsParPage,
							'nbEnregistrementsTotaux'=>$nbEnregistrementTotaux,
							'typeLiens'=>'noformulaire'
					)
			);
			$sqlLimit = "LIMIT ".$arrayPagination['limitSqlDebut'].", ".$nbEnregistrementsParPage;
		}

		// liste des rues les plus completes
		$reqRues = "
		SELECT r.idRue,  count(distinct ae.idAdresse) as nbAdresses
		FROM rue r
		LEFT JOIN historiqueAdresse ha ON ha.idRue = r.idRue
		LEFT JOIN _adresseEvenement ae ON ae.idAdresse = ha.idAdresse
		WHERE ha.numero<>'0' AND ha.numero<>'' AND ha.idAdresse IS NOT NULL
		GROUP BY r.idRue
		ORDER BY nbAdresses DESC
		$sqlLimit
		";


		$resRues = $this->connexionBdd->requete($reqRues);

		if (!isset($params['noPagination']) || $params['noPagination']==false) {
			$paginationHTML = $arrayPagination['html']."<br>";
		}

		$tableau = new tableau();

		while ($fetchRues = mysql_fetch_assoc($resRues)) {
			$intituleRue = $adresse->getIntituleAdresseFrom($fetchRues['idRue'], 'idRue');
			$tableau->addValue("<a href='".$this->creerUrl('', 'listeAdressesFromRue', array('recherche_rue'=>$fetchRues['idRue'], 'noAdresseSansNumero'=>1))."'>".$intituleRue."</a>&nbsp;(".$fetchRues['nbAdresses'].")");

			$tableau->addValue("<img src='".$adresse->getUrlImageFromRue($fetchRues['idRue'], 'mini')."' alt=\"".$intituleRue."\" title=\"".$intituleRue."\" >");
		}

		return $titre.$paginationHTML.$tableau->createHtmlTableFromArray(2, "", "tableau");
	}
554998
public function reviews()
    {
        if (is_null($this->reviewRequests)) {
            $this->reviewRequests = new ReviewRequests($this->client);
        }

        return $this->reviewRequests;
    }
615256
public function all(array $params = array())
    {
        $endpoint = '/admin/reports.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Report::class, $response['reports']);
    }
884787
protected function prepareReviewsProduct(array &$reviews)
    {
        if (!empty($reviews)) {

            $users = array();
            foreach ($reviews as $review) {
                $users[] = $review['user_id'];
            }

            $ratings = null;

            if (!empty($users)) {
                $ratings = $this->rating->getByUser($this->data_product['product_id'], $users);
            }

            foreach ($reviews as &$review) {

                $rating = array('rating' => 0);

                if (isset($ratings[$review['user_id']]['rating'])) {
                    $rating['rating'] = $ratings[$review['user_id']]['rating'];
                }

                $review['rating'] = $rating['rating'];
                $review['rating_formatted'] = $this->render('common/rating/static', array('rating' => $rating));
            }
        }
    }
140325
protected function checkResult(array $results, array $params)
    {
        $exceptions = new Exception\SaveException();

        for ($i = 0; $i < count($results); $i++) {

            // If the param was an (s)object, set it’s Id field
            if (is_object($params[$i])
                && (!isset($params[$i]->Id) || null === $params[$i]->Id)
                && $results[$i] instanceof Result\SaveResult) {
                $params[$i]->Id = $results[$i]->getId();
            }

            if (!$results[$i]->isSuccess()) {
                $results[$i]->setParam($params[$i]);
                $exceptions->add($results[$i]);
            }
        }

        if ($exceptions->count() > 0) {
            throw $exceptions;
        }

        return $results;
    }
545815
private function mapReviewAndRatingList($reviewAndRatingDataList)
    {
        $mappedReviewAndRating = new ArrayCollection();

        foreach ($reviewAndRatingDataList as $reviewAndRatingData) {
            $mappedReviewAndRating[] = $this->mapReviewAndRating($reviewAndRatingData);
        }

        return $mappedReviewAndRating;
    }
631035
public function listObjects($params = [])
    {
        $bucket = $params['bucket'];

        $endpoint = str_replace('{bucket}', $bucket, $this->_endpoint);

        $params[] = $endpoint . '/api/objects';
        $access_key = is_string($this->_access_key) ? $this->_access_key : $this->_access_key[$bucket];
        $params['token'] = jwt_encode(['scope' => 'bos.object.list', 'bucket' => $bucket], 60, $access_key);

        $body = rest_get($params)['body'];

        $this->logger->debug($body, 'bosClient.listObjects');

        if ($body['code'] !== 0) {
            throw new Exception($body['message'], $body['code']);
        }

        return $body['data']['items'];
    }
1082628
public function search($params)
    {
        $subquery = (new Query())
                    ->select(['m2.replyto'])
                    ->from(['m1' => Message::tableName()])
                    ->leftJoin(['m2' => Message::tableName()], 'm1.replyto = m2.id')
                    ->where(['is not', 'm2.replyto', null]);
        $query = static::find()->where(['and',
            ['receiver_id' => User::loggedId()],
            ['!=', 'receiver_status', self::STATUS_DELETED],
            ['not in', 'message_id', $subquery]
        ]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $dataProvider->sort->attributes['senderName'] = [
            'asc' => [
                User::tableName() . '.username' => SORT_ASC,
                User::tableName() . '.id' => SORT_ASC
            ],
            'desc' => [
                User::tableName() . '.username' => SORT_DESC,
                User::tableName() . '.id' => SORT_DESC
            ],
            'default' => SORT_ASC
        ];
        $dataProvider->sort->defaultOrder = ['id' => SORT_DESC];
        $dataProvider->pagination->pageSize = Yii::$app->session->get('per-page', 20);

        if (!($this->load($params) && $this->validate())) {
            $dataProvider->query->joinWith(['message' => function ($q) {
                $q->joinWith(['sender']);
            }]);
            return $dataProvider;
        }

        $dataProvider->query->andFilterWhere(['like', 'topic', $this->topic]);

        if (preg_match('/^(forum|orum|rum|um|m)?#([0-9]+)$/', strtolower($this->senderName), $matches)) {
            $dataProvider->query->joinWith(['message' => function ($q) use ($matches) {
                $q->joinWith(['sender' => function ($q) use ($matches) {
                    $q->andFilterWhere(['and',
                        [User::tableName() . '.id' => $matches[2]],
                        ['or',
                            ['username' => ''],
                            ['username' => null]
                        ]
                    ]);
                }]);
            }]);
        } elseif (preg_match('/^([0-9]+)$/', $this->senderName, $matches)) {
            $dataProvider->query->joinWith(['message' => function ($q) use ($matches) {
                $q->joinWith(['sender' => function ($q) use ($matches) {
                    $q->andFilterWhere(['or',
                        ['like', 'username', $this->senderName],
                        ['and',
                            ['id' => $matches[1]],
                            ['or',
                                ['username' => ''],
                                ['username' => null]
                            ]
                        ],
                    ]);
                }]);
            }]);
        } else {
            $dataProvider->query->joinWith(['message' => function ($q) {
                $q->joinWith(['sender' => function ($q) {
                    $q->andFilterWhere(['like', User::tableName() . '.username', $this->senderName]);
                }]);
            }]);
        }
        return $dataProvider;
    }
1331371
public function get($id, $params = null)
    {
        $id = (int)$id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->get("$this->action/$id", $params);
    }