Skip to content

Commit

Permalink
remove deprecated methods from StatementsFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 3, 2017
1 parent 55cba18 commit 07adc87
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 102 deletions.
6 changes: 6 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
UPGRADE
=======

Upgrading from 1.x to 2.0
-------------------------

* The `StatementsFilter::format()`, `StatementsFilter::includeAttachments()`,
and `StatementsFilter::excludeAttachments()` methods have been removed.

Upgrading from 1.0 to 1.1
-------------------------

Expand Down
35 changes: 0 additions & 35 deletions spec/StatementsFilterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,6 @@ function it_can_disable_to_filter_related_agents()
$filter->shouldHaveKeyWithValue('related_agents', 'false');
}

function it_can_include_attachments()
{
$this->includeAttachments()->shouldReturn($this);

$filter = $this->getFilter();
$filter->shouldHaveCount(1);
$filter->shouldHaveKeyWithValue('attachments', 'true');
}

function it_can_exclude_attachments()
{
$this->excludeAttachments()->shouldReturn($this);

$filter = $this->getFilter();
$filter->shouldHaveCount(1);
$filter->shouldHaveKeyWithValue('attachments', 'false');
}

function it_can_filter_by_timestamp()
{
$this->since(\DateTime::createFromFormat(\DateTime::ISO8601, '2013-05-18T05:32:34Z'))->shouldReturn($this);
Expand Down Expand Up @@ -159,21 +141,4 @@ function it_rejects_choosing_a_negative_number_of_results()
{
$this->shouldThrow('\InvalidArgumentException')->duringLimit(-1);
}

function it_can_change_the_result_format()
{
$this->format('ids')->shouldReturn($this);
$this->getFilter()->shouldHaveKeyWithValue('format', 'ids');

$this->format('exact')->shouldReturn($this);
$this->getFilter()->shouldHaveKeyWithValue('format', 'exact');

$this->format('canonical')->shouldReturn($this);
$this->getFilter()->shouldHaveKeyWithValue('format', 'canonical');
}

function it_rejects_invalid_format_filter()
{
$this->shouldThrow('\InvalidArgumentException')->duringFormat('minimal');
}
}
67 changes: 0 additions & 67 deletions src/StatementsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,73 +177,6 @@ public function limit($limit)
return $this;
}

/**
* Specifies the format of the StatementResult being returned.
*
* "ids": Includes only information for the Agent, Activity and Group
* needed to identify them.
*
* "exact": Agents, Groups and Activities will be returned as they were when
* the Statements where received by the LRS.
*
* "canonical": For objects containing language maps, only the most appropriate
* language will be returned. Agent objects will be returned as if the "exact"
* format was given.
*
* @param string $format A valid format identifier (one of "ids", "exact"
* or "canonical"
*
* @return self The statements filter
*
* @throws \InvalidArgumentException if no valid format is given
*
* @deprecated since 1.1, to be removed in 2.0
*/
public function format($format)
{
@trigger_error(sprintf('The "%s()" method is deprecated since 1.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);

if (!in_array($format, array('ids', 'exact', 'canonical'))) {
throw new \InvalidArgumentException('Unknown format '.$format.' given');
}

$this->filter['format'] = $format;

return $this;
}

/**
* Query attachments for each Statement being returned.
*
* @return self The statements filter
*
* @deprecated since 1.1, to be removed in 2.0
*/
public function includeAttachments()
{
@trigger_error(sprintf('The "%s()" method is deprecated since 1.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);

$this->filter['attachments'] = 'true';

return $this;
}

/**
* Don't query for Statement attachments (the default behavior).
*
* @return self The statements filter
*
* @deprecated since 1.1, to be removed in 2.0
*/
public function excludeAttachments()
{
@trigger_error(sprintf('The "%s()" method is deprecated since 1.1 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);

$this->filter['attachments'] = 'false';

return $this;
}

/**
* Return statements in ascending order of stored time.
*
Expand Down

0 comments on commit 07adc87

Please # to comment.