예제 #1
0
 /**
  * Search for any style methods within the name and apply them
  *
  * @param  string $name
  * @return string Anything left over after applying styles
  */
 protected function applyStyleMethods($name)
 {
     // Get all of the possible style attributes
     $method_search = array_keys($this->style->all());
     // A flag to see if we are still finding valid methods
     // We need this flag because of terminal objects
     // and failing gracefully when a whack method is passed in
     $found_method = true;
     // While we still have a name left and we keep finding methods,
     // loop through the possibilities
     while (strlen($name) > 0 && $found_method) {
         // We haven't found a method in the current loop yet
         $current_loop_found = false;
         // Loop through the possible methods
         foreach ($method_search as $method) {
             // See if we found a valid method
             $new_name = $this->parseStyleMethod($method, $name);
             // If we haven't found one in the loop yet and the name changed,
             // guess what: we found a valid method
             if (!$current_loop_found && $new_name != $name) {
                 $current_loop_found = true;
             }
             // Set the name to the new name
             $name = $new_name;
         }
         // Set the found method flag just in case we don't have any more valid methods
         $found_method = $current_loop_found;
     }
     return $name;
 }
예제 #2
0
 /**
  * Search for any style methods within the name and apply them
  *
  * @param  string $name
  * @param  array $method_search
  *
  * @return string Anything left over after applying styles
  */
 protected function applyStyleMethods($name, $method_search = null)
 {
     // Get all of the possible style attributes
     $method_search = $method_search ?: array_keys($this->style->all());
     $new_name = $this->searchForStyleMethods($name, $method_search);
     // While we still have a name left and we keep finding methods,
     // loop through the possibilities
     if (strlen($new_name) > 0 && $new_name != $name) {
         return $this->applyStyleMethods($new_name, $method_search);
     }
     return $new_name;
 }