Skip to content

Commit

Permalink
Pint
Browse files Browse the repository at this point in the history
  • Loading branch information
Plytas committed Nov 8, 2024
1 parent 07ad875 commit ea72d7a
Show file tree
Hide file tree
Showing 30 changed files with 41 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function setDimensions(Closure $callback): static
*/
public function dimensionFilter(Closure $callback): static
{
$this->requestData->dimensionFilter = $callback(new FilterExpression());
$this->requestData->dimensionFilter = $callback(new FilterExpression);

return $this;
}
Expand All @@ -93,7 +93,7 @@ public function dimensionFilter(Closure $callback): static
*/
public function metricFilter(Closure $callback): static
{
$this->requestData->metricFilter = $callback(new FilterExpression());
$this->requestData->metricFilter = $callback(new FilterExpression);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Dimensions

public function __construct()
{
$this->dimensions = new Collection();
$this->dimensions = new Collection;
}

public function count(): int
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Filters/AndGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(
Closure $expression,
private readonly FilterExpressionField $field = FilterExpressionField::AND_GROUP,
) {
$this->expression = $expression(new FilterExpressionList());
$this->expression = $expression(new FilterExpressionList);
}

public function toRequest(): BaseFilterExpressionList
Expand Down
3 changes: 1 addition & 2 deletions src/Request/Filters/BetweenFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function __construct(
private readonly float|int $max = 0,
private readonly NumericValueType $valueType = NumericValueType::INTEGER,
private readonly FilterField $field = FilterField::BETWEEN_FILTER,
) {
}
) {}

public function toRequest(): BaseBetweenFilter
{
Expand Down
17 changes: 8 additions & 9 deletions src/Request/Filters/FilterExpressionList.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ class FilterExpressionList
{
public function __construct(
/** @var Collection<int, FilterExpression> */
private readonly Collection $expressions = new Collection(),
) {
}
private readonly Collection $expressions = new Collection,
) {}

/**
* @param Closure(FilterExpressionList): FilterExpressionList $filterExpressionList
*/
public function andGroup(Closure $filterExpressionList): static
{
$this->expressions->push((new FilterExpression())->andGroup($filterExpressionList));
$this->expressions->push((new FilterExpression)->andGroup($filterExpressionList));

return $this;
}
Expand All @@ -30,7 +29,7 @@ public function andGroup(Closure $filterExpressionList): static
*/
public function orGroup(Closure $filterExpressionList): static
{
$this->expressions->push((new FilterExpression())->orGroup($filterExpressionList));
$this->expressions->push((new FilterExpression)->orGroup($filterExpressionList));

return $this;
}
Expand All @@ -40,7 +39,7 @@ public function orGroup(Closure $filterExpressionList): static
*/
public function not(Closure $filterExpression): static
{
$this->expressions->push((new FilterExpression())->not($filterExpression));
$this->expressions->push((new FilterExpression)->not($filterExpression));

return $this;
}
Expand All @@ -50,7 +49,7 @@ public function not(Closure $filterExpression): static
*/
public function filter(string $dimension, Closure $filter): static
{
$this->expressions->push((new FilterExpression())->filter($dimension, $filter));
$this->expressions->push((new FilterExpression)->filter($dimension, $filter));

return $this;
}
Expand All @@ -62,7 +61,7 @@ public function filter(string $dimension, Closure $filter): static
*/
public function filterDimension(Closure $dimensionsCallback, Closure $filter): static
{
$this->expressions->push((new FilterExpression())->filterDimension($dimensionsCallback, $filter));
$this->expressions->push((new FilterExpression)->filterDimension($dimensionsCallback, $filter));

return $this;
}
Expand All @@ -74,7 +73,7 @@ public function filterDimension(Closure $dimensionsCallback, Closure $filter): s
*/
public function filterMetric(Closure $metricsCallback, Closure $filter): static
{
$this->expressions->push((new FilterExpression())->filterMetric($metricsCallback, $filter));
$this->expressions->push((new FilterExpression)->filterMetric($metricsCallback, $filter));

return $this;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Request/Filters/InListFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public function __construct(
public array $values = [],
public bool $caseSensitive = false,
private readonly FilterField $field = FilterField::IN_LIST_FILTER,
) {
}
) {}

public function field(): FilterField
{
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Filters/NotExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(
Closure $expression,
private readonly FilterExpressionField $field = FilterExpressionField::NOT_EXPRESSION,
) {
$this->expression = $expression(new FilterExpression());
$this->expression = $expression(new FilterExpression);
}

public function toRequest(): BaseFilterExpression
Expand Down
3 changes: 1 addition & 2 deletions src/Request/Filters/NumericFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
private readonly float|int $value = 0,
private readonly NumericValueType $valueType = NumericValueType::INTEGER,
private readonly FilterField $field = FilterField::NUMERIC_FILTER,
) {
}
) {}

public function toRequest(): BaseNumericFilter
{
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Filters/OrGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(
Closure $expression,
private readonly FilterExpressionField $field = FilterExpressionField::OR_GROUP,
) {
$this->expression = $expression(new FilterExpressionList());
$this->expression = $expression(new FilterExpressionList);
}

public function toRequest(): BaseFilterExpressionList
Expand Down
3 changes: 1 addition & 2 deletions src/Request/Filters/StringFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function __construct(
private readonly string $value = '',
private readonly bool $caseSensitive = false,
private readonly FilterField $field = FilterField::STRING_FILTER,
) {
}
) {}

public function toRequest(): BaseStringFilter
{
Expand Down
2 changes: 1 addition & 1 deletion src/Request/Metrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Metrics

public function __construct()
{
$this->metrics = new Collection();
$this->metrics = new Collection;
}

public function count(): int
Expand Down
9 changes: 4 additions & 5 deletions src/Request/RequestData.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class RequestData extends Data
public function __construct(
public string $propertyId,
/** @var Collection<int, DateRange> */
public Collection $dateRanges = new Collection(),
public Collection $dateRanges = new Collection,
/** @var Collection<int, Metric> */
public Collection $metrics = new Collection(),
public Collection $metrics = new Collection,
/** @var Collection<int, Dimension> */
public Collection $dimensions = new Collection(),
public Collection $dimensions = new Collection,

public ?FilterExpression $dimensionFilter = null,

Expand All @@ -39,8 +39,7 @@ public function __construct(
public int $limit = 10_000,

public int $offset = 0,
) {
}
) {}

/** @return array{property: string, dateRanges: DateRange[], dimensions: Dimension[], metrics: Metric[], dimensionFilter: BaseFilterExpression|null, returnPropertyQuota: bool, metricAggregations: int[]} */
public function toArray(): array
Expand Down
3 changes: 1 addition & 2 deletions src/Response/DimensionHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class DimensionHeader extends Data
{
public function __construct(
public string $name,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/DimensionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class DimensionValue extends Data
{
public function __construct(
public string $value,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class Metadata extends Data
public function __construct(
public string $currencyCode,
public string $timeZone,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/MetricHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class MetricHeader extends Data
public function __construct(
public string $name,
public string $type //Could be ENUM
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/MetricValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class MetricValue extends Data
{
public function __construct(
public string $value,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/PropertyQuota.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ public function __construct(
public ServerErrorsPerProjectPerHour $serverErrorsPerProjectPerHour,
public PotentiallyThresholdedRequestsPerHour $potentiallyThresholdedRequestsPerHour,
public TokensPerProjectPerHour $tokensPerProjectPerHour,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Quotas/ConcurrentRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class ConcurrentRequests extends Data
{
public function __construct(
public int $remaining,
) {
}
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class PotentiallyThresholdedRequestsPerHour extends Data
{
public function __construct(
public int $remaining,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Quotas/ServerErrorsPerProjectPerHour.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ class ServerErrorsPerProjectPerHour extends Data
{
public function __construct(
public int $remaining,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Quotas/TokensPerDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class TokensPerDay extends Data
public function __construct(
public int $consumed,
public int $remaining,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Quotas/TokensPerHour.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class TokensPerHour extends Data
public function __construct(
public int $consumed,
public int $remaining,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Quotas/TokensPerProjectPerHour.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ class TokensPerProjectPerHour extends Data
public function __construct(
public int $consumed,
public int $remaining,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/ResponseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public function __construct(
public Metadata $metadata,
public ?PropertyQuota $propertyQuota,
public string $kind,
) {
}
) {}

public static function fromReportResponse(RunReportResponse $reportResponse): static
{
Expand Down
3 changes: 1 addition & 2 deletions src/Response/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ public function __construct(
public ?DataCollection $dimensionValues,
#[DataCollectionOf(MetricValue::class)]
public DataCollection $metricValues,
) {
}
) {}
}
3 changes: 1 addition & 2 deletions src/Response/Total.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ public function __construct(
public DataCollection $dimensionValues,
#[DataCollectionOf(MetricValue::class)]
public DataCollection $metricValues,
) {
}
) {}
}
2 changes: 1 addition & 1 deletion tests/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AnalyticsTest extends TestCase
{
public function test_default_constructor(): void
{
$this->assertInstanceOf(Analytics::class, new Analytics());
$this->assertInstanceOf(Analytics::class, new Analytics);
}

public function test_constructor_with_propertyid(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/DimensionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ public function dimensionProvider(): Generator
*/
public function test_predefined_dimensions(Closure $method, string $dimension): void
{
$dimensions = new Dimensions();
$dimensions = new Dimensions;
$dimensions = $method($dimensions);

$this->assertEquals(1, $dimensions->count());
Expand Down
2 changes: 1 addition & 1 deletion tests/MetricsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public function metricProvider(): Generator
*/
public function test_predefined_metrics(Closure $method, string $metric): void
{
$metrics = new Metrics();
$metrics = new Metrics;
$metrics = $method($metrics);

$this->assertEquals(1, $metrics->count());
Expand Down

0 comments on commit ea72d7a

Please sign in to comment.