Example #1
0
 /**
  * Checks if a supplied name matches this property's name.
  *
  * @param mixed $names List of names to check.
  * @return bool
  */
 function matches($names)
 {
     //Check every argument supplied
     foreach (func_get_args() as $name) {
         //Check for any possible match
         if (0 === strcasecmp($name, $this->name) || 0 === strcasecmp($name, $this->property->getName()) || 0 === strcasecmp($name, Reflection::normalizeProperty($this->property->getName()))) {
             return true;
         }
     }
     return false;
 }
Example #2
0
 /**
  * Gets a indexed property name, after doing required string manipulations.
  *
  * @param string $property Property name.
  * @return string The searchable index name.
  * @throws Exception Thrown if the property is not indexed.
  */
 private function getSearchableProperty($property)
 {
     $property = Meta\Reflection::normalizeProperty($property);
     foreach ($this->meta->getIndexedProperties() as $p) {
         if (Meta\Reflection::normalizeProperty($p->getName()) == $property) {
             return $property;
         }
     }
     //Node properties only have indexing problems
     if ($this->meta instanceof Node) {
         throw new Exception("Property {$property} is not indexed or does not exist in {$this->meta->getName()}.");
     } else {
         throw new Exception("Property noName is either not indexed, not a start/end, or does not exist in {$this->meta->getName()}.");
     }
 }