diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php index 2ec3d5f..a9d434a 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Condition.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Condition.php @@ -89,9 +89,9 @@ public function notExists($field, $langcode = NULL) { } /** - * Match for an array representing one or more config paths. + * Matches for an array representing one or more config paths. * - * @param $condition + * @param array $condition * The condition array as created by the condition() method. * @param array $data * The config array or part of it. @@ -104,7 +104,7 @@ public function notExists($field, $langcode = NULL) { * @return bool * TRUE when the condition matched to the data else FALSE. */ - protected function matchArray($condition, array $data, array $needs_matching, array $parents = array()) { + protected function matchArray(array $condition, array $data, array $needs_matching, array $parents = array()) { $parent = array_shift($needs_matching); $candidates = array(); if ($parent === '*') { @@ -129,16 +129,17 @@ protected function matchArray($condition, array $data, array $needs_matching, ar } /** - * Do the actual matching. + * Perform the actual matching. * - * @param $condition + * @param array $condition * The condition array as created by the condition() method. - * @param $value + * @param string $value * The value to match against. + * * @return bool - * TRUE when matches. + * TRUE when matches else FALSE. */ - protected function match($condition, $value) { + protected function match(array $condition, $value) { if (isset($value)) { switch ($condition['operator']) { case '=': diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index bdbb5cf..baba973 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -33,6 +33,16 @@ class Query extends QueryBase { /** * Constructs a Query object. + * + * @param string $entity_type + * The entity type. + * @param string $conjunction + * - AND: all of the conditions on the query need to match. + * - OR: at least one of the conditions on the query need to match. + * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager that stores all meta information. + * @param \Drupal\Core\Config\StorageInterface $config_storage + * The actual config storage which is used to list all config items. */ function __construct($entity_type, $conjunction, EntityManager $entity_manager, StorageInterface $config_storage) { parent::__construct($entity_type, $conjunction); diff --git a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php index 22c7799..cb71aa3 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryFactory.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryFactory.php @@ -16,21 +16,33 @@ class QueryFactory extends ContainerAware { /** + * Stores the entity manager used by the query. + * * @var \Drupal\Core\Entity\EntityManager */ protected $entityManager; /** + * Constructs a QueryFactory object. + * * @param \Drupal\Core\Entity\EntityManager $entity_manager + * The entity manager used by the query. */ public function __construct(EntityManager $entity_manager) { $this->entityManager = $entity_manager; } /** + * Returns a query object for a given entity type. + * * @param string $entity_type + * The entity type. * @param string $conjunction - * @return QueryInterface + * - AND: all of the conditions on the query need to match. + * - OR: at least one of the conditions on the query need to match. + * + * @return \Drupal\Core\Entity\Query\QueryInterface + * The query object that can query the given entity type. */ public function get($entity_type, $conjunction = 'AND') { $service_name = $this->entityManager->getStorageController($entity_type)->getQueryServicename(); diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php index c1f6b8e..88e7583 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Plugin/Core/Entity/ConfigQueryTest.php @@ -31,17 +31,22 @@ * } * ) * - * @see \Drupal\entity\Tests\ConfigEntityQueryTest + * @see \Drupal\entity\Tests\ConfigEntityQueryTest */ class ConfigQueryTest extends ConfigTest { /** * A number used by the sort tests. + * + * @var int */ public $number; /** * An array used by the wildcard tests. + * + * @var array */ public $array; + } diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php index 9caee1a..f0d3d6a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/ConfigEntityQueryTest.php @@ -12,7 +12,7 @@ /** * Tests the config entity query. * - * @see \Drupal\Core\entity\Query + * @see \Drupal\Core\Config\Entity\Query */ class ConfigEntityQueryTest extends DrupalUnitTestBase { @@ -54,7 +54,8 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->entities = array(); + + $this->entities = array(); $this->enableModules(array('entity'), TRUE); $this->factory = $this->container->get('entity.query'); @@ -120,7 +121,7 @@ protected function setUp() { } /** - * Test basic functionality. + * Tests basic functionality. */ public function testConfigEntityQuery() { // Run a test without any condition. @@ -323,7 +324,7 @@ public function testConfigEntityQuery() { } /** - * Test count query. + * Tests count query. */ protected function testCount() { // Test count on no conditions. @@ -405,7 +406,7 @@ protected function testSortRange() { } /** - * Test dotted path matching. + * Tests dotted path matching. */ protected function testDotted() { $this->queryResults = $this->factory->get('config_query_test')