IdentifierExpression.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Database\Expression;
  16. use Cake\Database\ExpressionInterface;
  17. use Cake\Database\ValueBinder;
  18. /**
  19. * Represents a single identifier name in the database
  20. *
  21. * @internal
  22. */
  23. class IdentifierExpression implements ExpressionInterface
  24. {
  25. /**
  26. * Holds the identifier string
  27. *
  28. * @var string
  29. */
  30. protected $_identifier;
  31. /**
  32. * Constructor
  33. *
  34. * @param string $identifier The identifier this expression represents
  35. */
  36. public function __construct($identifier)
  37. {
  38. $this->_identifier = $identifier;
  39. }
  40. /**
  41. * Sets the identifier this expression represents
  42. *
  43. * @param string $identifier The identifier
  44. * @return void
  45. */
  46. public function setIdentifier($identifier)
  47. {
  48. $this->_identifier = $identifier;
  49. }
  50. /**
  51. * Returns the identifier this expression represents
  52. *
  53. * @return string
  54. */
  55. public function getIdentifier()
  56. {
  57. return $this->_identifier;
  58. }
  59. /**
  60. * Converts the expression to its string representation
  61. *
  62. * @param \Cake\Database\ValueBinder $generator Placeholder generator object
  63. * @return string
  64. */
  65. public function sql(ValueBinder $generator)
  66. {
  67. return $this->_identifier;
  68. }
  69. /**
  70. * This method is a no-op, this is a leaf type of expression,
  71. * hence there is nothing to traverse
  72. *
  73. * @param callable $callable The callable to traverse with.
  74. * @return void
  75. */
  76. public function traverse(callable $callable)
  77. {
  78. }
  79. }