Skip to content

Commit

Permalink
Move convert_to_object to devshop_projects.module.
Browse files Browse the repository at this point in the history
  • Loading branch information
josebc authored and jonpugh committed Nov 21, 2019
1 parent d9f8835 commit 37cd57b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
14 changes: 0 additions & 14 deletions modules/devshop/devshop_github/devshop_github.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

require_once('includes/queue.inc');

use Symfony\Component\Yaml\Yaml;

/**
* Retrieve the token from either environment variable or drupal variable.
* @return mixed
Expand Down Expand Up @@ -395,18 +393,6 @@ function devshop_github_form_site_node_form_validate_pr($element, &$form_state,
}
}

/**
* Helper to normalize arrays to objects.
*
* @param $array
* @return mixed
*/
function convert_to_object($thing) {
$yml = Yaml::dump($thing, 2, 2, Yaml::DUMP_OBJECT_AS_MAP);
$object = Yaml::parse($yml, Yaml::PARSE_OBJECT_FOR_MAP);
return $object;
}

/**
* Implements hook_form_alter().
*/
Expand Down
13 changes: 13 additions & 0 deletions modules/devshop/devshop_projects/devshop_projects.module
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include_once('tasks/create.inc');
include_once('tasks/pull.inc');
include_once('tasks/deploy.inc');

use Symfony\Component\Yaml\Yaml;

/**
* Implements hook_init().
Expand Down Expand Up @@ -901,3 +902,15 @@ function devshop_projects_load_by_name($name) {

return node_load($nid);
}

/**
* Helper to normalize arrays to objects.
*
* @param $array
* @return mixed
*/
function convert_to_object($thing) {
$yml = Yaml::dump($thing, 2, 2, Yaml::DUMP_OBJECT_AS_MAP);
$object = Yaml::parse($yml, Yaml::PARSE_OBJECT_FOR_MAP);
return $object;
}

0 comments on commit 37cd57b

Please sign in to comment.