Skip to content

Commit

Permalink
Deprecate unsuffixed processor classes
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Dec 4, 2020
1 parent 469e0ec commit 507d174
Show file tree
Hide file tree
Showing 15 changed files with 396 additions and 325 deletions.
38 changes: 4 additions & 34 deletions src/Processor/Append.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,16 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Append::class, AppendProcessor::class);

/**
* Elastica Append Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html
* @deprecated since version 7.1.0, use the AppendProcessor class instead.
*/
class Append extends AbstractProcessor
class Append extends AppendProcessor
{
/**
* Append constructor.
*
* @param string $field field name
* @param array|string $value field values to append
*/
public function __construct(string $field, $value)
{
$this->setField($field);
$this->setValue($value);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set field value.
*
* @param array|string $value
*
* @return $this
*/
public function setValue($value): self
{
return $this->setParam('value', $value);
}
}
45 changes: 45 additions & 0 deletions src/Processor/AppendProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Elastica\Processor;

/**
* Elastica Append Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html
*/
class AppendProcessor extends AbstractProcessor
{
/**
* @param string $field field name
* @param array|string $value field values to append
*/
public function __construct(string $field, $value)
{
$this->setField($field);
$this->setValue($value);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set field value.
*
* @param array|string $value
*
* @return $this
*/
public function setValue($value): self
{
return $this->setParam('value', $value);
}
}
66 changes: 4 additions & 62 deletions src/Processor/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,16 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Attachment::class, AttachmentProcessor::class);

/**
* Elastica Attachment Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html
* @deprecated since version 7.1.0, use the AttachmentProcessor class instead.
*/
class Attachment extends AbstractProcessor
class Attachment extends AttachmentProcessor
{
public const DEFAULT_TARGET_FIELD_VALUE = 'attachment';
public const DEFAULT_INDEXED_CHARS_VALUE = 100000;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Attachment constructor.
*/
public function __construct(string $field)
{
$this->setField($field);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set target_field. Default attachment.
*
* @return $this
*/
public function setTargetField(string $targetField): self
{
return $this->setParam('target_field', $targetField);
}

/**
* Set indexed_chars. Default 100000.
*
* @return $this
*/
public function setIndexedChars(int $indexedChars): self
{
return $this->setParam('indexed_chars', $indexedChars);
}

/**
* Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language.
*
* @return $this
*/
public function setProperties(array $properties): self
{
return $this->setParam('properties', $properties);
}

/**
* Set ignore_missing. Default value false.
*
* @return $this
*/
public function setIgnoreMissing(bool $ignoreMissing): self
{
return $this->setParam('ignore_missing', $ignoreMissing);
}
}
72 changes: 72 additions & 0 deletions src/Processor/AttachmentProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Elastica\Processor;

/**
* Elastica Attachment Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html
*/
class AttachmentProcessor extends AbstractProcessor
{
public const DEFAULT_TARGET_FIELD_VALUE = 'attachment';
public const DEFAULT_INDEXED_CHARS_VALUE = 100000;
public const DEFAULT_IGNORE_MISSING_VALUE = false;

public function __construct(string $field)
{
$this->setField($field);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set target_field. Default attachment.
*
* @return $this
*/
public function setTargetField(string $targetField): self
{
return $this->setParam('target_field', $targetField);
}

/**
* Set indexed_chars. Default 100000.
*
* @return $this
*/
public function setIndexedChars(int $indexedChars): self
{
return $this->setParam('indexed_chars', $indexedChars);
}

/**
* Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language.
*
* @return $this
*/
public function setProperties(array $properties): self
{
return $this->setParam('properties', $properties);
}

/**
* Set ignore_missing. Default value false.
*
* @return $this
*/
public function setIgnoreMissing(bool $ignoreMissing): self
{
return $this->setParam('ignore_missing', $ignoreMissing);
}
}
58 changes: 4 additions & 54 deletions src/Processor/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,16 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Convert::class, ConvertProcessor::class);

/**
* Elastica Convert Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html
* @deprecated since version 7.1.0, use the ConvertProcessor class instead.
*/
class Convert extends AbstractProcessor
class Convert extends ConvertProcessor
{
public const DEFAULT_TARGET_FIELD_VALUE = 'field';
public const DEFAULT_IGNORE_MISSING_VALUE = false;

/**
* Convert constructor.
*/
public function __construct(string $field, string $type)
{
$this->setField($field);
$this->setType($type);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set field value.
*
* @return $this
*/
public function setType(string $type): self
{
return $this->setParam('type', $type);
}

/**
* Set target_field. Default value field.
*
* @return $this
*/
public function setTargetField(string $targetField): self
{
return $this->setParam('target_field', $targetField);
}

/**
* Set ignore_missing. Default value false.
*
* @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto)
*
* @return $this
*/
public function setIgnoreMissing(bool $ignoreMissing): self
{
return $this->setParam('ignore_missing', $ignoreMissing);
}
}
64 changes: 64 additions & 0 deletions src/Processor/ConvertProcessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace Elastica\Processor;

/**
* Elastica Convert Processor.
*
* @author Federico Panini <[email protected]>
*
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html
*/
class ConvertProcessor extends AbstractProcessor
{
public const DEFAULT_TARGET_FIELD_VALUE = 'field';
public const DEFAULT_IGNORE_MISSING_VALUE = false;

public function __construct(string $field, string $type)
{
$this->setField($field);
$this->setType($type);
}

/**
* Set field.
*
* @return $this
*/
public function setField(string $field): self
{
return $this->setParam('field', $field);
}

/**
* Set field value.
*
* @return $this
*/
public function setType(string $type): self
{
return $this->setParam('type', $type);
}

/**
* Set target_field. Default value field.
*
* @return $this
*/
public function setTargetField(string $targetField): self
{
return $this->setParam('target_field', $targetField);
}

/**
* Set ignore_missing. Default value false.
*
* @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto)
*
* @return $this
*/
public function setIgnoreMissing(bool $ignoreMissing): self
{
return $this->setParam('ignore_missing', $ignoreMissing);
}
}
Loading

0 comments on commit 507d174

Please sign in to comment.