Overview

Namespaces

  • Azalea
    • Selenium
      • App
        • Charts
        • Components
        • Encounters
        • Home
        • Login
        • Main
        • Messages
        • Patients
        • Scheduler
      • Core
      • EHR
        • UI
          • Charts
          • Documents
          • Encounters
          • Home
          • Messaging
            • Folders
          • Patients
          • Payments
          • Precerts
          • Reports
          • Scheduler
          • Settings
            • General
              • Locations
              • Roles
              • Users
        • User
      • Login
        • UI
      • PHR
        • UI
        • User
      • Toolkit
        • Exception
        • Validation
    • Util
  • None
  • tests
    • integration
      • barebones
        • controllers
          • charts
          • patients
          • system
        • models
          • billing
          • encounters
          • examples
          • messaging
          • rcm
          • system
    • unit
      • barebones
        • lib
        • utilities
          • calculations

Classes

  • AddPatientTest
  • Azalea\Selenium\App\ApplicationTestCase
  • Azalea\Selenium\App\Charts\Chart
  • Azalea\Selenium\App\Charts\ChartAssessment
  • Azalea\Selenium\App\Charts\ChartDiagnosisCodes
  • Azalea\Selenium\App\Charts\ChartListControls
  • Azalea\Selenium\App\Charts\ChartObjective
  • Azalea\Selenium\App\Charts\ChartProcedureCodes
  • Azalea\Selenium\App\Charts\Charts
  • Azalea\Selenium\App\Charts\ChartSubjective
  • Azalea\Selenium\App\Components\CodeLookup
  • Azalea\Selenium\App\Components\CollectionGrid
  • Azalea\Selenium\App\Components\Popup
  • Azalea\Selenium\App\Customers
  • Azalea\Selenium\App\Encounters\Encounter
  • Azalea\Selenium\App\Encounters\EncounterDiagnosisCodes
  • Azalea\Selenium\App\Encounters\EncounterLedger
  • Azalea\Selenium\App\Encounters\EncounterProcedureCodes
  • Azalea\Selenium\App\Encounters\Encounters
  • Azalea\Selenium\App\Home\Home
  • Azalea\Selenium\App\Login\LoginPage
  • Azalea\Selenium\App\Main\MainSearch
  • Azalea\Selenium\App\Messages\Messages
  • Azalea\Selenium\App\Patients
  • Azalea\Selenium\App\Patients\Patient
  • Azalea\Selenium\App\Patients\PatientCharts
  • Azalea\Selenium\App\Patients\PatientEditDemographicsForm
  • Azalea\Selenium\App\Patients\PatientEncounters
  • Azalea\Selenium\App\Patients\PatientFaker
  • Azalea\Selenium\App\Patients\PatientList
  • Azalea\Selenium\App\Patients\PatientListFilters
  • Azalea\Selenium\App\Patients\Patients
  • Azalea\Selenium\App\Providers
  • Azalea\Selenium\App\Scheduler\AppointmentPopup
  • Azalea\Selenium\App\Scheduler\Scheduler
  • Azalea\Selenium\App\Users
  • Azalea\Selenium\Core\BaseTestCase
  • Azalea\Selenium\Core\Browser
  • Azalea\Selenium\Core\Page
  • Azalea\Selenium\Core\User
  • Azalea\Selenium\Core\View
  • Azalea\Selenium\Core\WebDriver
  • Azalea\Selenium\EHR\Application
  • Azalea\Selenium\EHR\EHR
  • Azalea\Selenium\EHR\EHRTestCase
  • Azalea\Selenium\EHR\EMR
  • Azalea\Selenium\EHR\PM
  • Azalea\Selenium\EHR\UI\Charts\ChartsList
  • Azalea\Selenium\EHR\UI\Charts\ChartsListRow
  • Azalea\Selenium\EHR\UI\Charts\ChartsListTab
  • Azalea\Selenium\EHR\UI\CheckboxGrid
  • Azalea\Selenium\EHR\UI\Documents\Documents
  • Azalea\Selenium\EHR\UI\Documents\DocumentsTab
  • Azalea\Selenium\EHR\UI\Encounters\Encounters
  • Azalea\Selenium\EHR\UI\Encounters\EncountersTab
  • Azalea\Selenium\EHR\UI\Grid
  • Azalea\Selenium\EHR\UI\GridRow
  • Azalea\Selenium\EHR\UI\Heading
  • Azalea\Selenium\EHR\UI\Home\Home
  • Azalea\Selenium\EHR\UI\Home\OfficeOverview
  • Azalea\Selenium\EHR\UI\LockScreen
  • Azalea\Selenium\EHR\UI\MainMenu
  • Azalea\Selenium\EHR\UI\MainSearch
  • Azalea\Selenium\EHR\UI\Messaging\Folders\MessagingAllMail
  • Azalea\Selenium\EHR\UI\Messaging\Folders\MessagingInbox
  • Azalea\Selenium\EHR\UI\Messaging\Folders\MessagingSentMail
  • Azalea\Selenium\EHR\UI\Messaging\Folders\MessagingStarred
  • Azalea\Selenium\EHR\UI\Messaging\Folders\MessagingTrashed
  • Azalea\Selenium\EHR\UI\Messaging\Messaging
  • Azalea\Selenium\EHR\UI\Messaging\MessagingCompose
  • Azalea\Selenium\EHR\UI\Messaging\MessagingFolder
  • Azalea\Selenium\EHR\UI\Messaging\MessagingMenu
  • Azalea\Selenium\EHR\UI\Messaging\MessagingReply
  • Azalea\Selenium\EHR\UI\Messaging\MessagingTab
  • Azalea\Selenium\EHR\UI\Messaging\MessagingViewMessage
  • Azalea\Selenium\EHR\UI\Module
  • Azalea\Selenium\EHR\UI\Notifications
  • Azalea\Selenium\EHR\UI\Patients\ChartsListRow
  • Azalea\Selenium\EHR\UI\Patients\ChartsTab
  • Azalea\Selenium\EHR\UI\Patients\PatientAllergies
  • Azalea\Selenium\EHR\UI\Patients\PatientAllergyEditPopup
  • Azalea\Selenium\EHR\UI\Patients\PatientAllergySearchPopup
  • Azalea\Selenium\EHR\UI\Patients\PatientAppointments
  • Azalea\Selenium\EHR\UI\Patients\PatientAssembly
  • Azalea\Selenium\EHR\UI\Patients\PatientCharts
  • Azalea\Selenium\EHR\UI\Patients\PatientChartsList
  • Azalea\Selenium\EHR\UI\Patients\PatientComments
  • Azalea\Selenium\EHR\UI\Patients\PatientDashboard
  • Azalea\Selenium\EHR\UI\Patients\PatientDemographics
  • Azalea\Selenium\EHR\UI\Patients\PatientDemographicsPopup
  • Azalea\Selenium\EHR\UI\Patients\PatientDocuments
  • Azalea\Selenium\EHR\UI\Patients\PatientDocumentsList
  • Azalea\Selenium\EHR\UI\Patients\PatientEncounters
  • Azalea\Selenium\EHR\UI\Patients\PatientEncountersAddPopup
  • Azalea\Selenium\EHR\UI\Patients\PatientHandouts
  • Azalea\Selenium\EHR\UI\Patients\PatientInsurance
  • Azalea\Selenium\EHR\UI\Patients\PatientLabOrders
  • Azalea\Selenium\EHR\UI\Patients\PatientLabOrdersAddView
  • Azalea\Selenium\EHR\UI\Patients\PatientMedications
  • Azalea\Selenium\EHR\UI\Patients\PatientPortal
  • Azalea\Selenium\EHR\UI\Patients\PatientRecalls
  • Azalea\Selenium\EHR\UI\Patients\Patients
  • Azalea\Selenium\EHR\UI\Patients\PatientSearchPopup
  • Azalea\Selenium\EHR\UI\Patients\PatientSection
  • Azalea\Selenium\EHR\UI\Patients\PatientSidebar
  • Azalea\Selenium\EHR\UI\Patients\PatientsList
  • Azalea\Selenium\EHR\UI\Patients\PatientsListRow
  • Azalea\Selenium\EHR\UI\Patients\PatientsListTab
  • Azalea\Selenium\EHR\UI\Patients\PatientsTab
  • Azalea\Selenium\EHR\UI\Patients\PatientTab
  • Azalea\Selenium\EHR\UI\Patients\PatientTasks
  • Azalea\Selenium\EHR\UI\Patients\PatientVitals
  • Azalea\Selenium\EHR\UI\Patients\PatientVitalsAddPopup
  • Azalea\Selenium\EHR\UI\Payments\EDIRemitsTab
  • Azalea\Selenium\EHR\UI\Payments\Payments
  • Azalea\Selenium\EHR\UI\Payments\PaymentsTab
  • Azalea\Selenium\EHR\UI\Payments\UnappliedPaymentsTab
  • Azalea\Selenium\EHR\UI\Popup
  • Azalea\Selenium\EHR\UI\PopupConfirm
  • Azalea\Selenium\EHR\UI\PopupError
  • Azalea\Selenium\EHR\UI\Precerts\Precerts
  • Azalea\Selenium\EHR\UI\Precerts\PrecertsTab
  • Azalea\Selenium\EHR\UI\Reports\AuditLogTab
  • Azalea\Selenium\EHR\UI\Reports\ClinicalQualityMeasuresTab
  • Azalea\Selenium\EHR\UI\Reports\ClinicalQualityMeasuresValueSetsTab
  • Azalea\Selenium\EHR\UI\Reports\MeaningfulUseTab
  • Azalea\Selenium\EHR\UI\Reports\PatientStatementsTab
  • Azalea\Selenium\EHR\UI\Reports\RecordsTab
  • Azalea\Selenium\EHR\UI\Reports\Reports
  • Azalea\Selenium\EHR\UI\Reports\ReportsQueueTab
  • Azalea\Selenium\EHR\UI\Reports\ReportsTab
  • Azalea\Selenium\EHR\UI\Reports\SystemStatisticsTab
  • Azalea\Selenium\EHR\UI\Scheduler\AppointmentsRequestsTab
  • Azalea\Selenium\EHR\UI\Scheduler\AppointmentsTab
  • Azalea\Selenium\EHR\UI\Scheduler\RecallsTab
  • Azalea\Selenium\EHR\UI\Scheduler\Scheduler
  • Azalea\Selenium\EHR\UI\Scheduler\SchedulerTab
  • Azalea\Selenium\EHR\UI\SelectDropdown
  • Azalea\Selenium\EHR\UI\Settings\BillingTab
  • Azalea\Selenium\EHR\UI\Settings\General\GroupsSection
  • Azalea\Selenium\EHR\UI\Settings\General\HandoutsSection
  • Azalea\Selenium\EHR\UI\Settings\General\InsurancesSection
  • Azalea\Selenium\EHR\UI\Settings\General\Locations\LocationRow
  • Azalea\Selenium\EHR\UI\Settings\General\Locations\LocationsList
  • Azalea\Selenium\EHR\UI\Settings\General\LocationsSection
  • Azalea\Selenium\EHR\UI\Settings\General\ProvidersSection
  • Azalea\Selenium\EHR\UI\Settings\General\Roles\RoleCreatePopup
  • Azalea\Selenium\EHR\UI\Settings\General\Roles\RoleRow
  • Azalea\Selenium\EHR\UI\Settings\General\Roles\RolesList
  • Azalea\Selenium\EHR\UI\Settings\General\RolesSection
  • Azalea\Selenium\EHR\UI\Settings\General\Users\UserDetails
  • Azalea\Selenium\EHR\UI\Settings\General\Users\UserRow
  • Azalea\Selenium\EHR\UI\Settings\General\Users\UsersList
  • Azalea\Selenium\EHR\UI\Settings\General\UsersSection
  • Azalea\Selenium\EHR\UI\Settings\GeneralTab
  • Azalea\Selenium\EHR\UI\Settings\InventoryTab
  • Azalea\Selenium\EHR\UI\Settings\MedicalTab
  • Azalea\Selenium\EHR\UI\Settings\PatientTab
  • Azalea\Selenium\EHR\UI\Settings\SchedulerTab
  • Azalea\Selenium\EHR\UI\Settings\Settings
  • Azalea\Selenium\EHR\UI\TabContainer
  • Azalea\Selenium\EHR\UI\TabPanel
  • Azalea\Selenium\EHR\UI\UserAccountMenu
  • Azalea\Selenium\EHR\User\EHRAdminTestingUser
  • Azalea\Selenium\EHR\User\EMRAdminTestingUser
  • Azalea\Selenium\EHR\User\PMAdminTestingUser
  • Azalea\Selenium\Login\LoginPage
  • Azalea\Selenium\Login\LoginTestCase
  • Azalea\Selenium\Login\ResetPasswordPage
  • Azalea\Selenium\Login\UI\LoginForm
  • Azalea\Selenium\Login\UI\ResetPasswordForm
  • Azalea\Selenium\PHR\Application
  • Azalea\Selenium\PHR\PHR
  • Azalea\Selenium\PHR\PHRTestCase
  • Azalea\Selenium\PHR\UI\PopupError
  • Azalea\Selenium\PHR\User\PHRTestingUser
  • Azalea\Selenium\Toolkit\Dom
  • Azalea\Selenium\Toolkit\NestedHashMap
  • Azalea\Selenium\Toolkit\ResourceLoader
  • Azalea\Selenium\Toolkit\SauceLabsTestCase
  • Azalea\Selenium\Toolkit\SeleniumTestCase
  • Azalea\Selenium\Toolkit\TestCase
  • Azalea\Selenium\Toolkit\Validation\ElementExists
  • Azalea\Selenium\Toolkit\Validation\ElementHasText
  • Azalea\Selenium\Toolkit\Validation\ElementVisible
  • Azalea\Selenium\Toolkit\Validation\PageTitle
  • Azalea\Selenium\Toolkit\Validation\ValidationRule
  • Azalea\Selenium\Toolkit\Validation\ViewExists
  • Azalea\Selenium\Toolkit\Validation\WebDriverValidator
  • Azalea\Selenium\Toolkit\View
  • Azalea\Util\Config
  • Azalea\Util\Debug
  • Azalea_Sniffs_WhiteSpace_ScopeClosingBraceSniff
  • BaseModelTestCase
  • ChartAssessmentTest
  • ChartCustomFieldBehaviorsTest
  • ChartDiagnosisTest
  • ChartEncounterDiagnosisTest
  • ChartEncounterProceduresTest
  • ChartInventoryTest
  • ChartObjectiveTest
  • ChartProblemHistoryTest
  • ChartProceduresTest
  • ChartProviderAccessTest
  • ChartSigningTest
  • ChartsListProviderAccessTest
  • ChartSmokingStatusTest
  • ChartSubjectiveTest
  • ConfigTest
  • EncounterClaimsTest
  • EncounterDemographicsTest
  • EncounterDiagnosisTest
  • EncounterGuarantorTest
  • EncounterLedgerTest
  • EncounterProceduresTest
  • ExampleTestCase
  • MessagesLabelsTest
  • PageTest
  • PatentsListTest
  • PathManagerTest
  • PatientAccountSummaryTest
  • PatientBillingActionsTest
  • PatientCommentsTest
  • PatientDashboardAlertsTest
  • PatientDashboardLinkedPatientsTest
  • PatientDemographicsEditTest
  • PatientDocumentsTest
  • PatientPopupCommentsTest
  • PatientProviderAccessTest
  • PatientsListProviderAccessTest
  • PermissionsTest
  • PopupTest
  • SchedulerBlocksTest
  • SchedulerInsuranceBlocksTest
  • SimpePage
  • SimpleView
  • SimpleViewWithArgs
  • SimpleViewWithNoHash
  • TestCase
  • tests\integration\barebones\BarebonesConstants
  • tests\integration\barebones\BarebonesTestCase
  • tests\integration\barebones\controllers\charts\ChartsControllerTest
  • tests\integration\barebones\controllers\patients\PatientsPopupAlertsControllerTest
  • tests\integration\barebones\controllers\system\ClientsControllerTest
  • tests\integration\barebones\models\billing\ClientsFeeSchedulesMapModelTest
  • tests\integration\barebones\models\encounters\AppointmentModelTest
  • tests\integration\barebones\models\encounters\CollectionTest
  • tests\integration\barebones\models\encounters\ConcurrentCollectionTest
  • tests\integration\barebones\models\encounters\EncounterModelTest
  • tests\integration\barebones\models\encounters\EncountersIncompleteReasonModelTest
  • tests\integration\barebones\models\encounters\ModelQueryBuilderTest
  • tests\integration\barebones\models\examples\ExampleModelBasicsTest
  • tests\integration\barebones\models\examples\ExamplesGenericControllerTest
  • tests\integration\barebones\models\messaging\MessageModelTest
  • tests\integration\barebones\models\rcm\RCMStatsGeneralControllerTests
  • tests\integration\barebones\models\system\ClientModelTest
  • tests\unit\barebones\lib\BarebonesTestCase
  • tests\unit\barebones\utilities\ArraysTest
  • tests\unit\barebones\utilities\calculations\PovertyLineTest
  • tests\unit\barebones\utilities\MathTest
  • UrlManagerTest
  • VariantRulesTest
  • VariantsManagerTest
  • ViewTest
  • WebDriverMock

Exceptions

  • Azalea\Selenium\Toolkit\Exception\ElementNotFoundException
  • Azalea\Selenium\Toolkit\Exception\InvalidPageException
  • Azalea\Selenium\Toolkit\Exception\TimeoutException
  • Overview
  • Namespace
  • Class
  1: <?php
  2: namespace Azalea\Selenium\Toolkit;
  3: 
  4: use Azalea\Selenium\Toolkit\NestedHashMap;
  5: use Azalea\Selenium\Toolkit\Validation\WebDriverValidator;
  6: 
  7: class View
  8: {
  9:     public $el = "";
 10: 
 11:     protected $view = array();
 12:     protected $parent = null;
 13:     protected $dom = null;
 14: 
 15:     protected $cachedProperties = array();
 16: 
 17:     /**
 18:      * Construct a new View.
 19:      *
 20:      * @throws \InvalidArgumentException
 21:      */
 22:     public function __construct($driver, $config, $args = array())
 23:     {
 24:         if (!$driver) {
 25:             throw new \InvalidArgumentException("WebDriver is required.");
 26:         }
 27:         if (!$config) {
 28:             throw new \InvalidArgumentException("View config is required.");
 29:         }
 30: 
 31:         $this->driver = $driver;
 32:         $this->dom = new Dom($driver);
 33:         $this->args = $args;
 34: 
 35:         if (is_string($config)) {
 36:             $config = ResourceLoader::parse($config);
 37:         }
 38:         if (!is_array($config)) {
 39:             throw new \InvalidArgumentException("View config is required.");
 40:         }
 41: 
 42:         $this->parseViewConfig($config);
 43: 
 44:         // load any custom view configurations as a nested hash map
 45:         if (!isset($this->view['config'])) {
 46:             $this->view['config'] = array();
 47:         }
 48:         $this->config = new NestedHashMap($this->view['config']);
 49:     }
 50: 
 51:     /**
 52:      * Gets the name of the view.
 53:      *
 54:      * @return string
 55:      */
 56:     public function getName()
 57:     {
 58:         return $this->view['name'];
 59:     }
 60: 
 61:     /**
 62:      * Gets a parent view object.
 63:      *
 64:      * @return \Azalea\Selenium\Toolkit\View
 65:      */
 66:     public function getParent()
 67:     {
 68:         return $this->parent;
 69:     }
 70: 
 71:     /**
 72:      * Gets the view arguments.
 73:      *
 74:      * @return arra
 75:      */
 76:     public function getArgs()
 77:     {
 78:         return $this->args;
 79:     }
 80: 
 81:     /**
 82:      * Sets the view arguments.
 83:      *
 84:      * @param array $args
 85:      * @return $this
 86:      */
 87:     public function setArgs($args)
 88:     {
 89:         $this->args = $args;
 90:         $this->el = $this->root = $this->replaceStringWithKeys($this->el, $args);
 91:         // scope the view to the root element
 92:         $this->dom->setRoot($this->el);
 93:         // set parent args
 94:         if ($this->parent) {
 95:             $this->parent->setArgs($args);
 96:         }
 97:         return $this;
 98:     }
 99: 
100:     /**
101:      * Gets the scoping rule for this view.
102:      *
103:      * @return arra
104:      */
105:     public function getScope()
106:     {
107:         return $this->view['scope'];
108:     }
109: 
110:     /**
111:      * Scopes this view to the given selector.
112:      *
113:      * @param string $selector
114:      * @return $this
115:      */
116:     public function setScope($selector)
117:     {
118:         $this->el = $this->root = $this->replaceStringWithKeys($selector." ".$this->view['el'], $this->args);
119:         $this->dom->setRoot($this->el);
120:     }
121: 
122:     /**
123:      * Clear cached properties.
124:      * This can be used if the underlying DOM elements have changed
125:      * and you have stale child views.
126:      *
127:      * @return $this
128:      */
129:     public function clearCache()
130:     {
131:         $this->cachedProperties = array();
132:         return $this;
133:     }
134: 
135:     /*-------------------------------------------------------------------------
136:      * Browser Navigation
137:      *-----------------------------------------------------------------------*/
138: 
139:     /**
140:      * Gets the view's url value, if any.
141:      *
142:      * @return string
143:      */
144:     public function getUrl()
145:     {
146:         return $this->view['url'];
147:     }
148: 
149:     /**
150:      * Gets the view's hash value, if any.
151:      *
152:      * @param array $args
153:      * @return string
154:      */
155:     public function getHash($args = array())
156:     {
157:         return $this->replaceStringWithKeys($this->view['hash'], $args);
158:     }
159: 
160:     /**
161:      * Opens the view by either navigating the browser to its url
162:      * or setting the browser to tis hash value (in that order).
163:      *
164:      * Hash values can accept an optional argument map.
165:      *
166:      * If neither a url or a hash value are define then this will
167:      * do nothing.
168:      *
169:      * @param array $args
170:      * @return $this;
171:      */
172:     public function navigate()
173:     {
174:         if ($this->view['url']) {
175:             $this->driver->url($this->view['url']);
176:             return $this->verifyAndWait();
177:         }
178:         if (!empty($this->view['hash'])) {
179:             $this->driver->updateHash(
180:                 $this->getHash($this->args)
181:             );
182:         }
183:         return $this;
184:     }
185: 
186: 
187:     /*-------------------------------------------------------------------------
188:      * DOM Tests
189:      *-----------------------------------------------------------------------*/
190: 
191:     /**
192:      * Returns true if the view is visible.
193:      *
194:      * @return bool
195:      */
196:     public function isVisible()
197:     {
198:         if (!$this->driver->hasElement($css) || !$this->driver->querySelector($css)->displayed()) {
199:             return false;
200:         }
201:         return true;
202:     }
203: 
204: 
205:     public function within($callback)
206:     {
207:         return $this->driver->within($this->el, $callback);
208:     }
209: 
210:     /*-------------------------------------------------------------------------
211:      * Validation
212:      *-----------------------------------------------------------------------*/
213: 
214:     /**
215:      * Verify that the view is loaded in the browser.
216:      *
217:      * @return boolean
218:      */
219:     public function verify()
220:     {
221:         // if this view extends another, verify the parent view first
222:         if ($this->parent) {
223:             if (!$this->parent->verify()) {
224:                 return false;
225:             }
226:         }
227: 
228:         // if this view has a window title, validate it
229:         if (isset($this->view['title'])) {
230:             if ($this->driver->title() != $this->view['title']) {
231:                 return false;
232:             }
233:         }
234: 
235:         // validate that the root element exists
236:         if ($this->el != "body" && !$this->driver->hasElement($this->el)) {
237:             return false;
238:         }
239: 
240:         // run any view specific validation rules
241:         return WebDriverValidator::verify($this, $this->view['rules']);
242:     }
243: 
244:     /**
245:      * Verify that the view is loaded in the browser.
246:      * Waits up to $timeout seconds.
247:      *
248:      * @param int $timeout
249:      */
250:     public function verifyAndWait($timeout = 30)
251:     {
252:         $this->driver->spinWait(array($this, "verify"), $timeout);
253:         return $this;
254:     }
255: 
256:     /*-------------------------------------------------------------------------
257:      * Internal
258:      *-----------------------------------------------------------------------*/
259: 
260:     /**
261:      * Parses the view config information.
262:      *
263:      * @param array $config
264:      * @throws \InvalidArgumentException
265:      */
266:     protected function parseViewConfig($config)
267:     {
268:         $this->view = $config;
269: 
270:         if (!isset($this->view['name'])) {
271:             $this->view['name'] = "";
272:         }
273: 
274:         if (!isset($this->view['el'])) {
275:             $this->view['el'] = "body";
276:         }
277:         $this->el = $this->root = $this->replaceStringWithKeys($this->view['el'], $this->args);
278: 
279:         // scope the view to the root element
280:         $this->dom->setRoot($this->el);
281: 
282:         if (!isset($this->view['url'])) {
283:             $this->view['url'] = null;
284:         }
285: 
286:         if (!isset($this->view['hash'])) {
287:             $this->view['hash'] = "";
288:         }
289: 
290:         if (!isset($this->view['rules'])) {
291:             $this->view['rules'] = array();
292:         }
293: 
294:         if (isset($this->view['extends'])) {
295:             $this->extend($this->view['extends']);
296:         }
297: 
298:         if (!isset($this->view['scope'])) {
299:             $this->view['scope'] = "auto";
300:         }
301:     }
302: 
303:     /**
304:      * Extend from another view.
305:      */
306:     protected function extend($extend)
307:     {
308:         $this->parent = $this->driver->getView($extend, $this->args);
309:     }
310: 
311:     /**
312:      * Replaces {key} in a string with a value defined by the supplied
313:      * associative array (key => value).
314:      *
315:      * @param array $args
316:      * @return string
317:      */
318:     private function replaceStringWithKeys($string = '', $args = array())
319:     {
320:         foreach ($args as $key => $val) {
321:             if (strpos($string, "{" . $key . "}") !== false) {
322:                 $string = str_replace("{" . $key . "}", $val, $string);
323:             }
324:         }
325:         return $string;
326:     }
327: 
328:     /*-------------------------------------------------------------------------
329:      * Magic
330:      *-----------------------------------------------------------------------*/
331: 
332:     /**
333:      * Resolve a view property.
334:      *
335:      * @param string $name
336:      * @return mixed
337:      */
338:     public function __get($name)
339:     {
340:         if (isset($this->view[$name])) {
341:             if (isset($this->cachedProperties[$name])) {
342:                 return $this->cachedProperties[$name];
343:             }
344: 
345:             $value = $this->view[$name];
346: 
347:             if (is_string($value)) {
348:                 if (stripos($value, ".json") !== false) {
349:                     // reference to an external resource file
350:                     $view = ResourceLoader::load($value, $this->driver, $this->args);
351:                     // check scoping rule
352:                     if ($view->getScope() == "inherit") {
353:                         $view->setScope($this->el);
354:                     }
355:                     $this->cachedProperties[$name] = $view;
356:                     return $view;
357:                 } else {
358:                     // this is likely a string constant, so just return it
359:                     return $value;
360:                 }
361:             }
362: 
363:             $view = ResourceLoader::create($value, $this->driver, $this->args);
364:             // check scoping rule
365:             if ($view->getScope() == "inherit") {
366:                 $view->setScope($this->el);
367:             }
368:             $this->cachedProperties[$name] = $view;
369:             return $view;
370:         }
371: 
372:         return null;
373:     }
374: 
375:     /**
376:      * Calls the method on the active dom or driver object.
377:      *
378:      * @param string $method
379:      * @param array $args
380:      * @return mixed
381:      */
382:     public function __call($method, $args)
383:     {
384:         if ($this->dom) {
385:             if (is_callable(array($this->dom, $method))) {
386:                 return call_user_func_array(array($this->dom, $method), $args);
387:             }
388:         }
389: 
390:         if (isset($this->view[$method])) {
391:             $view = $this->__get($method);
392:             $view->setArgs($args);
393:             return $view;
394:         }
395: 
396:         if ($this->driver) {
397:             if (is_callable(array($this->driver, $method))) {
398:                 return call_user_func_array(array($this->driver, $method), $args);
399:             }
400:         }
401: 
402:         throw new \RuntimeException("Method ".$method." is not callable in View.");
403:     }
404: }
405: 
406: ?>
API documentation generated by ApiGen