예제 #1
0
 /**
  * @param Application $application
  * @return string
  */
 public function getWorkspacePath(Application $application)
 {
     $workspacePath = FLOW_PATH_DATA . 'Surf/';
     if ($application->hasOption('repositoryUrl')) {
         $urlParts = GeneralUtility::getUrlPartsFromRepositoryUrl($application->getOption('repositoryUrl'));
         $workspacePath .= preg_replace('/[^a-zA-Z0-9]/', '-', $urlParts['path']);
         $workspacePath .= '_' . substr(sha1($application->getOption('repositoryUrl')), 0, 5);
     } else {
         // Default
         $workspacePath .= $this->getName() . '/' . $application->getName();
     }
     return $workspacePath;
 }
예제 #2
0
 /**
  * @param string $string
  * @param string $expectation
  * @return void
  * @test
  * @dataProvider camelCaseToLowerCaseUnderscoredDataProvider
  */
 public function camelCaseToLowerCaseUnderscoredReturnsConvertedString($string, $expectation)
 {
     $this->assertSame(GeneralUtility::camelCaseToLowerCaseUnderscored($string), $expectation);
 }
예제 #3
0
 /**
  * @param object $object
  * @param string $property
  * @param array $objectData
  * @param array $settings
  * @param string $key
  * @return mixed
  */
 protected function getPropertyValue($object, $property, $objectData, $settings, $key)
 {
     $value = NULL;
     // Value is configured by settings
     $modelName = $this->getModelName($object);
     if (isset($settings[$modelName][$property])) {
         if ($settings[$modelName][$property] === '{{_KEY_}}') {
             return $key;
         }
         if (is_array($settings[$modelName][$property])) {
             $value = array();
             foreach ($settings[$modelName][$property] as $key => $marker) {
                 $value[$key] = MarkerUtility::replaceVariablesInValue($marker, $objectData);
             }
         } else {
             $value = MarkerUtility::replaceVariablesInValue($settings[$modelName][$property], $objectData);
         }
     } else {
         $dataKeys = array($property, GeneralUtility::camelCaseToLowerCaseUnderscored($property));
         foreach ($dataKeys as $key) {
             if (isset($objectData[$key])) {
                 $value = $objectData[$key];
                 break;
             }
         }
     }
     // Is value an object? If yes, then render it as object
     if (is_array($value)) {
         $className = 'Lightwerk\\SurfCaptain\\Domain\\Model\\' . ucfirst($property);
         if (class_exists($className)) {
             $value = $this->mapToObject($value, $className, $settings);
         }
     }
     return $value;
 }