PageRenderTime 34ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/Workflow/src/conditions/is_object.php

https://github.com/Yannix/zetacomponents
PHP | 70 lines | 13 code | 2 blank | 55 comment | 0 complexity | 1fe042a5d68337831f70accd0a3cb334 MD5 | raw file
  1. <?php
  2. /**
  3. * File containing the ezcWorkflowConditionIsObject class.
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one
  6. * or more contributor license agreements. See the NOTICE file
  7. * distributed with this work for additional information
  8. * regarding copyright ownership. The ASF licenses this file
  9. * to you under the Apache License, Version 2.0 (the
  10. * "License"); you may not use this file except in compliance
  11. * with the License. You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing,
  16. * software distributed under the License is distributed on an
  17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. * KIND, either express or implied. See the License for the
  19. * specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. * @package Workflow
  23. * @version //autogen//
  24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25. */
  26. /**
  27. * Condition that evaluates to true if the evaluated value is an object.
  28. *
  29. * Typically used together with ezcWorkflowConditionVariable to use the
  30. * condition on a workflow variable.
  31. *
  32. * <code>
  33. * <?php
  34. * $condition = new ezcWorkflowConditionVariable(
  35. * 'variable name',
  36. * new ezcWorkflowConditionIsObject
  37. * );
  38. * ?>
  39. * </code>
  40. *
  41. * @package Workflow
  42. * @version //autogen//
  43. */
  44. class ezcWorkflowConditionIsObject extends ezcWorkflowConditionType
  45. {
  46. /**
  47. * Evaluates this condition and returns true if $value is an object or false if not.
  48. *
  49. * @param mixed $value
  50. * @return boolean true when the condition holds, false otherwise.
  51. * @ignore
  52. */
  53. public function evaluate( $value )
  54. {
  55. return is_object( $value );
  56. }
  57. /**
  58. * Returns a textual representation of this condition.
  59. *
  60. * @return string
  61. * @ignore
  62. */
  63. public function __toString()
  64. {
  65. return 'is object';
  66. }
  67. }
  68. ?>