8000 Move the harvest library into the harvest module by beeyayjay · Pull Request #4427 · GetDKAN/dkan · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6507360
Added harvest library files to harvest module.
Mar 5, 2025
b857edb
Updated code to reference harvest module, not library.
Mar 5, 2025
db21531
Autofixes for codeclimate errors.
Mar 10, 2025
bb95469
Manual fixes for codeclimate errors.
Mar 10, 2025
72d1562
Fixed composer merge conflict.
beeyayjay Mar 13, 2025
da65749
Moved test files and updated namespaces.
beeyayjay Mar 13, 2025
1a5afe6
More manual fixes for codeclimate errors.
beeyayjay Mar 17, 2025
798c223
More automated fixes for codeclimate errors.
beeyayjay Mar 17, 2025
8a10d6a
More manual fixes for codeclimate errors.
beeyayjay Mar 19, 2025
fdd9001
Still more manual fixes for codeclimate errors.
beeyayjay Mar 19, 2025
ef1157a
Still more manual fixes for codeclimate errors.
beeyayjay Mar 19, 2025
5a1c3f7
Fixed declared types.
beeyayjay Mar 20, 2025
cb177a8
More codeclimate fixes.
beeyayjay Mar 20, 2025
cfeafb7
More fixes.
beeyayjay Mar 20, 2025
8edd4dd
A few more.
beeyayjay Mar 20, 2025
ccc3027
Fix code complexity.
beeyayjay Mar 24, 2025
673464f
Move test files out of source.
beeyayjay Mar 24, 2025
6bdc061
Moved library tests to unit.
beeyayjay Mar 24, 2025
ccd69d4
Fixed result update failure.
beeyayjay Mar 24, 2025
041a0ff
Fixed param declaration.
beeyayjay Mar 24, 2025
293518b
Fixed transform error count.
beeyayjay Mar 24, 2025
ea9d694
Code climate fix.
beeyayjay Mar 24, 2025
b1f9a35
Param type fix.
beeyayjay Mar 24, 2025
34c62e4
Codeclimate fix.
beeyayjay Mar 24, 2025
09b72ee
Changed 'null' case again.
beeyayjay Mar 24, 2025
a4e6ca5
Made nullables explicit.
beeyayjay Mar 24, 2025
0c55ef2
Removed question marks.
beeyayjay Mar 24, 2025
0d61410
Trying again.
beeyayjay Mar 25, 2025
5ba8895
Update hook to update extract type namespace in db.
beeyayjay Apr 1, 2025
9211716
Codeclimate fixes.
beeyayjay Apr 1, 2025
3a2f3eb
Escape harvest_plans in dump
dafeder Apr 1, 2025
ec02471
Harvest update test.
beeyayjay Apr 3, 2025
6a5f9c6
Updated harvest update test.
beeyayjay Apr 10, 2025
a7373e6
Fixed rebase bug
beeyayjay Apr 10, 2025
deaed06
Fixed type error.
beeyayjay Apr 10, 2025
fd404bb
Update modules/harvest/tests/src/Functional/HarvestCodeConsolidationT…
beeyayjay Apr 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More codeclimate fixes.
  • Loading branch information
beeyayjay committed Apr 10, 2025
commit cb177a8b4b2b91a904f7cec271c012a1ca86f2a3
2 changes: 1 addition & 1 deletion modules/harvest/src/ETL/Extract/DataJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DataJson extends Extract {
10BC0 *
* @param object $harvest_plan
* The harvest plan.
* @param ClientInterface|null $client
* @param \GuzzleHttp\ClientInterface|null $client
* Optional http client.
*/
public function __construct(object $harvest_plan, ?ClientInterface $client = NULL) {
Expand Down
17 changes: 8 additions & 9 deletions modules/harvest/src/ETL/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class Factory {
* @param object $harvest_plan
* The harvest.
* @param object $item_storage
* The item storage
* The item storage.
* @param object $hash_storage
* The item storage
* @param ClientInterface|NULL $client
* The item storage.
* @param /GuzzleHttp/ClientInterface|null $client
* The http client.
*
* @throws \Exception
Expand Down Expand Up @@ -78,8 +78,7 @@ public function __construct(
*
* @throws \Exception
*/
public function get(string $type)
{
public function get(string $type) {
switch ($type) {
case "extract":
$class = $this->harvestPlan->extract->type;
Expand Down Expand Up @@ -113,13 +112,13 @@ public function get(string $type)
*
* @param string $class
* The name of the class.
* @param $config
* @param object $config
* Optional class config.
*
* @return mixed
* The requested object.
*/
private function getOne(string $class, $config = NULL) {
private function getOne(string $class, object $config = NULL) {
if (!$config) {
$config = $this->harvestPlan;
}
Expand All @@ -129,15 +128,15 @@ private function getOne(string $class, $config = NULL) {
/**
* Validate harvest plan against schema.
*
* @param $harvest_plan
* @param object $harvest_plan
* The harvest plan object to test.
*
* @return bool
* Return TRUE if plan validates.
*
* @throws \Exception
*/
public static function validateHarvestPlan($harvest_plan): bool {
public static function validateHarvestPlan(object $harvest_plan): bool {
if (!is_object($harvest_plan)) {
throw new \Exception("Harvest plan must be a php object.");
}
Expand Down
2 changes: 1 addition & 1 deletion modules/harvest/src/ETL/Transform/AddId.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\harvest\ETL\Transform;

/**
* transform to add an identifier.
* Transform to add an identifier.
*/
class AddId extends Transform {

Expand Down
2 changes: 1 addition & 1 deletion modules/harvest/src/ETL/Transform/AddRandomNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Drupal\harvest\ETL\Transform;

/**
* transform to add a random number.
* Transform to add a random number.
*/
class AddRandomNumber extends Transform {

Expand Down
15 changes: 10 additions & 5 deletions modules/harvest/src/Harvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class Harvester {
public const HARVEST_LOAD_UPDATED_ITEM = 1;
public const HARVEST_LOAD_UNCHANGED = 2;

/**
* The Factory object.
*
* @var Factory|Drupal\harvest\ETL\Factory
*/
private Factory $factory;

/**
Expand Down Expand Up @@ -155,16 +160,15 @@ private function executeTransformers(array $transformers, array $items, array &$
*
* @param array $transformers
* The transformers to execute.
* @param object $transformed_item
* The item to transform
* @param object $item
* The item to transform.
* @param string $identifier
* The item identifier.
*
* @return object
* The transformed item.
*/
private function executeTransformersSingle(array $transformers, object $item, string $identifier)
{
private function executeTransformersSingle(array $transformers, object $item, string $identifier) {
$transformed_item = clone $item;

foreach ($transformers as $transformer) {
Expand All @@ -183,10 +187,11 @@ private function executeTransformersSingle(array $transformers, object $item, st

return $transformed_item;
}

/**
* Transform an item.
*
* @param Transform $transformer
* @param \Drupal\harvest\ETL\Transform\Transform $transformer
* The transformer to run.
* @param object $item
* The item to transform.
Expand Down
12 changes: 10 additions & 2 deletions modules/harvest/src/ResultInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
namespace Drupal\harvest;

/**
* Extract helpful information from a harvest result.
* Extracts information from an arroy of harvest result statuses.
*/
class ResultInterpreter {
/**
* The result statuses of actions performed by a harvest.
*
* @var array
*/
private array $result;

/**
Expand Down Expand Up @@ -66,7 +71,10 @@ public function countProcessed(): int {

if (isset($this->result['status']['transform'])) {
foreach (array_keys($this->result['status']['transform']) as $transformer) {
$ids = [...$ids, ...array_keys($this->result['status']['transform'][$transformer])];
$ids = [
...$ids,
...array_keys($this->result['status']['transform'][$transformer])
];
}
}

Expand Down
2 changes: 0 additions & 2 deletions modules/harvest/src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Drupal\harvest;

use Drupal\harvest\Load\Dataset;

/**
* Utilities for managing datasets.
*/
Expand Down
0