composer.phar 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. 4•��ö������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpµe��ÊEa\µe��ª}¶������+���src/Composer/Autoload/ClassMapGenerator.php‹��ÊEa\‹��Mè�Ķ���������src/Composer/Cache.php’��ÊEa\’��­bš0¶������%���src/Composer/Command/AboutCommand.phpÍ��ÊEa\Í��ÿÌŒ4¶������'���src/Composer/Command/ArchiveCommand.phpc��ÊEa\c��¥{ï¶������$���src/Composer/Command/BaseCommand.phpÜ ��ÊEa\Ü ��gô1¶������.���src/Composer/Command/BaseDependencyCommand.phpñ��ÊEa\ñ��XgFð¶������1���src/Composer/Command/CheckPlatformReqsCommand.phpë ��ÊEa\ë ��kâ¶������*���src/Composer/Command/ClearCacheCommand.php^��ÊEa\^��¨ãj¶������&���src/Composer/Command/ConfigCommand.phpôI��ÊEa\ôI��›}ò¶������-���src/Composer/Command/CreateProjectCommand.php%5��ÊEa\%5��èP-¶������'���src/Composer/Command/DependsCommand.php¸��ÊEa\¸��K°¶������(���src/Composer/Command/DiagnoseCommand.php©M��ÊEa\©M��Pä�¶������,���src/Composer/Command/DumpAutoloadCommand.phpñ ��ÊEa\ñ ��Ub‚¶������$���src/Composer/Command/ExecCommand.phpk��ÊEa\k��¼“À[¶������&���src/Composer/Command/GlobalCommand.php@ ��ÊEa\@ ��·©ð¶������$���src/Composer/Command/HomeCommand.phpÄ��ÊEa\Ä��ÇH¶������$���src/Composer/Command/InitCommand.php›O��ÊEa\›O��Û Q¶������'���src/Composer/Command/InstallCommand.php��ÊEa\��[ š¶������(���src/Composer/Command/LicensesCommand.php;��ÊEa\;��™�U¶������(���src/Composer/Command/OutdatedCommand.phpÇ ��ÊEa\Ç ��Ñnë(¶������)���src/Composer/Command/ProhibitsCommand.phpÌ��ÊEa\Ì��¨[®¶������&���src/Composer/Command/RemoveCommand.php§��ÊEa\§��ÉäÚ�¶������'���src/Composer/Command/RequireCommand.phps#��ÊEa\s#��
  25. R ¶������)���src/Composer/Command/RunScriptCommand.phpã��ÊEa\ã��˜Ô¶������+���src/Composer/Command/ScriptAliasCommand.phpp��ÊEa\p��g †(¶������&���src/Composer/Command/SearchCommand.php ��ÊEa\ ��Ò=Á‹¶������*���src/Composer/Command/SelfUpdateCommand.phpå2��ÊEa\å2��ÔÛ„¶������$���src/Composer/Command/ShowCommand.php0q��ÊEa\0q��lÇ'ض������&���src/Composer/Command/StatusCommand.php\��ÊEa\\��«In¶������(���src/Composer/Command/SuggestsCommand.php© ��ÊEa\© ��<Qþ¶������&���src/Composer/Command/UpdateCommand.phpµ#��ÊEa\µ#��@Š4-¶������(���src/Composer/Command/ValidateCommand.phpD��ÊEa\D��d ¶���������src/Composer/Composer.phpù ��ÊEa\ù ��#ˆwˆ¶���������src/Composer/Config.phpp#��ÊEa\p#��¸’·š¶������-���src/Composer/Config/ConfigSourceInterface.php��ÊEa\��³ [/¶������(���src/Composer/Config/JsonConfigSource.phpu��ÊEa\u��=¤ƒ¶������$���src/Composer/Console/Application.php^4��ÊEa\^4��Åx¶������,���src/Composer/Console/HtmlOutputFormatter.php3��ÊEa\3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.php'��ÊEa\'��¹ÔŽ¼¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��ÊEa\��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.phpµ��ÊEa\µ��᫤¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��ÊEa\C��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��ÊEa\÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��ÊEa\ý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���ÊEa\Ó���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��ÊEa\¹��&¢e
  26. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��ÊEa\I��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��ÊEa\h��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��ÊEa\­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php¯"��ÊEa\¯"��m½ ¶������+���src/Composer/DependencyResolver/Problem.php¹��ÊEa\¹��Rájl¶������+���src/Composer/DependencyResolver/Request.phpƒ��ÊEa\ƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php?��ÊEa\?��¬‘œü¶������1���src/Composer/DependencyResolver/Rule2Literals.php��ÊEa\��tZÅɶ������+���src/Composer/DependencyResolver/RuleSet.phpª
  27. ��ÊEa\ª
  28. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.php&��ÊEa\&��gÇF£¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��ÊEa\��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��ÊEa\i��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��ÊEa\á��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.php��ÊEa\���Gd7¶������*���src/Composer/DependencyResolver/Solver.php�:��ÊEa\�:��æ¯Ép¶������6���src/Composer/DependencyResolver/SolverBugException.php™��ÊEa\™��Xg6¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��ÊEa\ô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.php×��ÊEa\×��Vm쟶������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��ÊEa\Æ ��G s0¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���ÊEa\Ì���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��ÊEa\`��#ÏX¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��ÊEa\Ê��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���ÊEa\Ñ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpG��ÊEa\G��…�Ä÷¶������/���src/Composer/Downloader/FilesystemException.php
  29. ��ÊEa\
  30. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php‚ ��ÊEa\‚ ��Ü�Ii¶������)���src/Composer/Downloader/GitDownloader.phpq4��ÊEa\q4��ZÎÇ׶������*���src/Composer/Downloader/GzipDownloader.phpó��ÊEa\ó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php”��ÊEa\”��ßis̶������*���src/Composer/Downloader/PathDownloader.phpQ��ÊEa\Q��Cn¤¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��ÊEa\u��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php§��ÊEa\§��⃨¶������*���src/Composer/Downloader/PharDownloader.phpå���ÊEa\å���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��ÊEa\ž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��ÊEa\G��M#j¶������)���src/Composer/Downloader/TarDownloader.phpã���ÊEa\ã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��ÊEa\=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���ÊEa\Ô���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php¡��ÊEa\¡��( à>¶������(���src/Composer/Downloader/XzDownloader.php§��ÊEa\§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpk��ÊEa\k��Òo”ζ������&���src/Composer/EventDispatcher/Event.php ��ÊEa\ ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpY3��ÊEa\Y3��ã&=q¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���ÊEa\©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���ÊEa\v���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���ÊEa\f���ËíM�¶���������src/Composer/Factory.php_=��ÊEa\_=��x"Ŷ���������src/Composer/IO/BaseIO.phpŒ��ÊEa\Œ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��ÊEa\*��¢®hT¶���������src/Composer/IO/ConsoleIO.php7��ÊEa\7��¥<ȶ���������src/Composer/IO/IOInterface.phpì��ÊEa\ì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��ÊEa\À��F`sʶ���������src/Composer/Installer.phpÄ���ÊEa\Ä���ÍMlI¶������*���src/Composer/Installer/BinaryInstaller.php
  31. ��ÊEa\
  32. ��t¤{ø¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���ÊEa\Ë���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��ÊEa\-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��ÊEa\��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���ÊEa\Þ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��ÊEa\ã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php%��ÊEa\%�� »�̶������/���src/Composer/Installer/MetapackageInstaller.phpÊ��ÊEa\Ê��Ùti·¶������(���src/Composer/Installer/NoopInstaller.php+��ÊEa\+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��ÊEa\e��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��ÊEa\¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��ÊEa\ø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��ÊEa\¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.php‹��ÊEa\‹��ÒX8¶������+���src/Composer/Installer/ProjectInstaller.php��ÊEa\��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php:��ÊEa\:��‚´UV¶���������src/Composer/Json/JsonFile.phpî��ÊEa\î��b-~¶������#���src/Composer/Json/JsonFormatter.phpb��ÊEa\b��ÝNš¶������%���src/Composer/Json/JsonManipulator.php’3��ÊEa\’3��é7¶������-���src/Composer/Json/JsonValidationException.php\��ÊEa\\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��ÊEa\��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��ÊEa\ ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��ÊEa\Þ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��ÊEa\Ý ��í<´B¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��ÊEa\��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��ÊEa\–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��ÊEa\��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��ÊEa\r��3‘Mh¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��ÊEa\ �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php?��ÊEa\?��®— u¶������-���src/Composer/Package/Archiver/ZipArchiver.php½��ÊEa\½��VÀ‚¨¶������$���src/Composer/Package/BasePackage.php��ÊEa\��D|ŸÈ¶������*���src/Composer/Package/Comparer/Comparer.phpR��ÊEa\R��Ïسî¶������(���src/Composer/Package/CompletePackage.phpü��ÊEa\ü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��ÊEa\õ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpW ��ÊEa\W ��¿éÁ¦¶���������src/Composer/Package/Link.phpˆ��ÊEa\ˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��ÊEa\‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��ÊEa\d��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��ÊEa\‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��ÊEa\i��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��ÊEa\X��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.phpN��ÊEa\N��âQ¬¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��ÊEa\E��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��ÊEa\ù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���ÊEa\²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.phpó��ÊEa\ó��l”.ض������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpº<��ÊEa\º<��°-à@¶���������src/Composer/Package/Locker.php¥!��ÊEa\¥!��/=xö¶������ ���src/Composer/Package/Package.phpÉ��ÊEa\É��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��ÊEa\ ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��ÊEa\ �� _€ø¶������$���src/Composer/Package/RootPackage.php��ÊEa\��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��ÊEa\¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÏ��ÊEa\Ï��ÌÂ߶������.���src/Composer/Package/Version/VersionParser.php¥��ÊEa\¥��ô´à¶������0���src/Composer/Package/Version/VersionSelector.phpK ��ÊEa\K ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���ÊEa\W���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���ÊEa\—���ûOâ>¶���������src/Composer/Plugin/Capable.php���ÊEa\���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��ÊEa\â��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpö���ÊEa\ö���á1=z¶������'���src/Composer/Plugin/PluginInterface.phpô���ÊEa\ô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��ÊEa\$��‹K©¶������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��ÊEa\õ��:ðd¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��ÊEa\`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��ÊEa\��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��ÊEa\��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php ��ÊEa\ ��Fœâò¶������*���src/Composer/Repository/BaseRepository.phpv ��ÊEa\v ��„ÜL¶������.���src/Composer/Repository/ComposerRepository.phpÐU��ÊEa\ÐU��ü­l�¶������/���src/Composer/Repository/CompositeRepository.php;��ÊEa\;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���ÊEa\…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php$��ÊEa\$��¾Ãá…¶������4���src/Composer/Repository/InstalledArrayRepository.php£���ÊEa\£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���ÊEa\£���V
  33. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���ÊEa\‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���ÊEa\n���à“똶������-���src/Composer/Repository/PackageRepository.phpj��ÊEa\j��¥ôò̶������*���src/Composer/Repository/PathRepository.php– ��ÊEa\– ��WÛ¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��ÊEa\I��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��ÊEa\Ä��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��ÊEa\í��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��ÊEa\® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��ÊEa\& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��ÊEa\q��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��ÊEa\q��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��ÊEa\…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��ÊEa\°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��ÊEa\’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��ÊEa\ª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php™��ÊEa\™��èÛ¶������-���src/Composer/Repository/RepositoryFactory.php`��ÊEa\`��K¾du¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��ÊEa\Û��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php2
  34. ��ÊEa\2
  35. ��á…5#¶������7���src/Composer/Repository/RepositorySecurityException.phpo���ÊEa\o���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpå��ÊEa\å��vãâ¶������,���src/Composer/Repository/Vcs/FossilDriver.php©��ÊEa\©��t1Ú®¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��ÊEa\ê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.php¼��ÊEa\¼��Š©Ðê¶������,���src/Composer/Repository/Vcs/GitHubDriver.php¡(��ÊEa\¡(��‚º ¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpÍ#��ÊEa\Í#��ßNìʶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��ÊEa\ä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.php\��ÊEa\\��sàض������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��ÊEa\' ��ÙóH¶������)���src/Composer/Repository/Vcs/SvnDriver.php¤��ÊEa\¤�� ¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��ÊEa\æ
  37. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��ÊEa\÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php±&��ÊEa\±&��¢Þ¸t¶������1���src/Composer/Repository/VersionCacheInterface.php”���ÊEa\”���A?Rï¶������3���src/Composer/Repository/WritableArrayRepository.php��ÊEa\��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��ÊEa\‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���ÊEa\W���£VZt¶���������src/Composer/Script/Event.phpµ��ÊEa\µ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���ÊEa\œ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��ÊEa\P��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���ÊEa\��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��ÊEa\ì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��ÊEa\Ë��>zx–¶���������src/Composer/Util/Bitbucket.php*��ÊEa\*��,Lšk¶������$���src/Composer/Util/ComposerMirror.php±��ÊEa\±��­½øض������%���src/Composer/Util/ConfigValidator.php÷��ÊEa\÷��v•Í¶������"���src/Composer/Util/ErrorHandler.php¬��ÊEa\¬��š^`ƶ������ ���src/Composer/Util/Filesystem.phpp/��ÊEa\p/��³‰¶���������src/Composer/Util/Git.php2+��ÊEa\2+��}rð¦¶���������src/Composer/Util/GitHub.php| ��ÊEa\| ��`0tü¶���������src/Composer/Util/GitLab.phpœ ��ÊEa\œ �� `YÖ¶���������src/Composer/Util/Hg.php¾��ÊEa\¾��LÓ �¶���������src/Composer/Util/IniHelper.phph��ÊEa\h��;FP¶������$���src/Composer/Util/NoProxyPattern.php¾��ÊEa\¾��Z+°m¶���������src/Composer/Util/Perforce.phpÁ2��ÊEa\Á2��ñ÷‹¶���������src/Composer/Util/Platform.phpü��ÊEa\ü��s­fç¶������%���src/Composer/Util/ProcessExecutor.php ��ÊEa\ ��›Éº¶������&���src/Composer/Util/RemoteFilesystem.phpÙj��ÊEa\Ùj��¹¸;¶���������src/Composer/Util/Silencer.phpé��ÊEa\é��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��ÊEa\��¾7
  38. ñ¶������*���src/Composer/Util/StreamContextFactory.php8��ÊEa\8��¸š2+¶���������src/Composer/Util/Svn.php,��ÊEa\,��Ì žÄ¶���������src/Composer/Util/TlsHelper.phpn
  39. ��ÊEa\n
  40. ��S¯Í:¶���������src/Composer/Util/Url.php£��ÊEa\£��3œÉܶ���������src/Composer/XdebugHandler.phpð��ÊEa\ð��zÓf~¶���������src/bootstrap.php¹��ÊEa\¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php“4��ÊEa\“4��²z�–¶������#���res/composer-repository-schema.jsonð��ÊEa\ð���GÐà¶���������res/composer-schema.json…–��ÊEa\…–�� º,˜¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsonJ ��ÊEa\J ��ñR�¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonË’��ÊEa\Ë’��p'V¶������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��ÊEa\�$��•�¥v¶������&���vendor/symfony/console/Application.php=X��ÊEa\=X��� S’¶������*���vendor/symfony/console/Command/Command.phpî"��ÊEa\î"��x°jÕ¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��ÊEa\Ø��¦Ú-:¶������.���vendor/symfony/console/Command/ListCommand.phpZ��ÊEa\Z��»w`¶������(���vendor/symfony/console/ConsoleEvents.phpé���ÊEa\é���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��ÊEa\Ð��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.php���ÊEa\���¿N•¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���ÊEa\ü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��ÊEa\Ü ��*û�ɶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��ÊEa\¶��·Ô;ݶ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��ÊEa\¼��òç$¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��ÊEa\��b{<¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��ÊEa\°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��ÊEa\Å��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��ÊEa\��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��ÊEa\z��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��ÊEa\Ô��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���ÊEa\f���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���ÊEa\¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���ÊEa\¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���ÊEa\’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���ÊEa\–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php6��ÊEa\6��?=¨¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��ÊEa\Œ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��ÊEa\F��𦴶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��ÊEa\„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��ÊEa\@��G¨ýU¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��ÊEa\y��Ì8Æж������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��ÊEa\w��|¦C¶������.���vendor/symfony/console/Helper/DialogHelper.php��ÊEa\��¹ÜÃ_¶������1���vendor/symfony/console/Helper/FormatterHelper.phpd��ÊEa\d��§×,¸¶������(���vendor/symfony/console/Helper/Helper.php«��ÊEa\«��!�§—¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���ÊEa\å���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÊ��ÊEa\Ê��áÏW"¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��ÊEa\c��Ìøƒ¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��ÊEa\Ó ��©w‚R¶������-���vendor/symfony/console/Helper/ProgressBar.phpl%��ÊEa\l%�� díÛ¶������0���vendor/symfony/console/Helper/ProgressHelper.php]��ÊEa\]��ù»‰X¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��ÊEa\N��ÿ§³l¶������0���vendor/symfony/console/Helper/QuestionHelper.phpl��ÊEa\l��Ntó¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  41. ��ÊEa\–
  42. ��- ض������'���vendor/symfony/console/Helper/Table.phpÄ*��ÊEa\Ä*��¾™ØT¶������+���vendor/symfony/console/Helper/TableCell.php���ÊEa\���åV^¶������-���vendor/symfony/console/Helper/TableHelper.php ��ÊEa\ ��›uô™¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���ÊEa\Ê���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  43. ��ÊEa\
  44. ��_ÍI"¶������*���vendor/symfony/console/Input/ArgvInput.php��ÊEa\��×ö†›¶������+���vendor/symfony/console/Input/ArrayInput.php) ��ÊEa\) ��¥ÑC¶������&���vendor/symfony/console/Input/Input.php£ ��ÊEa\£ ��f¡?¶������.���vendor/symfony/console/Input/InputArgument.php��ÊEa\��D £¶������4���vendor/symfony/console/Input/InputAwareInterface.php˜���ÊEa\˜���­O°¶������0���vendor/symfony/console/Input/InputDefinition.php†��ÊEa\†��¤U)¤¶������/���vendor/symfony/console/Input/InputInterface.php£��ÊEa\£��ÆBŒ'¶������,���vendor/symfony/console/Input/InputOption.php ��ÊEa\ ��\¢Ü=¶������,���vendor/symfony/console/Input/StringInput.phpš��ÊEa\š��žµ è¶���������vendor/symfony/console/LICENSE)��ÊEa\)��NUN½¶������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��ÊEa\0 ��…� ¸¶������0���vendor/symfony/console/Output/BufferedOutput.php_��ÊEa\_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php±��ÊEa\±��nì!f¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���ÊEa\à���‡†Æʶ������,���vendor/symfony/console/Output/NullOutput.phpÏ��ÊEa\Ï��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��ÊEa\˜ ��0p¶������1���vendor/symfony/console/Output/OutputInterface.php��ÊEa\���ì&¶������.���vendor/symfony/console/Output/StreamOutput.php���ÊEa\���Ä’Oç¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  45. ��ÊEa\x
  46. ��W€!¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��ÊEa\è��/Ô�¶������,���vendor/symfony/console/Question/Question.phpÎ ��ÊEa\Î ��lF¶������ ���vendor/symfony/console/Shell.phpæ��ÊEa\æ��¼XÒA¶������,���vendor/symfony/console/Style/OutputStyle.php\��ÊEa\\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��ÊEa\Ï��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��ÊEa\ä��­å (¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��ÊEa\Ï��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��ÊEa\ª��¬K z¶������(���vendor/symfony/debug/BufferingLogger.phpt��ÊEa\t��=�hܶ���������vendor/symfony/debug/Debug.php,��ÊEa\,��Ë~Ž.¶������)���vendor/symfony/debug/DebugClassLoader.phpµ��ÊEa\µ��1rEÓ¶������%���vendor/symfony/debug/ErrorHandler.phpH��ÊEa\H��¹:D#¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��ÊEa\–��i‰æô¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��ÊEa\˜��-
  47. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��ÊEa\��®+Ãê¶������6���vendor/symfony/debug/Exception/FatalErrorException.php��ÊEa\��™Ä¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��ÊEa\W��?àèK¶������3���vendor/symfony/debug/Exception/FlattenException.php¼��ÊEa\¼�� ׶������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���ÊEa\~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��ÊEa\š���ñJÀ¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��ÊEa\˜��nöêض������)���vendor/symfony/debug/ExceptionHandler.php)3��ÊEa\)3���h5=¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��ÊEa\A��Ϥ¹l¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��ÊEa\��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��ÊEa\x��~ò"¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��ÊEa\O���ž¦*¶���������vendor/symfony/debug/LICENSE)��ÊEa\)��NUN½¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���ÊEa\i���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��ÊEa\¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��ÊEa\‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���ÊEa\¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpc4��ÊEa\c4��‹×@þ¶������!���vendor/symfony/filesystem/LICENSE)��ÊEa\)��NUN½¶������)���vendor/symfony/filesystem/LockHandler.phpö��ÊEa\ö��ŸZµ1¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��ÊEa\\ ��hˆB¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���ÊEa\���HC€/¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��ÊEa\›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��ÊEa\3��75$·¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��ÊEa\��Ÿ`]¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��ÊEa\ô��Þdè;¶������/���vendor/symfony/finder/Comparator/Comparator.php���ÊEa\���¾üœµ¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��ÊEa\#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��ÊEa\|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���ÊEa\„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��ÊEa\¬��wR¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���ÊEa\„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��ÊEa\)��x§e¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��ÊEa\º��˜þ˜¶������/���vendor/symfony/finder/Expression/Expression.php��ÊEa\��i¥:Ŷ������)���vendor/symfony/finder/Expression/Glob.phpf��ÊEa\f��DÞcj¶������*���vendor/symfony/finder/Expression/Regex.php��ÊEa\��ü(Ã϶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��ÊEa\Í��\p4†¶������ ���vendor/symfony/finder/Finder.phpc.��ÊEa\c.��:ˆ5g¶���������vendor/symfony/finder/Glob.phpL��ÊEa\L��jÍ9׶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��ÊEa\]��ÎoÅƶ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��ÊEa\x��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��ÊEa\î��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��ÊEa\í��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��ÊEa\#��G?T½¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��ÊEa\Z��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��ÊEa\5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��ÊEa\r��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��ÊEa\Ã��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��ÊEa\-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��ÊEa\Ð��‚c¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��ÊEa\ ��ë]í»¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��ÊEa\e��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php+��ÊEa\+��õÝË ¶���������vendor/symfony/finder/LICENSE)��ÊEa\)��NUN½¶������'���vendor/symfony/finder/Shell/Command.php> ��ÊEa\> ��_~u ¶������%���vendor/symfony/finder/Shell/Shell.phpr��ÊEa\r��þpN¶������%���vendor/symfony/finder/SplFileInfo.php��ÊEa\��þ�íù¶������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��ÊEa\H ��³�Õݶ������%���vendor/symfony/polyfill-ctype/LICENSE$��ÊEa\$��?‡s:¶������+���vendor/symfony/polyfill-ctype/bootstrap.phpI��ÊEa\I���D!e¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��ÊEa\)��±íж������-���vendor/symfony/polyfill-mbstring/Mbstring.phpC��ÊEa\C��ãZ?¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��ÊEa\÷@��õžØ¶������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��ÊEa\ã��öy_•¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��ÊEa\fA��Úf”߶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpË��ÊEa\Ë��ó<Ë¢¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���ÊEa\f���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���ÊEa\¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���ÊEa\”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��ÊEa\x��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��ÊEa\��﫶������5���vendor/symfony/process/Exception/RuntimeException.php˜���ÊEa\˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php���ÊEa\���ûus€¶���������vendor/symfony/process/LICENSE)��ÊEa\)��NUN½¶������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��ÊEa\Ï��Î%h¶������%���vendor/symfony/process/PhpProcess.phpü��ÊEa\ü��‡jûü¶������.���vendor/symfony/process/Pipes/AbstractPipes.php½��ÊEa\½��憶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��ÊEa\D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��ÊEa\>��ª•ir¶������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��ÊEa\p ��âU~ɶ������"���vendor/symfony/process/Process.php·R��ÊEa\·R��Š`Õ¶������)���vendor/symfony/process/ProcessBuilder.phpâ
  48. ��ÊEa\â
  49. ��†M¶¶������'���vendor/symfony/process/ProcessUtils.phpQ��ÊEa\Q��b-$m¶���������vendor/seld/jsonlint/LICENSE"��ÊEa\"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��ÊEa\*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��ÊEa\/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��ÊEa\��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��ÊEa\��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���ÊEa\>���ÿqŸŸ¶������(���vendor/justinrainbow/json-schema/LICENSE ��ÊEa\ ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��ÊEa\ñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��ÊEa\¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ��ÊEa\) ��#©¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��ÊEa\§ ��›Vض������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��ÊEa\¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��ÊEa\]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��ÊEa\ã ��á0;¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��ÊEa\…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  50. ��ÊEa\š
  51. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��ÊEa\Ã��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��ÊEa\0 ��×j´˜¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��ÊEa\��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��ÊEa\a�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��ÊEa\p��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��ÊEa\‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��ÊEa\&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"��ÊEa\,"��ulÙ·¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��ÊEa\è��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���ÊEa\I���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���ÊEa\•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���ÊEa\l���A!L׶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���ÊEa\l���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���ÊEa\u���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���ÊEa\w���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��ÊEa\Þ��\¸
  52. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���ÊEa\o���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���ÊEa\…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���ÊEa\€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���ÊEa\j���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���ÊEa\f���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��ÊEa\þ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��ÊEa\ ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��ÊEa\œ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��ÊEa\��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���ÊEa\á���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��ÊEa\¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��ÊEa\%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��ÊEa\,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���ÊEa\®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��ÊEa\ ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&��ÊEa\&��¼î‚¢¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���ÊEa\ƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���ÊEa\…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpx��ÊEa\x��eÃþ¶������%���vendor/composer/spdx-licenses/LICENSE��ÊEa\��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��ÊEa\H��͉T¶���������vendor/composer/semver/LICENSE��ÊEa\��Bhí¶������)���vendor/composer/semver/src/Comparator.php��ÊEa\��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��ÊEa\×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��ÊEa\ª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���ÊEa\ß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��ÊEa\é��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��ÊEa\1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��ÊEa\v��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��ÊEa\¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��ÊEa\��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php��ÊEa\��Ê ~Ķ������&���vendor/composer/xdebug-handler/LICENSE)��ÊEa\)��#Ô;^¶������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��ÊEa\´��*D’�¶������.���vendor/composer/xdebug-handler/src/Process.phpt��ÊEa\t��ÛŒú&¶������-���vendor/composer/xdebug-handler/src/Status.php
  53. ��ÊEa\
  54. ��²‚²¶������4���vendor/composer/xdebug-handler/src/XdebugHandler.php!��ÊEa\!��2|¿C¶���������vendor/psr/log/LICENSE=��ÊEa\=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��ÊEa\;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���ÊEa\`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���ÊEa\û���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���ÊEa\|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���ÊEa\§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��ÊEa\Æ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��ÊEa\i��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���ÊEa\ž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpI ��ÊEa\I ��õÇAs¶������*���vendor/psr/log/Psr/Log/Test/TestLogger.php ��ÊEa\ ��ôc�›¶���������vendor/autoload.php‚���ÊEa\‚���|ÚdѶ������'���vendor/composer/autoload_namespaces.phpd���ÊEa\d���Z¡¦H¶������!���vendor/composer/autoload_psr4.php÷��ÊEa\÷��Å*š¶������%���vendor/composer/autoload_classmap.phpd���ÊEa\d���Z¡¦H¶������"���vendor/composer/autoload_files.php��ÊEa\��¥� ®¶������!���vendor/composer/autoload_real.phpI��ÊEa\I��üF"7¶������#���vendor/composer/autoload_static.php§
  55. ��ÊEa\§
  56. ��sé—ð¶���������vendor/composer/ClassLoader.php¨��ÊEa\¨��xää`¶������(���vendor/composer/ca-bundle/res/cacert.pemÌY�ÊEa\ÌY�R.£¶������ ���bin/composer ��ÊEa\ ��‘¹Û¶���������LICENSE.��ÊEa\.�� Õ¶������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. class AutoloadGenerator
  68. {
  69. private $eventDispatcher;
  70. private $io;
  71. private $devMode = false;
  72. private $classMapAuthoritative = false;
  73. private $apcu = false;
  74. private $runScripts = false;
  75. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  76. {
  77. $this->eventDispatcher = $eventDispatcher;
  78. $this->io = $io;
  79. }
  80. public function setDevMode($devMode = true)
  81. {
  82. $this->devMode = (bool) $devMode;
  83. }
  84. public function setClassMapAuthoritative($classMapAuthoritative)
  85. {
  86. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  87. }
  88. public function setApcu($apcu)
  89. {
  90. $this->apcu = (bool) $apcu;
  91. }
  92. public function setRunScripts($runScripts = true)
  93. {
  94. $this->runScripts = (bool) $runScripts;
  95. }
  96. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  97. {
  98. if ($this->classMapAuthoritative) {
  99. $scanPsr0Packages = true;
  100. }
  101. if ($this->runScripts) {
  102. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  103. 'optimize' => (bool) $scanPsr0Packages,
  104. ));
  105. }
  106. $filesystem = new Filesystem();
  107. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  108. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  109. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  110. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  111. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  112. $targetDir = $vendorPath.'/'.$targetDir;
  113. $filesystem->ensureDirectoryExists($targetDir);
  114. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  115. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  116. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  117. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  118. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  119. $namespacesFile = <<<EOF
  120. <?php
  121. // autoload_namespaces.php @generated by Composer
  122. \$vendorDir = $vendorPathCode52;
  123. \$baseDir = $appBaseDirCode;
  124. return array(
  125. EOF;
  126. $psr4File = <<<EOF
  127. <?php
  128. // autoload_psr4.php @generated by Composer
  129. \$vendorDir = $vendorPathCode52;
  130. \$baseDir = $appBaseDirCode;
  131. return array(
  132. EOF;
  133. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  134. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  135. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  136. $exportedPaths = array();
  137. foreach ($paths as $path) {
  138. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  139. }
  140. $exportedPrefix = var_export($namespace, true);
  141. $namespacesFile .= " $exportedPrefix => ";
  142. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  143. }
  144. $namespacesFile .= ");\n";
  145. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  146. $exportedPaths = array();
  147. foreach ($paths as $path) {
  148. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  149. }
  150. $exportedPrefix = var_export($namespace, true);
  151. $psr4File .= " $exportedPrefix => ";
  152. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  153. }
  154. $psr4File .= ");\n";
  155. $classmapFile = <<<EOF
  156. <?php
  157. // autoload_classmap.php @generated by Composer
  158. \$vendorDir = $vendorPathCode52;
  159. \$baseDir = $appBaseDirCode;
  160. return array(
  161. EOF;
  162. $targetDirLoader = null;
  163. $mainAutoload = $mainPackage->getAutoload();
  164. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  165. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  166. $prefixes = implode(', ', array_map(function ($prefix) {
  167. return var_export($prefix, true);
  168. }, array_keys($mainAutoload['psr-0'])));
  169. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  170. $targetDirLoader = <<<EOF
  171. public static function autoload(\$class)
  172. {
  173. \$dir = $baseDirFromTargetDirCode . '/';
  174. \$prefixes = array($prefixes);
  175. foreach (\$prefixes as \$prefix) {
  176. if (0 !== strpos(\$class, \$prefix)) {
  177. continue;
  178. }
  179. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  180. if (!\$path = stream_resolve_include_path(\$path)) {
  181. return false;
  182. }
  183. require \$path;
  184. return true;
  185. }
  186. }
  187. EOF;
  188. }
  189. $blacklist = null;
  190. if (!empty($autoloads['exclude-from-classmap'])) {
  191. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  192. }
  193. $classMap = array();
  194. if ($scanPsr0Packages) {
  195. $namespacesToScan = array();
  196. foreach (array('psr-0', 'psr-4') as $psrType) {
  197. foreach ($autoloads[$psrType] as $namespace => $paths) {
  198. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  199. }
  200. }
  201. krsort($namespacesToScan);
  202. foreach ($namespacesToScan as $namespace => $groups) {
  203. foreach ($groups as $group) {
  204. foreach ($group['paths'] as $dir) {
  205. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  206. if (!is_dir($dir)) {
  207. continue;
  208. }
  209. $namespaceFilter = $namespace === '' ? null : $namespace;
  210. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  211. }
  212. }
  213. }
  214. }
  215. foreach ($autoloads['classmap'] as $dir) {
  216. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  217. }
  218. ksort($classMap);
  219. foreach ($classMap as $class => $code) {
  220. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  221. }
  222. $classmapFile .= ");\n";
  223. if (!$suffix) {
  224. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  225. $content = file_get_contents($vendorPath.'/autoload.php');
  226. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  227. $suffix = $match[1];
  228. }
  229. }
  230. if (!$suffix) {
  231. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  232. }
  233. }
  234. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  235. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  236. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  237. $includePathFilePath = $targetDir.'/include_paths.php';
  238. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  239. file_put_contents($includePathFilePath, $includePathFileContents);
  240. } elseif (file_exists($includePathFilePath)) {
  241. unlink($includePathFilePath);
  242. }
  243. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  244. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  245. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  246. } elseif (file_exists($includeFilesFilePath)) {
  247. unlink($includeFilesFilePath);
  248. }
  249. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  250. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  251. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  252. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  253. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  254. if ($this->runScripts) {
  255. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  256. 'optimize' => (bool) $scanPsr0Packages,
  257. ));
  258. }
  259. return count($classMap);
  260. }
  261. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  262. {
  263. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  264. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  265. if (!isset($classMap[$class])) {
  266. $classMap[$class] = $pathCode;
  267. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  268. $this->io->writeError(
  269. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  270. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  271. );
  272. }
  273. }
  274. return $classMap;
  275. }
  276. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  277. {
  278. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  279. }
  280. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  281. {
  282. $packageMap = array(array($mainPackage, ''));
  283. foreach ($packages as $package) {
  284. if ($package instanceof AliasPackage) {
  285. continue;
  286. }
  287. $this->validatePackage($package);
  288. $packageMap[] = array(
  289. $package,
  290. $installationManager->getInstallPath($package),
  291. );
  292. }
  293. return $packageMap;
  294. }
  295. protected function validatePackage(PackageInterface $package)
  296. {
  297. $autoload = $package->getAutoload();
  298. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  299. $name = $package->getName();
  300. $package->getTargetDir();
  301. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  302. }
  303. if (!empty($autoload['psr-4'])) {
  304. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  305. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  306. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  307. }
  308. }
  309. }
  310. }
  311. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  312. {
  313. $mainPackageMap = array_shift($packageMap);
  314. if ($filterOutRequireDevPackages) {
  315. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  316. }
  317. $sortedPackageMap = $this->sortPackageMap($packageMap);
  318. $sortedPackageMap[] = $mainPackageMap;
  319. array_unshift($packageMap, $mainPackageMap);
  320. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  321. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  322. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  323. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  324. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  325. krsort($psr0);
  326. krsort($psr4);
  327. return array(
  328. 'psr-0' => $psr0,
  329. 'psr-4' => $psr4,
  330. 'classmap' => $classmap,
  331. 'files' => $files,
  332. 'exclude-from-classmap' => $exclude,
  333. );
  334. }
  335. public function createLoader(array $autoloads)
  336. {
  337. $loader = new ClassLoader();
  338. if (isset($autoloads['psr-0'])) {
  339. foreach ($autoloads['psr-0'] as $namespace => $path) {
  340. $loader->add($namespace, $path);
  341. }
  342. }
  343. if (isset($autoloads['psr-4'])) {
  344. foreach ($autoloads['psr-4'] as $namespace => $path) {
  345. $loader->addPsr4($namespace, $path);
  346. }
  347. }
  348. if (isset($autoloads['classmap'])) {
  349. $blacklist = null;
  350. if (!empty($autoloads['exclude-from-classmap'])) {
  351. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  352. }
  353. foreach ($autoloads['classmap'] as $dir) {
  354. try {
  355. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  356. } catch (\RuntimeException $e) {
  357. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  358. }
  359. }
  360. }
  361. return $loader;
  362. }
  363. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  364. {
  365. $includePaths = array();
  366. foreach ($packageMap as $item) {
  367. list($package, $installPath) = $item;
  368. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  369. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  370. }
  371. foreach ($package->getIncludePaths() as $includePath) {
  372. $includePath = trim($includePath, '/');
  373. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  374. }
  375. }
  376. if (!$includePaths) {
  377. return;
  378. }
  379. $includePathsCode = '';
  380. foreach ($includePaths as $path) {
  381. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  382. }
  383. return <<<EOF
  384. <?php
  385. // include_paths.php @generated by Composer
  386. \$vendorDir = $vendorPathCode;
  387. \$baseDir = $appBaseDirCode;
  388. return array(
  389. $includePathsCode);
  390. EOF;
  391. }
  392. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  393. {
  394. $filesCode = '';
  395. foreach ($files as $fileIdentifier => $functionFile) {
  396. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  397. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  398. }
  399. if (!$filesCode) {
  400. return false;
  401. }
  402. return <<<EOF
  403. <?php
  404. // autoload_files.php @generated by Composer
  405. \$vendorDir = $vendorPathCode;
  406. \$baseDir = $appBaseDirCode;
  407. return array(
  408. $filesCode);
  409. EOF;
  410. }
  411. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  412. {
  413. if (!$filesystem->isAbsolutePath($path)) {
  414. $path = $basePath . '/' . $path;
  415. }
  416. $path = $filesystem->normalizePath($path);
  417. $baseDir = '';
  418. if (strpos($path.'/', $vendorPath.'/') === 0) {
  419. $path = substr($path, strlen($vendorPath));
  420. $baseDir = '$vendorDir';
  421. if ($path !== false) {
  422. $baseDir .= " . ";
  423. }
  424. } else {
  425. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  426. if (!$filesystem->isAbsolutePath($path)) {
  427. $baseDir = '$baseDir . ';
  428. $path = '/' . $path;
  429. }
  430. }
  431. if (preg_match('/\.phar.+$/', $path)) {
  432. $baseDir = "'phar://' . " . $baseDir;
  433. }
  434. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  435. }
  436. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  437. {
  438. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  439. if ("'" === $lastChar || '"' === $lastChar) {
  440. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  441. } else {
  442. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  443. }
  444. return <<<AUTOLOAD
  445. <?php
  446. // autoload.php @generated by Composer
  447. require_once $vendorPathToTargetDirCode;
  448. return ComposerAutoloaderInit$suffix::getLoader();
  449. AUTOLOAD;
  450. }
  451. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  452. {
  453. $file = <<<HEADER
  454. <?php
  455. // autoload_real.php @generated by Composer
  456. class ComposerAutoloaderInit$suffix
  457. {
  458. private static \$loader;
  459. public static function loadClassLoader(\$class)
  460. {
  461. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  462. require __DIR__ . '/ClassLoader.php';
  463. }
  464. }
  465. public static function getLoader()
  466. {
  467. if (null !== self::\$loader) {
  468. return self::\$loader;
  469. }
  470. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  471. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  472. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  473. HEADER;
  474. if ($useIncludePath) {
  475. $file .= <<<'INCLUDE_PATH'
  476. $includePaths = require __DIR__ . '/include_paths.php';
  477. $includePaths[] = get_include_path();
  478. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  479. INCLUDE_PATH;
  480. }
  481. $file .= <<<STATIC_INIT
  482. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  483. if (\$useStaticLoader) {
  484. require_once __DIR__ . '/autoload_static.php';
  485. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  486. } else {
  487. STATIC_INIT;
  488. if (!$this->classMapAuthoritative) {
  489. $file .= <<<'PSR04'
  490. $map = require __DIR__ . '/autoload_namespaces.php';
  491. foreach ($map as $namespace => $path) {
  492. $loader->set($namespace, $path);
  493. }
  494. $map = require __DIR__ . '/autoload_psr4.php';
  495. foreach ($map as $namespace => $path) {
  496. $loader->setPsr4($namespace, $path);
  497. }
  498. PSR04;
  499. }
  500. if ($useClassMap) {
  501. $file .= <<<'CLASSMAP'
  502. $classMap = require __DIR__ . '/autoload_classmap.php';
  503. if ($classMap) {
  504. $loader->addClassMap($classMap);
  505. }
  506. CLASSMAP;
  507. }
  508. $file .= " }\n\n";
  509. if ($this->classMapAuthoritative) {
  510. $file .= <<<'CLASSMAPAUTHORITATIVE'
  511. $loader->setClassMapAuthoritative(true);
  512. CLASSMAPAUTHORITATIVE;
  513. }
  514. if ($this->apcu) {
  515. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  516. $file .= <<<APCU
  517. \$loader->setApcuPrefix('$apcuPrefix');
  518. APCU;
  519. }
  520. if ($useGlobalIncludePath) {
  521. $file .= <<<'INCLUDEPATH'
  522. $loader->setUseIncludePath(true);
  523. INCLUDEPATH;
  524. }
  525. if ($targetDirLoader) {
  526. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  527. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  528. REGISTER_TARGET_DIR_AUTOLOAD;
  529. }
  530. $file .= <<<REGISTER_LOADER
  531. \$loader->register($prependAutoloader);
  532. REGISTER_LOADER;
  533. if ($useIncludeFiles) {
  534. $file .= <<<INCLUDE_FILES
  535. if (\$useStaticLoader) {
  536. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  537. } else {
  538. \$includeFiles = require __DIR__ . '/autoload_files.php';
  539. }
  540. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  541. composerRequire$suffix(\$fileIdentifier, \$file);
  542. }
  543. INCLUDE_FILES;
  544. }
  545. $file .= <<<METHOD_FOOTER
  546. return \$loader;
  547. }
  548. METHOD_FOOTER;
  549. $file .= $targetDirLoader;
  550. if ($useIncludeFiles) {
  551. return $file . <<<FOOTER
  552. }
  553. function composerRequire$suffix(\$fileIdentifier, \$file)
  554. {
  555. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  556. require \$file;
  557. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  558. }
  559. }
  560. FOOTER;
  561. }
  562. return $file . <<<FOOTER
  563. }
  564. FOOTER;
  565. }
  566. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  567. {
  568. $staticPhpVersion = 50600;
  569. $file = <<<HEADER
  570. <?php
  571. // autoload_static.php @generated by Composer
  572. namespace Composer\Autoload;
  573. class ComposerStaticInit$suffix
  574. {
  575. HEADER;
  576. $loader = new ClassLoader();
  577. $map = require $targetDir . '/autoload_namespaces.php';
  578. foreach ($map as $namespace => $path) {
  579. $loader->set($namespace, $path);
  580. }
  581. $map = require $targetDir . '/autoload_psr4.php';
  582. foreach ($map as $namespace => $path) {
  583. $loader->setPsr4($namespace, $path);
  584. }
  585. $classMap = require $targetDir . '/autoload_classmap.php';
  586. if ($classMap) {
  587. $loader->addClassMap($classMap);
  588. }
  589. $filesystem = new Filesystem();
  590. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  591. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  592. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  593. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  594. $initializer = '';
  595. $prefix = "\0Composer\Autoload\ClassLoader\0";
  596. $prefixLen = strlen($prefix);
  597. if (file_exists($targetDir . '/autoload_files.php')) {
  598. $maps = array('files' => require $targetDir . '/autoload_files.php');
  599. } else {
  600. $maps = array();
  601. }
  602. foreach ((array) $loader as $prop => $value) {
  603. if ($value && 0 === strpos($prop, $prefix)) {
  604. $maps[substr($prop, $prefixLen)] = $value;
  605. }
  606. }
  607. foreach ($maps as $prop => $value) {
  608. if (count($value) > 32767) {
  609. $staticPhpVersion = 70000;
  610. }
  611. $value = var_export($value, true);
  612. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  613. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  614. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  615. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  616. if ('files' !== $prop) {
  617. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  618. }
  619. }
  620. return $file . <<<INITIALIZER
  621. public static function getInitializer(ClassLoader \$loader)
  622. {
  623. return \Closure::bind(function () use (\$loader) {
  624. $initializer
  625. }, null, ClassLoader::class);
  626. }
  627. }
  628. INITIALIZER;
  629. }
  630. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  631. {
  632. $autoloads = array();
  633. foreach ($packageMap as $item) {
  634. list($package, $installPath) = $item;
  635. $autoload = $package->getAutoload();
  636. if ($this->devMode && $package === $mainPackage) {
  637. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  638. }
  639. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  640. continue;
  641. }
  642. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  643. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  644. }
  645. foreach ($autoload[$type] as $namespace => $paths) {
  646. foreach ((array) $paths as $path) {
  647. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  648. if ($package === $mainPackage) {
  649. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  650. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  651. } else {
  652. $path = $package->getTargetDir() . '/' . $path;
  653. }
  654. }
  655. if ($type === 'exclude-from-classmap') {
  656. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  657. $path = str_replace('\\*\\*', '.+?', $path);
  658. $path = str_replace('\\*', '[^/]+?', $path);
  659. $updir = null;
  660. $path = preg_replace_callback(
  661. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  662. function ($matches) use (&$updir) {
  663. if (isset($matches[1])) {
  664. $updir = str_replace('\\.', '.', $matches[1]);
  665. }
  666. return '';
  667. },
  668. $path
  669. );
  670. if (empty($installPath)) {
  671. $installPath = strtr(getcwd(), '\\', '/');
  672. }
  673. $resolvedPath = realpath($installPath . '/' . $updir);
  674. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  675. continue;
  676. }
  677. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  678. if ($type === 'files') {
  679. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  680. continue;
  681. } elseif ($type === 'classmap') {
  682. $autoloads[] = $relativePath;
  683. continue;
  684. }
  685. $autoloads[$namespace][] = $relativePath;
  686. }
  687. }
  688. }
  689. return $autoloads;
  690. }
  691. protected function getFileIdentifier(PackageInterface $package, $path)
  692. {
  693. return md5($package->getName() . ':' . $path);
  694. }
  695. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  696. {
  697. $packages = array();
  698. $include = array();
  699. foreach ($packageMap as $item) {
  700. $package = $item[0];
  701. $name = $package->getName();
  702. $packages[$name] = $package;
  703. }
  704. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  705. foreach ($package->getRequires() as $link) {
  706. $target = $link->getTarget();
  707. if (!isset($include[$target])) {
  708. $include[$target] = true;
  709. if (isset($packages[$target])) {
  710. $add($packages[$target]);
  711. }
  712. }
  713. }
  714. };
  715. $add($mainPackage);
  716. return array_filter(
  717. $packageMap,
  718. function ($item) use ($include) {
  719. $package = $item[0];
  720. foreach ($package->getNames() as $name) {
  721. if (isset($include[$name])) {
  722. return true;
  723. }
  724. }
  725. return false;
  726. }
  727. );
  728. }
  729. protected function sortPackageMap(array $packageMap)
  730. {
  731. $packages = array();
  732. $paths = array();
  733. $usageList = array();
  734. foreach ($packageMap as $item) {
  735. list($package, $path) = $item;
  736. $name = $package->getName();
  737. $packages[$name] = $package;
  738. $paths[$name] = $path;
  739. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  740. $target = $link->getTarget();
  741. $usageList[$target][] = $name;
  742. }
  743. }
  744. $computing = array();
  745. $computed = array();
  746. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  747. if (isset($computed[$name])) {
  748. return $computed[$name];
  749. }
  750. if (isset($computing[$name])) {
  751. return 0;
  752. }
  753. $computing[$name] = true;
  754. $weight = 0;
  755. if (isset($usageList[$name])) {
  756. foreach ($usageList[$name] as $user) {
  757. $weight -= 1 - $computeImportance($user);
  758. }
  759. }
  760. unset($computing[$name]);
  761. $computed[$name] = $weight;
  762. return $weight;
  763. };
  764. $weightList = array();
  765. foreach ($packages as $name => $package) {
  766. $weight = $computeImportance($name);
  767. $weightList[$name] = $weight;
  768. }
  769. $stable_sort = function (&$array) {
  770. static $transform, $restore;
  771. $i = 0;
  772. if (!$transform) {
  773. $transform = function (&$v, $k) use (&$i) {
  774. $v = array($v, ++$i, $k, $v);
  775. };
  776. $restore = function (&$v, $k) {
  777. $v = $v[3];
  778. };
  779. }
  780. array_walk($array, $transform);
  781. asort($array);
  782. array_walk($array, $restore);
  783. };
  784. $stable_sort($weightList);
  785. $sortedPackageMap = array();
  786. foreach (array_keys($weightList) as $name) {
  787. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  788. }
  789. return $sortedPackageMap;
  790. }
  791. protected function safeCopy($source, $target)
  792. {
  793. $source = fopen($source, 'r');
  794. $target = fopen($target, 'w+');
  795. stream_copy_to_stream($source, $target);
  796. fclose($source);
  797. fclose($target);
  798. }
  799. }
  800. <?php
  801. namespace Composer\Autoload;
  802. use Symfony\Component\Finder\Finder;
  803. use Composer\IO\IOInterface;
  804. use Composer\Util\Filesystem;
  805. class ClassMapGenerator
  806. {
  807. public static function dump($dirs, $file)
  808. {
  809. $maps = array();
  810. foreach ($dirs as $dir) {
  811. $maps = array_merge($maps, static::createMap($dir));
  812. }
  813. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  814. }
  815. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  816. {
  817. if (is_string($path)) {
  818. if (is_file($path)) {
  819. $path = array(new \SplFileInfo($path));
  820. } elseif (is_dir($path)) {
  821. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  822. } else {
  823. throw new \RuntimeException(
  824. 'Could not scan for classes inside "'.$path.
  825. '" which does not appear to be a file nor a folder'
  826. );
  827. }
  828. }
  829. $map = array();
  830. $filesystem = new Filesystem();
  831. $cwd = realpath(getcwd());
  832. foreach ($path as $file) {
  833. $filePath = $file->getPathname();
  834. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  835. continue;
  836. }
  837. if (!$filesystem->isAbsolutePath($filePath)) {
  838. $filePath = $cwd . '/' . $filePath;
  839. $filePath = $filesystem->normalizePath($filePath);
  840. } else {
  841. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  842. }
  843. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  844. continue;
  845. }
  846. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  847. continue;
  848. }
  849. $classes = self::findClasses($filePath);
  850. foreach ($classes as $class) {
  851. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  852. continue;
  853. }
  854. if (!isset($map[$class])) {
  855. $map[$class] = $filePath;
  856. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  857. $io->writeError(
  858. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  859. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  860. );
  861. }
  862. }
  863. }
  864. return $map;
  865. }
  866. private static function findClasses($path)
  867. {
  868. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  869. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  870. $extraTypes .= '|enum';
  871. }
  872. $contents = @php_strip_whitespace($path);
  873. if (!$contents) {
  874. if (!file_exists($path)) {
  875. $message = 'File at "%s" does not exist, check your classmap definitions';
  876. } elseif (!is_readable($path)) {
  877. $message = 'File at "%s" is not readable, check its permissions';
  878. } elseif ('' === trim(file_get_contents($path))) {
  879. return array();
  880. } else {
  881. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  882. }
  883. $error = error_get_last();
  884. if (isset($error['message'])) {
  885. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  886. }
  887. throw new \RuntimeException(sprintf($message, $path));
  888. }
  889. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  890. return array();
  891. }
  892. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  893. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  894. if (substr($contents, 0, 2) !== '<?') {
  895. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  896. if ($replacements === 0) {
  897. return array();
  898. }
  899. }
  900. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  901. $pos = strrpos($contents, '?>');
  902. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  903. $contents = substr($contents, 0, $pos);
  904. }
  905. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  906. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  907. }
  908. preg_match_all('{
  909. (?:
  910. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  911. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  912. )
  913. }ix', $contents, $matches);
  914. $classes = array();
  915. $namespace = '';
  916. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  917. if (!empty($matches['ns'][$i])) {
  918. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  919. } else {
  920. $name = $matches['name'][$i];
  921. if ($name === 'extends' || $name === 'implements') {
  922. continue;
  923. }
  924. if ($name[0] === ':') {
  925. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  926. } elseif ($matches['type'][$i] === 'enum') {
  927. $name = rtrim($name, ':');
  928. }
  929. $classes[] = ltrim($namespace . $name, '\\');
  930. }
  931. }
  932. return $classes;
  933. }
  934. }
  935. <?php
  936. namespace Composer;
  937. use Composer\IO\IOInterface;
  938. use Composer\Util\Filesystem;
  939. use Composer\Util\Silencer;
  940. use Symfony\Component\Finder\Finder;
  941. class Cache
  942. {
  943. private static $cacheCollected = false;
  944. private $io;
  945. private $root;
  946. private $enabled = true;
  947. private $whitelist;
  948. private $filesystem;
  949. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  950. {
  951. $this->io = $io;
  952. $this->root = rtrim($cacheDir, '/\\') . '/';
  953. $this->whitelist = $whitelist;
  954. $this->filesystem = $filesystem ?: new Filesystem();
  955. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  956. $this->enabled = false;
  957. return;
  958. }
  959. if (
  960. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  961. || !is_writable($this->root)
  962. ) {
  963. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  964. $this->enabled = false;
  965. }
  966. }
  967. public function isEnabled()
  968. {
  969. return $this->enabled;
  970. }
  971. public function getRoot()
  972. {
  973. return $this->root;
  974. }
  975. public function read($file)
  976. {
  977. if ($this->enabled) {
  978. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  979. if (file_exists($this->root . $file)) {
  980. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  981. return file_get_contents($this->root . $file);
  982. }
  983. }
  984. return false;
  985. }
  986. public function write($file, $contents)
  987. {
  988. if ($this->enabled) {
  989. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  990. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  991. try {
  992. return file_put_contents($this->root . $file, $contents);
  993. } catch (\ErrorException $e) {
  994. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  995. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  996. unlink($this->root . $file);
  997. $message = sprintf(
  998. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  999. $this->root . $file,
  1000. $m[1],
  1001. $m[2],
  1002. @disk_free_space($this->root . dirname($file))
  1003. );
  1004. $this->io->writeError($message);
  1005. return false;
  1006. }
  1007. throw $e;
  1008. }
  1009. }
  1010. return false;
  1011. }
  1012. public function copyFrom($file, $source)
  1013. {
  1014. if ($this->enabled) {
  1015. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1016. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1017. if (!file_exists($source)) {
  1018. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1019. } elseif ($this->io->isDebug()) {
  1020. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1021. }
  1022. return copy($source, $this->root . $file);
  1023. }
  1024. return false;
  1025. }
  1026. public function copyTo($file, $target)
  1027. {
  1028. if ($this->enabled) {
  1029. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1030. if (file_exists($this->root . $file)) {
  1031. try {
  1032. touch($this->root . $file, filemtime($this->root . $file), time());
  1033. } catch (\ErrorException $e) {
  1034. Silencer::call('touch', $this->root . $file);
  1035. }
  1036. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1037. return copy($this->root . $file, $target);
  1038. }
  1039. }
  1040. return false;
  1041. }
  1042. public function gcIsNecessary()
  1043. {
  1044. return (!self::$cacheCollected && !mt_rand(0, 50));
  1045. }
  1046. public function remove($file)
  1047. {
  1048. if ($this->enabled) {
  1049. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1050. if (file_exists($this->root . $file)) {
  1051. return $this->filesystem->unlink($this->root . $file);
  1052. }
  1053. }
  1054. return false;
  1055. }
  1056. public function clear()
  1057. {
  1058. if ($this->enabled) {
  1059. return $this->filesystem->removeDirectory($this->root);
  1060. }
  1061. return false;
  1062. }
  1063. public function gc($ttl, $maxSize)
  1064. {
  1065. if ($this->enabled) {
  1066. $expire = new \DateTime();
  1067. $expire->modify('-'.$ttl.' seconds');
  1068. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1069. foreach ($finder as $file) {
  1070. $this->filesystem->unlink($file->getPathname());
  1071. }
  1072. $totalSize = $this->filesystem->size($this->root);
  1073. if ($totalSize > $maxSize) {
  1074. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1075. while ($totalSize > $maxSize && $iterator->valid()) {
  1076. $filepath = $iterator->current()->getPathname();
  1077. $totalSize -= $this->filesystem->size($filepath);
  1078. $this->filesystem->unlink($filepath);
  1079. $iterator->next();
  1080. }
  1081. }
  1082. self::$cacheCollected = true;
  1083. return true;
  1084. }
  1085. return false;
  1086. }
  1087. public function sha1($file)
  1088. {
  1089. if ($this->enabled) {
  1090. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1091. if (file_exists($this->root . $file)) {
  1092. return sha1_file($this->root . $file);
  1093. }
  1094. }
  1095. return false;
  1096. }
  1097. public function sha256($file)
  1098. {
  1099. if ($this->enabled) {
  1100. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1101. if (file_exists($this->root . $file)) {
  1102. return hash_file('sha256', $this->root . $file);
  1103. }
  1104. }
  1105. return false;
  1106. }
  1107. protected function getFinder()
  1108. {
  1109. return Finder::create()->in($this->root)->files();
  1110. }
  1111. }
  1112. <?php
  1113. namespace Composer\Command;
  1114. use Symfony\Component\Console\Input\InputInterface;
  1115. use Symfony\Component\Console\Output\OutputInterface;
  1116. class AboutCommand extends BaseCommand
  1117. {
  1118. protected function configure()
  1119. {
  1120. $this
  1121. ->setName('about')
  1122. ->setDescription('Shows the short information about Composer.')
  1123. ->setHelp(
  1124. <<<EOT
  1125. <info>php composer.phar about</info>
  1126. EOT
  1127. )
  1128. ;
  1129. }
  1130. protected function execute(InputInterface $input, OutputInterface $output)
  1131. {
  1132. $this->getIO()->write(
  1133. <<<EOT
  1134. <info>Composer - Dependency Manager for PHP</info>
  1135. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1136. See https://getcomposer.org/ for more information.</comment>
  1137. EOT
  1138. );
  1139. }
  1140. }
  1141. <?php
  1142. namespace Composer\Command;
  1143. use Composer\Factory;
  1144. use Composer\IO\IOInterface;
  1145. use Composer\Config;
  1146. use Composer\Composer;
  1147. use Composer\Repository\CompositeRepository;
  1148. use Composer\Repository\RepositoryFactory;
  1149. use Composer\Script\ScriptEvents;
  1150. use Composer\Plugin\CommandEvent;
  1151. use Composer\Plugin\PluginEvents;
  1152. use Composer\Util\Filesystem;
  1153. use Symfony\Component\Console\Input\InputArgument;
  1154. use Symfony\Component\Console\Input\InputInterface;
  1155. use Symfony\Component\Console\Input\InputOption;
  1156. use Symfony\Component\Console\Output\OutputInterface;
  1157. class ArchiveCommand extends BaseCommand
  1158. {
  1159. protected function configure()
  1160. {
  1161. $this
  1162. ->setName('archive')
  1163. ->setDescription('Creates an archive of this composer package.')
  1164. ->setDefinition(array(
  1165. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1166. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1167. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1168. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1169. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1170. .' Note that the format will be appended.'),
  1171. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1172. ))
  1173. ->setHelp(
  1174. <<<EOT
  1175. The <info>archive</info> command creates an archive of the specified format
  1176. containing the files and directories of the Composer project or the specified
  1177. package in the specified version and writes it to the specified directory.
  1178. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1179. EOT
  1180. )
  1181. ;
  1182. }
  1183. protected function execute(InputInterface $input, OutputInterface $output)
  1184. {
  1185. $config = Factory::createConfig();
  1186. $composer = $this->getComposer(false);
  1187. if ($composer) {
  1188. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1189. $eventDispatcher = $composer->getEventDispatcher();
  1190. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1191. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1192. }
  1193. if (null === $input->getOption('format')) {
  1194. $input->setOption('format', $config->get('archive-format'));
  1195. }
  1196. if (null === $input->getOption('dir')) {
  1197. $input->setOption('dir', $config->get('archive-dir'));
  1198. }
  1199. $returnCode = $this->archive(
  1200. $this->getIO(),
  1201. $config,
  1202. $input->getArgument('package'),
  1203. $input->getArgument('version'),
  1204. $input->getOption('format'),
  1205. $input->getOption('dir'),
  1206. $input->getOption('file'),
  1207. $input->getOption('ignore-filters'),
  1208. $composer
  1209. );
  1210. if (0 === $returnCode && $composer) {
  1211. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1212. }
  1213. return $returnCode;
  1214. }
  1215. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1216. {
  1217. if ($composer) {
  1218. $archiveManager = $composer->getArchiveManager();
  1219. } else {
  1220. $factory = new Factory;
  1221. $downloadManager = $factory->createDownloadManager($io, $config);
  1222. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1223. }
  1224. if ($packageName) {
  1225. $package = $this->selectPackage($io, $packageName, $version);
  1226. if (!$package) {
  1227. return 1;
  1228. }
  1229. } else {
  1230. $package = $this->getComposer()->getPackage();
  1231. }
  1232. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1233. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1234. $fs = new Filesystem;
  1235. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1236. $io->writeError('Created: ', false);
  1237. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1238. return 0;
  1239. }
  1240. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1241. {
  1242. $io->writeError('<info>Searching for the specified package.</info>');
  1243. if ($composer = $this->getComposer(false)) {
  1244. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1245. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1246. } else {
  1247. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1248. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1249. $repo = new CompositeRepository($defaultRepos);
  1250. }
  1251. $packages = $repo->findPackages($packageName, $version);
  1252. if (count($packages) > 1) {
  1253. $package = reset($packages);
  1254. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1255. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1256. return $p->getPrettyString();
  1257. }, $packages)).'.');
  1258. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1259. } elseif ($packages) {
  1260. $package = reset($packages);
  1261. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1262. } else {
  1263. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1264. return false;
  1265. }
  1266. return $package;
  1267. }
  1268. }
  1269. <?php
  1270. namespace Composer\Command;
  1271. use Composer\Composer;
  1272. use Composer\Config;
  1273. use Composer\Console\Application;
  1274. use Composer\Factory;
  1275. use Composer\IO\IOInterface;
  1276. use Composer\IO\NullIO;
  1277. use Composer\Plugin\PreCommandRunEvent;
  1278. use Composer\Plugin\PluginEvents;
  1279. use Symfony\Component\Console\Input\InputInterface;
  1280. use Symfony\Component\Console\Output\OutputInterface;
  1281. use Symfony\Component\Console\Command\Command;
  1282. abstract class BaseCommand extends Command
  1283. {
  1284. private $composer;
  1285. private $io;
  1286. public function getComposer($required = true, $disablePlugins = null)
  1287. {
  1288. if (null === $this->composer) {
  1289. $application = $this->getApplication();
  1290. if ($application instanceof Application) {
  1291. $this->composer = $application->getComposer($required, $disablePlugins);
  1292. } elseif ($required) {
  1293. throw new \RuntimeException(
  1294. 'Could not create a Composer\Composer instance, you must inject '.
  1295. 'one if this command is not used with a Composer\Console\Application instance'
  1296. );
  1297. }
  1298. }
  1299. return $this->composer;
  1300. }
  1301. public function setComposer(Composer $composer)
  1302. {
  1303. $this->composer = $composer;
  1304. }
  1305. public function resetComposer()
  1306. {
  1307. $this->composer = null;
  1308. $this->getApplication()->resetComposer();
  1309. }
  1310. public function isProxyCommand()
  1311. {
  1312. return false;
  1313. }
  1314. public function getIO()
  1315. {
  1316. if (null === $this->io) {
  1317. $application = $this->getApplication();
  1318. if ($application instanceof Application) {
  1319. $this->io = $application->getIO();
  1320. } else {
  1321. $this->io = new NullIO();
  1322. }
  1323. }
  1324. return $this->io;
  1325. }
  1326. public function setIO(IOInterface $io)
  1327. {
  1328. $this->io = $io;
  1329. }
  1330. protected function initialize(InputInterface $input, OutputInterface $output)
  1331. {
  1332. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1333. $composer = $this->getComposer(false, $disablePlugins);
  1334. if (null === $composer) {
  1335. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1336. }
  1337. if ($composer) {
  1338. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1339. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1340. }
  1341. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1342. $input->setOption('no-progress', true);
  1343. }
  1344. parent::initialize($input, $output);
  1345. }
  1346. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1347. {
  1348. $preferSource = false;
  1349. $preferDist = false;
  1350. switch ($config->get('preferred-install')) {
  1351. case 'source':
  1352. $preferSource = true;
  1353. break;
  1354. case 'dist':
  1355. $preferDist = true;
  1356. break;
  1357. case 'auto':
  1358. default:
  1359. break;
  1360. }
  1361. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1362. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1363. $preferDist = $input->getOption('prefer-dist');
  1364. }
  1365. return array($preferSource, $preferDist);
  1366. }
  1367. }
  1368. <?php
  1369. namespace Composer\Command;
  1370. use Composer\DependencyResolver\Pool;
  1371. use Composer\Package\Link;
  1372. use Composer\Package\PackageInterface;
  1373. use Composer\Repository\ArrayRepository;
  1374. use Composer\Repository\CompositeRepository;
  1375. use Composer\Repository\PlatformRepository;
  1376. use Composer\Repository\RepositoryFactory;
  1377. use Composer\Plugin\CommandEvent;
  1378. use Composer\Plugin\PluginEvents;
  1379. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1380. use Composer\Package\Version\VersionParser;
  1381. use Symfony\Component\Console\Helper\Table;
  1382. use Symfony\Component\Console\Input\InputArgument;
  1383. use Symfony\Component\Console\Input\InputInterface;
  1384. use Symfony\Component\Console\Input\InputOption;
  1385. use Symfony\Component\Console\Output\OutputInterface;
  1386. class BaseDependencyCommand extends BaseCommand
  1387. {
  1388. const ARGUMENT_PACKAGE = 'package';
  1389. const ARGUMENT_CONSTRAINT = 'constraint';
  1390. const OPTION_RECURSIVE = 'recursive';
  1391. const OPTION_TREE = 'tree';
  1392. protected $colors;
  1393. protected function configure()
  1394. {
  1395. $this->setDefinition(array(
  1396. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1397. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1398. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1399. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1400. ));
  1401. }
  1402. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1403. {
  1404. $composer = $this->getComposer();
  1405. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1406. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1407. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1408. $repository = new CompositeRepository(array(
  1409. new ArrayRepository(array($composer->getPackage())),
  1410. $composer->getRepositoryManager()->getLocalRepository(),
  1411. new PlatformRepository(array(), $platformOverrides),
  1412. ));
  1413. $pool = new Pool();
  1414. $pool->addRepository($repository);
  1415. list($needle, $textConstraint) = array_pad(
  1416. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1417. 2,
  1418. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1419. );
  1420. $packages = $pool->whatProvides(strtolower($needle));
  1421. if (empty($packages)) {
  1422. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1423. }
  1424. if (!$repository->findPackage($needle, $textConstraint)) {
  1425. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1426. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1427. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1428. }
  1429. }
  1430. $needles = array($needle);
  1431. if ($inverted) {
  1432. foreach ($packages as $package) {
  1433. $needles = array_merge($needles, array_map(function (Link $link) {
  1434. return $link->getTarget();
  1435. }, $package->getReplaces()));
  1436. }
  1437. }
  1438. if ('*' !== $textConstraint) {
  1439. $versionParser = new VersionParser();
  1440. $constraint = $versionParser->parseConstraints($textConstraint);
  1441. } else {
  1442. $constraint = null;
  1443. }
  1444. $renderTree = $input->getOption(self::OPTION_TREE);
  1445. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1446. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1447. if (empty($results)) {
  1448. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1449. $this->getIO()->writeError(sprintf(
  1450. '<info>There is no installed package depending on "%s"%s</info>',
  1451. $needle,
  1452. $extra
  1453. ));
  1454. } elseif ($renderTree) {
  1455. $this->initStyles($output);
  1456. $root = $packages[0];
  1457. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1458. $this->printTree($results);
  1459. } else {
  1460. $this->printTable($output, $results);
  1461. }
  1462. return 0;
  1463. }
  1464. protected function printTable(OutputInterface $output, $results)
  1465. {
  1466. $table = array();
  1467. $doubles = array();
  1468. do {
  1469. $queue = array();
  1470. $rows = array();
  1471. foreach ($results as $result) {
  1472. list($package, $link, $children) = $result;
  1473. $unique = (string) $link;
  1474. if (isset($doubles[$unique])) {
  1475. continue;
  1476. }
  1477. $doubles[$unique] = true;
  1478. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1479. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1480. if ($children) {
  1481. $queue = array_merge($queue, $children);
  1482. }
  1483. }
  1484. $results = $queue;
  1485. $table = array_merge($rows, $table);
  1486. } while (!empty($results));
  1487. $renderer = new Table($output);
  1488. $renderer->setStyle('compact');
  1489. $rendererStyle = $renderer->getStyle();
  1490. $rendererStyle->setVerticalBorderChar('');
  1491. $rendererStyle->setCellRowContentFormat('%s ');
  1492. $renderer->setRows($table)->render();
  1493. }
  1494. protected function initStyles(OutputInterface $output)
  1495. {
  1496. $this->colors = array(
  1497. 'green',
  1498. 'yellow',
  1499. 'cyan',
  1500. 'magenta',
  1501. 'blue',
  1502. );
  1503. foreach ($this->colors as $color) {
  1504. $style = new OutputFormatterStyle($color);
  1505. $output->getFormatter()->setStyle($color, $style);
  1506. }
  1507. }
  1508. protected function printTree($results, $prefix = '', $level = 1)
  1509. {
  1510. $count = count($results);
  1511. $idx = 0;
  1512. foreach ($results as $result) {
  1513. list($package, $link, $children) = $result;
  1514. $color = $this->colors[$level % count($this->colors)];
  1515. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1516. $isLast = (++$idx == $count);
  1517. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1518. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1519. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1520. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1521. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1522. if ($children) {
  1523. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1524. }
  1525. }
  1526. }
  1527. private function writeTreeLine($line)
  1528. {
  1529. $io = $this->getIO();
  1530. if (!$io->isDecorated()) {
  1531. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1532. }
  1533. $io->write($line);
  1534. }
  1535. }
  1536. <?php
  1537. namespace Composer\Command;
  1538. use Composer\Package\Link;
  1539. use Composer\Package\PackageInterface;
  1540. use Composer\Semver\Constraint\Constraint;
  1541. use Symfony\Component\Console\Helper\Table;
  1542. use Symfony\Component\Console\Input\InputInterface;
  1543. use Symfony\Component\Console\Input\InputOption;
  1544. use Symfony\Component\Console\Output\OutputInterface;
  1545. use Composer\Repository\PlatformRepository;
  1546. class CheckPlatformReqsCommand extends BaseCommand
  1547. {
  1548. protected function configure()
  1549. {
  1550. $this->setName('check-platform-reqs')
  1551. ->setDescription('Check that platform requirements are satisfied.')
  1552. ->setDefinition(array(
  1553. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1554. ))
  1555. ->setHelp(
  1556. <<<EOT
  1557. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1558. <info>php composer.phar check-platform-reqs</info>
  1559. EOT
  1560. );
  1561. }
  1562. protected function execute(InputInterface $input, OutputInterface $output)
  1563. {
  1564. $composer = $this->getComposer();
  1565. $requires = $composer->getPackage()->getRequires();
  1566. if ($input->getOption('no-dev')) {
  1567. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1568. } else {
  1569. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1570. $requires += $composer->getPackage()->getDevRequires();
  1571. }
  1572. foreach ($requires as $require => $link) {
  1573. $requires[$require] = array($link);
  1574. }
  1575. foreach ($dependencies as $package) {
  1576. foreach ($package->getRequires() as $require => $link) {
  1577. $requires[$require][] = $link;
  1578. }
  1579. }
  1580. ksort($requires);
  1581. $platformRepo = new PlatformRepository(array(), array());
  1582. $currentPlatformPackages = $platformRepo->getPackages();
  1583. $currentPlatformPackageMap = array();
  1584. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1585. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1586. }
  1587. $results = array();
  1588. $exitCode = 0;
  1589. foreach ($requires as $require => $links) {
  1590. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1591. if (isset($currentPlatformPackageMap[$require])) {
  1592. $pass = true;
  1593. $version = $currentPlatformPackageMap[$require]->getVersion();
  1594. foreach ($links as $link) {
  1595. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1596. $results[] = array(
  1597. $currentPlatformPackageMap[$require]->getPrettyName(),
  1598. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1599. $link,
  1600. '<error>failed</error>',
  1601. );
  1602. $pass = false;
  1603. $exitCode = max($exitCode, 1);
  1604. }
  1605. }
  1606. if ($pass) {
  1607. $results[] = array(
  1608. $currentPlatformPackageMap[$require]->getPrettyName(),
  1609. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1610. null,
  1611. '<info>success</info>',
  1612. );
  1613. }
  1614. } else {
  1615. $results[] = array(
  1616. $require,
  1617. 'n/a',
  1618. $links[0],
  1619. '<error>missing</error>',
  1620. );
  1621. $exitCode = max($exitCode, 2);
  1622. }
  1623. }
  1624. }
  1625. $this->printTable($output, $results);
  1626. return $exitCode;
  1627. }
  1628. protected function printTable(OutputInterface $output, $results)
  1629. {
  1630. $table = array();
  1631. $rows = array();
  1632. foreach ($results as $result) {
  1633. list($platformPackage, $version, $link, $status) = $result;
  1634. $rows[] = array(
  1635. $platformPackage,
  1636. $version,
  1637. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1638. $status,
  1639. );
  1640. }
  1641. $table = array_merge($rows, $table);
  1642. $renderer = new Table($output);
  1643. $renderer->setStyle('compact');
  1644. $rendererStyle = $renderer->getStyle();
  1645. $rendererStyle->setVerticalBorderChar('');
  1646. $rendererStyle->setCellRowContentFormat('%s ');
  1647. $renderer->setRows($table)->render();
  1648. }
  1649. }
  1650. <?php
  1651. namespace Composer\Command;
  1652. use Composer\Cache;
  1653. use Composer\Factory;
  1654. use Symfony\Component\Console\Input\InputInterface;
  1655. use Symfony\Component\Console\Output\OutputInterface;
  1656. class ClearCacheCommand extends BaseCommand
  1657. {
  1658. protected function configure()
  1659. {
  1660. $this
  1661. ->setName('clear-cache')
  1662. ->setAliases(array('clearcache'))
  1663. ->setDescription('Clears composer\'s internal package cache.')
  1664. ->setHelp(
  1665. <<<EOT
  1666. The <info>clear-cache</info> deletes all cached packages from composer's
  1667. cache directory.
  1668. EOT
  1669. )
  1670. ;
  1671. }
  1672. protected function execute(InputInterface $input, OutputInterface $output)
  1673. {
  1674. $config = Factory::createConfig();
  1675. $io = $this->getIO();
  1676. $cachePaths = array(
  1677. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1678. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1679. 'cache-files-dir' => $config->get('cache-files-dir'),
  1680. 'cache-dir' => $config->get('cache-dir'),
  1681. );
  1682. foreach ($cachePaths as $key => $cachePath) {
  1683. $cachePath = realpath($cachePath);
  1684. if (!$cachePath) {
  1685. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1686. continue;
  1687. }
  1688. $cache = new Cache($io, $cachePath);
  1689. if (!$cache->isEnabled()) {
  1690. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1691. continue;
  1692. }
  1693. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1694. $cache->clear();
  1695. }
  1696. $io->writeError('<info>All caches cleared.</info>');
  1697. }
  1698. }
  1699. <?php
  1700. namespace Composer\Command;
  1701. use Composer\Util\Platform;
  1702. use Composer\Util\Silencer;
  1703. use Symfony\Component\Console\Input\InputInterface;
  1704. use Symfony\Component\Console\Input\InputArgument;
  1705. use Symfony\Component\Console\Input\InputOption;
  1706. use Symfony\Component\Console\Output\OutputInterface;
  1707. use Composer\Config;
  1708. use Composer\Config\JsonConfigSource;
  1709. use Composer\Factory;
  1710. use Composer\IO\IOInterface;
  1711. use Composer\Json\JsonFile;
  1712. use Composer\Semver\VersionParser;
  1713. use Composer\Package\BasePackage;
  1714. class ConfigCommand extends BaseCommand
  1715. {
  1716. protected $config;
  1717. protected $configFile;
  1718. protected $configSource;
  1719. protected $authConfigFile;
  1720. protected $authConfigSource;
  1721. protected function configure()
  1722. {
  1723. $this
  1724. ->setName('config')
  1725. ->setDescription('Sets config options.')
  1726. ->setDefinition(array(
  1727. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1728. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1729. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1730. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1731. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1732. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1733. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1734. new InputArgument('setting-key', null, 'Setting key'),
  1735. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1736. ))
  1737. ->setHelp(
  1738. <<<EOT
  1739. This command allows you to edit composer config settings and repositories
  1740. in either the local composer.json file or the global config.json file.
  1741. Additionally it lets you edit most properties in the local composer.json.
  1742. To set a config setting:
  1743. <comment>%command.full_name% bin-dir bin/</comment>
  1744. To read a config setting:
  1745. <comment>%command.full_name% bin-dir</comment>
  1746. Outputs: <info>bin</info>
  1747. To edit the global config.json file:
  1748. <comment>%command.full_name% --global</comment>
  1749. To add a repository:
  1750. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1751. To remove a repository (repo is a short alias for repositories):
  1752. <comment>%command.full_name% --unset repo.foo</comment>
  1753. To disable packagist:
  1754. <comment>%command.full_name% repo.packagist false</comment>
  1755. You can alter repositories in the global config.json file by passing in the
  1756. <info>--global</info> option.
  1757. To edit the file in an external editor:
  1758. <comment>%command.full_name% --editor</comment>
  1759. To choose your editor you can set the "EDITOR" env variable.
  1760. To get a list of configuration values in the file:
  1761. <comment>%command.full_name% --list</comment>
  1762. You can always pass more than one option. As an example, if you want to edit the
  1763. global config.json file.
  1764. <comment>%command.full_name% --editor --global</comment>
  1765. EOT
  1766. )
  1767. ;
  1768. }
  1769. protected function initialize(InputInterface $input, OutputInterface $output)
  1770. {
  1771. parent::initialize($input, $output);
  1772. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1773. throw new \RuntimeException('--file and --global can not be combined');
  1774. }
  1775. $io = $this->getIO();
  1776. $this->config = Factory::createConfig($io);
  1777. $configFile = $input->getOption('global')
  1778. ? ($this->config->get('home') . '/config.json')
  1779. : ($input->getOption('file') ?: Factory::getComposerFile());
  1780. if (
  1781. ($configFile === 'composer.json' || $configFile === './composer.json')
  1782. && !file_exists($configFile)
  1783. && realpath(getcwd()) === realpath($this->config->get('home'))
  1784. ) {
  1785. file_put_contents($configFile, "{\n}\n");
  1786. }
  1787. $this->configFile = new JsonFile($configFile, null, $io);
  1788. $this->configSource = new JsonConfigSource($this->configFile);
  1789. $authConfigFile = $input->getOption('global')
  1790. ? ($this->config->get('home') . '/auth.json')
  1791. : dirname(realpath($configFile)) . '/auth.json';
  1792. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1793. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1794. if ($input->getOption('global') && !$this->configFile->exists()) {
  1795. touch($this->configFile->getPath());
  1796. $this->configFile->write(array('config' => new \ArrayObject));
  1797. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1798. }
  1799. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1800. touch($this->authConfigFile->getPath());
  1801. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1802. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1803. }
  1804. if (!$this->configFile->exists()) {
  1805. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1806. }
  1807. }
  1808. protected function execute(InputInterface $input, OutputInterface $output)
  1809. {
  1810. if ($input->getOption('editor')) {
  1811. $editor = escapeshellcmd(getenv('EDITOR'));
  1812. if (!$editor) {
  1813. if (Platform::isWindows()) {
  1814. $editor = 'notepad';
  1815. } else {
  1816. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1817. if (exec('which '.$candidate)) {
  1818. $editor = $candidate;
  1819. break;
  1820. }
  1821. }
  1822. }
  1823. }
  1824. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1825. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1826. return 0;
  1827. }
  1828. if (!$input->getOption('global')) {
  1829. $this->config->merge($this->configFile->read());
  1830. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1831. }
  1832. if ($input->getOption('list')) {
  1833. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1834. return 0;
  1835. }
  1836. $settingKey = $input->getArgument('setting-key');
  1837. if (!$settingKey) {
  1838. return 0;
  1839. }
  1840. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1841. throw new \RuntimeException('You can not combine a setting value with --unset');
  1842. }
  1843. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1844. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1845. $rawData = $this->configFile->read();
  1846. $data = $this->config->all();
  1847. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1848. if (!isset($matches[1]) || $matches[1] === '') {
  1849. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1850. } else {
  1851. if (!isset($data['repositories'][$matches[1]])) {
  1852. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1853. }
  1854. $value = $data['repositories'][$matches[1]];
  1855. }
  1856. } elseif (strpos($settingKey, '.')) {
  1857. $bits = explode('.', $settingKey);
  1858. if ($bits[0] === 'extra') {
  1859. $data = $rawData;
  1860. } else {
  1861. $data = $data['config'];
  1862. }
  1863. $match = false;
  1864. foreach ($bits as $bit) {
  1865. $key = isset($key) ? $key.'.'.$bit : $bit;
  1866. $match = false;
  1867. if (isset($data[$key])) {
  1868. $match = true;
  1869. $data = $data[$key];
  1870. unset($key);
  1871. }
  1872. }
  1873. if (!$match) {
  1874. throw new \RuntimeException($settingKey.' is not defined.');
  1875. }
  1876. $value = $data;
  1877. } elseif (isset($data['config'][$settingKey])) {
  1878. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1879. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1880. $value = $rawData[$settingKey];
  1881. } else {
  1882. throw new \RuntimeException($settingKey.' is not defined');
  1883. }
  1884. if (is_array($value)) {
  1885. $value = json_encode($value);
  1886. }
  1887. $this->getIO()->write($value, true, IOInterface::QUIET);
  1888. return 0;
  1889. }
  1890. $values = $input->getArgument('setting-value');
  1891. $booleanValidator = function ($val) {
  1892. return in_array($val, array('true', 'false', '1', '0'), true);
  1893. };
  1894. $booleanNormalizer = function ($val) {
  1895. return $val !== 'false' && (bool) $val;
  1896. };
  1897. $uniqueConfigValues = array(
  1898. 'process-timeout' => array('is_numeric', 'intval'),
  1899. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1900. 'preferred-install' => array(
  1901. function ($val) {
  1902. return in_array($val, array('auto', 'source', 'dist'), true);
  1903. },
  1904. function ($val) {
  1905. return $val;
  1906. },
  1907. ),
  1908. 'store-auths' => array(
  1909. function ($val) {
  1910. return in_array($val, array('true', 'false', 'prompt'), true);
  1911. },
  1912. function ($val) {
  1913. if ('prompt' === $val) {
  1914. return 'prompt';
  1915. }
  1916. return $val !== 'false' && (bool) $val;
  1917. },
  1918. ),
  1919. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1920. 'vendor-dir' => array('is_string', function ($val) {
  1921. return $val;
  1922. }),
  1923. 'bin-dir' => array('is_string', function ($val) {
  1924. return $val;
  1925. }),
  1926. 'archive-dir' => array('is_string', function ($val) {
  1927. return $val;
  1928. }),
  1929. 'archive-format' => array('is_string', function ($val) {
  1930. return $val;
  1931. }),
  1932. 'data-dir' => array('is_string', function ($val) {
  1933. return $val;
  1934. }),
  1935. 'cache-dir' => array('is_string', function ($val) {
  1936. return $val;
  1937. }),
  1938. 'cache-files-dir' => array('is_string', function ($val) {
  1939. return $val;
  1940. }),
  1941. 'cache-repo-dir' => array('is_string', function ($val) {
  1942. return $val;
  1943. }),
  1944. 'cache-vcs-dir' => array('is_string', function ($val) {
  1945. return $val;
  1946. }),
  1947. 'cache-ttl' => array('is_numeric', 'intval'),
  1948. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1949. 'cache-files-maxsize' => array(
  1950. function ($val) {
  1951. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1952. },
  1953. function ($val) {
  1954. return $val;
  1955. },
  1956. ),
  1957. 'bin-compat' => array(
  1958. function ($val) {
  1959. return in_array($val, array('auto', 'full'));
  1960. },
  1961. function ($val) {
  1962. return $val;
  1963. },
  1964. ),
  1965. 'discard-changes' => array(
  1966. function ($val) {
  1967. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1968. },
  1969. function ($val) {
  1970. if ('stash' === $val) {
  1971. return 'stash';
  1972. }
  1973. return $val !== 'false' && (bool) $val;
  1974. },
  1975. ),
  1976. 'autoloader-suffix' => array('is_string', function ($val) {
  1977. return $val === 'null' ? null : $val;
  1978. }),
  1979. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1980. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1981. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1982. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1983. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1984. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1985. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1986. 'cafile' => array(
  1987. function ($val) {
  1988. return file_exists($val) && is_readable($val);
  1989. },
  1990. function ($val) {
  1991. return $val === 'null' ? null : $val;
  1992. },
  1993. ),
  1994. 'capath' => array(
  1995. function ($val) {
  1996. return is_dir($val) && is_readable($val);
  1997. },
  1998. function ($val) {
  1999. return $val === 'null' ? null : $val;
  2000. },
  2001. ),
  2002. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2003. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2004. );
  2005. $multiConfigValues = array(
  2006. 'github-protocols' => array(
  2007. function ($vals) {
  2008. if (!is_array($vals)) {
  2009. return 'array expected';
  2010. }
  2011. foreach ($vals as $val) {
  2012. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2013. return 'valid protocols include: git, https, ssh';
  2014. }
  2015. }
  2016. return true;
  2017. },
  2018. function ($vals) {
  2019. return $vals;
  2020. },
  2021. ),
  2022. 'github-domains' => array(
  2023. function ($vals) {
  2024. if (!is_array($vals)) {
  2025. return 'array expected';
  2026. }
  2027. return true;
  2028. },
  2029. function ($vals) {
  2030. return $vals;
  2031. },
  2032. ),
  2033. 'gitlab-domains' => array(
  2034. function ($vals) {
  2035. if (!is_array($vals)) {
  2036. return 'array expected';
  2037. }
  2038. return true;
  2039. },
  2040. function ($vals) {
  2041. return $vals;
  2042. },
  2043. ),
  2044. );
  2045. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2046. return $this->configSource->removeConfigSetting($settingKey);
  2047. }
  2048. if (isset($uniqueConfigValues[$settingKey])) {
  2049. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2050. }
  2051. if (isset($multiConfigValues[$settingKey])) {
  2052. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2053. }
  2054. $uniqueProps = array(
  2055. 'name' => array('is_string', function ($val) {
  2056. return $val;
  2057. }),
  2058. 'type' => array('is_string', function ($val) {
  2059. return $val;
  2060. }),
  2061. 'description' => array('is_string', function ($val) {
  2062. return $val;
  2063. }),
  2064. 'homepage' => array('is_string', function ($val) {
  2065. return $val;
  2066. }),
  2067. 'version' => array('is_string', function ($val) {
  2068. return $val;
  2069. }),
  2070. 'minimum-stability' => array(
  2071. function ($val) {
  2072. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2073. },
  2074. function ($val) {
  2075. return VersionParser::normalizeStability($val);
  2076. },
  2077. ),
  2078. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2079. );
  2080. $multiProps = array(
  2081. 'keywords' => array(
  2082. function ($vals) {
  2083. if (!is_array($vals)) {
  2084. return 'array expected';
  2085. }
  2086. return true;
  2087. },
  2088. function ($vals) {
  2089. return $vals;
  2090. },
  2091. ),
  2092. 'license' => array(
  2093. function ($vals) {
  2094. if (!is_array($vals)) {
  2095. return 'array expected';
  2096. }
  2097. return true;
  2098. },
  2099. function ($vals) {
  2100. return $vals;
  2101. },
  2102. ),
  2103. );
  2104. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2105. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2106. }
  2107. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2108. return $this->configSource->removeProperty($settingKey);
  2109. }
  2110. if (isset($uniqueProps[$settingKey])) {
  2111. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2112. }
  2113. if (isset($multiProps[$settingKey])) {
  2114. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2115. }
  2116. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2117. if ($input->getOption('unset')) {
  2118. return $this->configSource->removeRepository($matches[1]);
  2119. }
  2120. if (2 === count($values)) {
  2121. return $this->configSource->addRepository($matches[1], array(
  2122. 'type' => $values[0],
  2123. 'url' => $values[1],
  2124. ));
  2125. }
  2126. if (1 === count($values)) {
  2127. $value = strtolower($values[0]);
  2128. if (true === $booleanValidator($value)) {
  2129. if (false === $booleanNormalizer($value)) {
  2130. return $this->configSource->addRepository($matches[1], false);
  2131. }
  2132. } else {
  2133. $value = JsonFile::parseJson($values[0]);
  2134. return $this->configSource->addRepository($matches[1], $value);
  2135. }
  2136. }
  2137. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2138. }
  2139. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2140. if ($input->getOption('unset')) {
  2141. return $this->configSource->removeProperty($settingKey);
  2142. }
  2143. return $this->configSource->addProperty($settingKey, $values[0]);
  2144. }
  2145. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2146. if ($input->getOption('unset')) {
  2147. return $this->configSource->removeConfigSetting($settingKey);
  2148. }
  2149. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2150. }
  2151. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2152. return $this->configSource->removeConfigSetting($settingKey);
  2153. }
  2154. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2155. if ($input->getOption('unset')) {
  2156. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2157. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2158. return;
  2159. }
  2160. if ($matches[1] === 'bitbucket-oauth') {
  2161. if (2 !== count($values)) {
  2162. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2163. }
  2164. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2165. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2166. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2167. if (1 !== count($values)) {
  2168. throw new \RuntimeException('Too many arguments, expected only one token');
  2169. }
  2170. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2171. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2172. } elseif ($matches[1] === 'http-basic') {
  2173. if (2 !== count($values)) {
  2174. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2175. }
  2176. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2177. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2178. }
  2179. return;
  2180. }
  2181. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2182. if ($input->getOption('unset')) {
  2183. return $this->configSource->removeProperty($settingKey);
  2184. }
  2185. return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2186. }
  2187. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2188. }
  2189. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2190. {
  2191. list($validator, $normalizer) = $callbacks;
  2192. if (1 !== count($values)) {
  2193. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2194. }
  2195. if (true !== $validation = $validator($values[0])) {
  2196. throw new \RuntimeException(sprintf(
  2197. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2198. $values[0]
  2199. ));
  2200. }
  2201. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2202. }
  2203. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2204. {
  2205. list($validator, $normalizer) = $callbacks;
  2206. if (true !== $validation = $validator($values)) {
  2207. throw new \RuntimeException(sprintf(
  2208. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2209. json_encode($values)
  2210. ));
  2211. }
  2212. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2213. }
  2214. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2215. {
  2216. $origK = $k;
  2217. $io = $this->getIO();
  2218. foreach ($contents as $key => $value) {
  2219. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2220. continue;
  2221. }
  2222. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2223. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2224. $k .= preg_replace('{^config\.}', '', $key . '.');
  2225. $this->listConfiguration($value, $rawVal, $output, $k);
  2226. $k = $origK;
  2227. continue;
  2228. }
  2229. if (is_array($value)) {
  2230. $value = array_map(function ($val) {
  2231. return is_array($val) ? json_encode($val) : $val;
  2232. }, $value);
  2233. $value = '['.implode(', ', $value).']';
  2234. }
  2235. if (is_bool($value)) {
  2236. $value = var_export($value, true);
  2237. }
  2238. if (is_string($rawVal) && $rawVal != $value) {
  2239. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2240. } else {
  2241. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2242. }
  2243. }
  2244. }
  2245. }
  2246. <?php
  2247. namespace Composer\Command;
  2248. use Composer\Config;
  2249. use Composer\Factory;
  2250. use Composer\Installer;
  2251. use Composer\Installer\ProjectInstaller;
  2252. use Composer\Installer\InstallationManager;
  2253. use Composer\Installer\SuggestedPackagesReporter;
  2254. use Composer\IO\IOInterface;
  2255. use Composer\Package\BasePackage;
  2256. use Composer\DependencyResolver\Pool;
  2257. use Composer\DependencyResolver\Operation\InstallOperation;
  2258. use Composer\Package\Version\VersionSelector;
  2259. use Composer\Package\AliasPackage;
  2260. use Composer\Repository\RepositoryFactory;
  2261. use Composer\Repository\CompositeRepository;
  2262. use Composer\Repository\PlatformRepository;
  2263. use Composer\Repository\InstalledFilesystemRepository;
  2264. use Composer\Script\ScriptEvents;
  2265. use Composer\Util\Silencer;
  2266. use Symfony\Component\Console\Input\InputArgument;
  2267. use Symfony\Component\Console\Input\InputInterface;
  2268. use Symfony\Component\Console\Input\InputOption;
  2269. use Symfony\Component\Console\Output\OutputInterface;
  2270. use Symfony\Component\Finder\Finder;
  2271. use Composer\Json\JsonFile;
  2272. use Composer\Config\JsonConfigSource;
  2273. use Composer\Util\Filesystem;
  2274. use Composer\Package\Version\VersionParser;
  2275. class CreateProjectCommand extends BaseCommand
  2276. {
  2277. protected $suggestedPackagesReporter;
  2278. protected function configure()
  2279. {
  2280. $this
  2281. ->setName('create-project')
  2282. ->setDescription('Creates new project from a package into given directory.')
  2283. ->setDefinition(array(
  2284. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2285. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2286. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2287. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2288. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2289. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2290. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2291. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2292. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2293. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2294. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2295. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2296. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2297. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2298. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2299. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2300. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2301. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2302. ))
  2303. ->setHelp(
  2304. <<<EOT
  2305. The <info>create-project</info> command creates a new project from a given
  2306. package into a new directory. If executed without params and in a directory
  2307. with a composer.json file it installs the packages for the current project.
  2308. You can use this command to bootstrap new projects or setup a clean
  2309. version-controlled installation for developers of your project.
  2310. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2311. You can also specify the version with the package name using = or : as separator.
  2312. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2313. To install unstable packages, either specify the version you want, or use the
  2314. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2315. To setup a developer workable version you should create the project using the source
  2316. controlled code by appending the <info>'--prefer-source'</info> flag.
  2317. To install a package from another repository than the default one you
  2318. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2319. EOT
  2320. )
  2321. ;
  2322. }
  2323. protected function execute(InputInterface $input, OutputInterface $output)
  2324. {
  2325. $config = Factory::createConfig();
  2326. $io = $this->getIO();
  2327. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2328. if ($input->getOption('dev')) {
  2329. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2330. }
  2331. if ($input->getOption('no-custom-installers')) {
  2332. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2333. $input->setOption('no-plugins', true);
  2334. }
  2335. return $this->installProject(
  2336. $io,
  2337. $config,
  2338. $input,
  2339. $input->getArgument('package'),
  2340. $input->getArgument('directory'),
  2341. $input->getArgument('version'),
  2342. $input->getOption('stability'),
  2343. $preferSource,
  2344. $preferDist,
  2345. !$input->getOption('no-dev'),
  2346. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2347. $input->getOption('no-plugins'),
  2348. $input->getOption('no-scripts'),
  2349. $input->getOption('no-progress'),
  2350. $input->getOption('no-install'),
  2351. $input->getOption('ignore-platform-reqs'),
  2352. !$input->getOption('no-secure-http')
  2353. );
  2354. }
  2355. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2356. {
  2357. $oldCwd = getcwd();
  2358. $io->loadConfiguration($config);
  2359. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2360. if ($packageName !== null) {
  2361. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2362. } else {
  2363. $installedFromVcs = false;
  2364. }
  2365. $composer = Factory::create($io, null, $disablePlugins);
  2366. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2367. $fs = new Filesystem();
  2368. if ($noScripts === false) {
  2369. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2370. }
  2371. $config = $composer->getConfig();
  2372. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2373. if ($noInstall === false) {
  2374. $installer = Installer::create($io, $composer);
  2375. $installer->setPreferSource($preferSource)
  2376. ->setPreferDist($preferDist)
  2377. ->setDevMode($installDevPackages)
  2378. ->setRunScripts(!$noScripts)
  2379. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2380. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2381. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2382. if ($disablePlugins) {
  2383. $installer->disablePlugins();
  2384. }
  2385. $status = $installer->run();
  2386. if (0 !== $status) {
  2387. return $status;
  2388. }
  2389. }
  2390. $hasVcs = $installedFromVcs;
  2391. if (
  2392. !$input->getOption('keep-vcs')
  2393. && $installedFromVcs
  2394. && (
  2395. $input->getOption('remove-vcs')
  2396. || !$io->isInteractive()
  2397. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2398. )
  2399. ) {
  2400. $finder = new Finder();
  2401. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2402. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2403. $finder->name($vcsName);
  2404. }
  2405. try {
  2406. $dirs = iterator_to_array($finder);
  2407. unset($finder);
  2408. foreach ($dirs as $dir) {
  2409. if (!$fs->removeDirectory($dir)) {
  2410. throw new \RuntimeException('Could not remove '.$dir);
  2411. }
  2412. }
  2413. } catch (\Exception $e) {
  2414. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2415. }
  2416. $hasVcs = false;
  2417. }
  2418. if (!$hasVcs) {
  2419. $package = $composer->getPackage();
  2420. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2421. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2422. foreach ($package->{'get'.$meta['method']}() as $link) {
  2423. if ($link->getPrettyConstraint() === 'self.version') {
  2424. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2425. }
  2426. }
  2427. }
  2428. }
  2429. if ($noScripts === false) {
  2430. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2431. }
  2432. chdir($oldCwd);
  2433. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2434. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2435. Silencer::call('rmdir', $vendorComposerDir);
  2436. $vendorDir = $config->get('vendor-dir');
  2437. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2438. Silencer::call('rmdir', $vendorDir);
  2439. }
  2440. }
  2441. return 0;
  2442. }
  2443. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2444. {
  2445. if (!$secureHttp) {
  2446. $config->merge(array('config' => array('secure-http' => false)));
  2447. }
  2448. if (null === $repository) {
  2449. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2450. } else {
  2451. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2452. }
  2453. $parser = new VersionParser();
  2454. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2455. $name = strtolower($requirements[0]['name']);
  2456. if (!$packageVersion && isset($requirements[0]['version'])) {
  2457. $packageVersion = $requirements[0]['version'];
  2458. }
  2459. if (null === $stability) {
  2460. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2461. $stability = $match[1];
  2462. } else {
  2463. $stability = VersionParser::parseStability($packageVersion);
  2464. }
  2465. }
  2466. $stability = VersionParser::normalizeStability($stability);
  2467. if (!isset(BasePackage::$stabilities[$stability])) {
  2468. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2469. }
  2470. $pool = new Pool($stability);
  2471. $pool->addRepository($sourceRepo);
  2472. $phpVersion = null;
  2473. $prettyPhpVersion = null;
  2474. if (!$ignorePlatformReqs) {
  2475. $platformOverrides = $config->get('platform') ?: array();
  2476. $platform = new PlatformRepository(array(), $platformOverrides);
  2477. $phpPackage = $platform->findPackage('php', '*');
  2478. $phpVersion = $phpPackage->getVersion();
  2479. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2480. }
  2481. $versionSelector = new VersionSelector($pool);
  2482. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2483. if (!$package) {
  2484. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2485. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2486. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2487. }
  2488. throw new \InvalidArgumentException($errorMessage .'.');
  2489. }
  2490. if (null === $directory) {
  2491. $parts = explode("/", $name, 2);
  2492. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2493. }
  2494. if (function_exists('pcntl_async_signals')) {
  2495. @mkdir($directory, 0777, true);
  2496. if ($realDir = realpath($directory)) {
  2497. pcntl_async_signals(true);
  2498. pcntl_signal(SIGINT, function () use ($realDir) {
  2499. $fs = new Filesystem();
  2500. $fs->removeDirectory($realDir);
  2501. exit(130);
  2502. });
  2503. }
  2504. }
  2505. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2506. if ($disablePlugins) {
  2507. $io->writeError('<info>Plugins have been disabled.</info>');
  2508. }
  2509. if ($package instanceof AliasPackage) {
  2510. $package = $package->getAliasOf();
  2511. }
  2512. $dm = $this->createDownloadManager($io, $config);
  2513. $dm->setPreferSource($preferSource)
  2514. ->setPreferDist($preferDist)
  2515. ->setOutputProgress(!$noProgress);
  2516. $projectInstaller = new ProjectInstaller($directory, $dm);
  2517. $im = $this->createInstallationManager();
  2518. $im->addInstaller($projectInstaller);
  2519. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2520. $im->notifyInstalls($io);
  2521. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2522. $installedFromVcs = 'source' === $package->getInstallationSource();
  2523. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2524. chdir($directory);
  2525. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2526. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2527. return $installedFromVcs;
  2528. }
  2529. protected function createDownloadManager(IOInterface $io, Config $config)
  2530. {
  2531. $factory = new Factory();
  2532. return $factory->createDownloadManager($io, $config);
  2533. }
  2534. protected function createInstallationManager()
  2535. {
  2536. return new InstallationManager();
  2537. }
  2538. }
  2539. <?php
  2540. namespace Composer\Command;
  2541. use Symfony\Component\Console\Input\InputInterface;
  2542. use Symfony\Component\Console\Output\OutputInterface;
  2543. class DependsCommand extends BaseDependencyCommand
  2544. {
  2545. protected function configure()
  2546. {
  2547. parent::configure();
  2548. $this
  2549. ->setName('depends')
  2550. ->setAliases(array('why'))
  2551. ->setDescription('Shows which packages cause the given package to be installed.')
  2552. ->setHelp(
  2553. <<<EOT
  2554. Displays detailed information about where a package is referenced.
  2555. <info>php composer.phar depends composer/composer</info>
  2556. EOT
  2557. )
  2558. ;
  2559. }
  2560. protected function execute(InputInterface $input, OutputInterface $output)
  2561. {
  2562. return parent::doExecute($input, $output, false);
  2563. }
  2564. }
  2565. <?php
  2566. namespace Composer\Command;
  2567. use Composer\Composer;
  2568. use Composer\Factory;
  2569. use Composer\Config;
  2570. use Composer\Downloader\TransportException;
  2571. use Composer\Repository\PlatformRepository;
  2572. use Composer\Plugin\CommandEvent;
  2573. use Composer\Plugin\PluginEvents;
  2574. use Composer\Util\ConfigValidator;
  2575. use Composer\Util\IniHelper;
  2576. use Composer\Util\ProcessExecutor;
  2577. use Composer\Util\RemoteFilesystem;
  2578. use Composer\Util\StreamContextFactory;
  2579. use Composer\SelfUpdate\Keys;
  2580. use Composer\SelfUpdate\Versions;
  2581. use Composer\IO\NullIO;
  2582. use Symfony\Component\Console\Input\InputInterface;
  2583. use Symfony\Component\Console\Output\OutputInterface;
  2584. class DiagnoseCommand extends BaseCommand
  2585. {
  2586. protected $rfs;
  2587. protected $process;
  2588. protected $exitCode = 0;
  2589. protected function configure()
  2590. {
  2591. $this
  2592. ->setName('diagnose')
  2593. ->setDescription('Diagnoses the system to identify common errors.')
  2594. ->setHelp(
  2595. <<<EOT
  2596. The <info>diagnose</info> command checks common errors to help debugging problems.
  2597. The process exit code will be 1 in case of warnings and 2 for errors.
  2598. EOT
  2599. )
  2600. ;
  2601. }
  2602. protected function execute(InputInterface $input, OutputInterface $output)
  2603. {
  2604. $composer = $this->getComposer(false);
  2605. $io = $this->getIO();
  2606. if ($composer) {
  2607. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2608. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2609. $io->write('Checking composer.json: ', false);
  2610. $this->outputResult($this->checkComposerSchema());
  2611. }
  2612. if ($composer) {
  2613. $config = $composer->getConfig();
  2614. } else {
  2615. $config = Factory::createConfig();
  2616. }
  2617. $config->merge(array('config' => array('secure-http' => false)));
  2618. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2619. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2620. $this->process = new ProcessExecutor($io);
  2621. $io->write('Checking platform settings: ', false);
  2622. $this->outputResult($this->checkPlatform());
  2623. $io->write('Checking git settings: ', false);
  2624. $this->outputResult($this->checkGit());
  2625. $io->write('Checking http connectivity to packagist: ', false);
  2626. $this->outputResult($this->checkHttp('http', $config));
  2627. $io->write('Checking https connectivity to packagist: ', false);
  2628. $this->outputResult($this->checkHttp('https', $config));
  2629. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2630. if (!empty($opts['http']['proxy'])) {
  2631. $io->write('Checking HTTP proxy: ', false);
  2632. $this->outputResult($this->checkHttpProxy());
  2633. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2634. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2635. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2636. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2637. }
  2638. if ($oauth = $config->get('github-oauth')) {
  2639. foreach ($oauth as $domain => $token) {
  2640. $io->write('Checking '.$domain.' oauth access: ', false);
  2641. $this->outputResult($this->checkGithubOauth($domain, $token));
  2642. }
  2643. } else {
  2644. $io->write('Checking github.com rate limit: ', false);
  2645. try {
  2646. $rate = $this->getGithubRateLimit('github.com');
  2647. if (!is_array($rate)) {
  2648. $this->outputResult($rate);
  2649. } elseif (10 > $rate['remaining']) {
  2650. $io->write('<warning>WARNING</warning>');
  2651. $io->write(sprintf(
  2652. '<comment>Github has a rate limit on their API. '
  2653. . 'You currently have <options=bold>%u</options=bold> '
  2654. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2655. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2656. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2657. $rate['remaining'],
  2658. $rate['limit']
  2659. ));
  2660. } else {
  2661. $this->outputResult(true);
  2662. }
  2663. } catch (\Exception $e) {
  2664. if ($e instanceof TransportException && $e->getCode() === 401) {
  2665. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2666. } else {
  2667. $this->outputResult($e);
  2668. }
  2669. }
  2670. }
  2671. $io->write('Checking disk free space: ', false);
  2672. $this->outputResult($this->checkDiskSpace($config));
  2673. if ('phar:' === substr(__FILE__, 0, 5)) {
  2674. $io->write('Checking pubkeys: ', false);
  2675. $this->outputResult($this->checkPubKeys($config));
  2676. $io->write('Checking composer version: ', false);
  2677. $this->outputResult($this->checkVersion($config));
  2678. }
  2679. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2680. $platformOverrides = $config->get('platform') ?: array();
  2681. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2682. $phpPkg = $platformRepo->findPackage('php', '*');
  2683. $phpVersion = $phpPkg->getPrettyVersion();
  2684. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2685. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2686. }
  2687. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2688. if (defined('PHP_BINARY')) {
  2689. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2690. }
  2691. return $this->exitCode;
  2692. }
  2693. private function checkComposerSchema()
  2694. {
  2695. $validator = new ConfigValidator($this->getIO());
  2696. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2697. if ($errors || $warnings) {
  2698. $messages = array(
  2699. 'error' => $errors,
  2700. 'warning' => $warnings,
  2701. );
  2702. $output = '';
  2703. foreach ($messages as $style => $msgs) {
  2704. foreach ($msgs as $msg) {
  2705. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2706. }
  2707. }
  2708. return rtrim($output);
  2709. }
  2710. return true;
  2711. }
  2712. private function checkGit()
  2713. {
  2714. $this->process->execute('git config color.ui', $output);
  2715. if (strtolower(trim($output)) === 'always') {
  2716. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2717. }
  2718. return true;
  2719. }
  2720. private function checkHttp($proto, Config $config)
  2721. {
  2722. $result = $this->checkConnectivity();
  2723. if ($result !== true) {
  2724. return $result;
  2725. }
  2726. $disableTls = false;
  2727. $result = array();
  2728. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2729. $disableTls = true;
  2730. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2731. }
  2732. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2733. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2734. }
  2735. try {
  2736. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2737. } catch (TransportException $e) {
  2738. if (false !== strpos($e->getMessage(), 'cafile')) {
  2739. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2740. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2741. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2742. } else {
  2743. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2744. }
  2745. }
  2746. if (count($result) > 0) {
  2747. return $result;
  2748. }
  2749. return true;
  2750. }
  2751. private function checkHttpProxy()
  2752. {
  2753. $result = $this->checkConnectivity();
  2754. if ($result !== true) {
  2755. return $result;
  2756. }
  2757. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2758. try {
  2759. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2760. $hash = reset($json['provider-includes']);
  2761. $hash = $hash['sha256'];
  2762. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2763. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2764. if (hash('sha256', $provider) !== $hash) {
  2765. return 'It seems that your proxy is modifying http traffic on the fly';
  2766. }
  2767. } catch (\Exception $e) {
  2768. return $e;
  2769. }
  2770. return true;
  2771. }
  2772. private function checkHttpProxyFullUriRequestParam()
  2773. {
  2774. $result = $this->checkConnectivity();
  2775. if ($result !== true) {
  2776. return $result;
  2777. }
  2778. $url = 'http://repo.packagist.org/packages.json';
  2779. try {
  2780. $this->rfs->getContents('packagist.org', $url, false);
  2781. } catch (TransportException $e) {
  2782. try {
  2783. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2784. } catch (TransportException $e) {
  2785. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2786. }
  2787. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2788. }
  2789. return true;
  2790. }
  2791. private function checkHttpsProxyFullUriRequestParam()
  2792. {
  2793. $result = $this->checkConnectivity();
  2794. if ($result !== true) {
  2795. return $result;
  2796. }
  2797. if (!extension_loaded('openssl')) {
  2798. return 'You need the openssl extension installed for this check';
  2799. }
  2800. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2801. try {
  2802. $this->rfs->getContents('github.com', $url, false);
  2803. } catch (TransportException $e) {
  2804. try {
  2805. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2806. } catch (TransportException $e) {
  2807. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2808. }
  2809. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2810. }
  2811. return true;
  2812. }
  2813. private function checkGithubOauth($domain, $token)
  2814. {
  2815. $result = $this->checkConnectivity();
  2816. if ($result !== true) {
  2817. return $result;
  2818. }
  2819. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2820. try {
  2821. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2822. return $this->rfs->getContents($domain, $url, false, array(
  2823. 'retry-auth-failure' => false,
  2824. )) ? true : 'Unexpected error';
  2825. } catch (\Exception $e) {
  2826. if ($e instanceof TransportException && $e->getCode() === 401) {
  2827. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2828. }
  2829. return $e;
  2830. }
  2831. }
  2832. private function getGithubRateLimit($domain, $token = null)
  2833. {
  2834. $result = $this->checkConnectivity();
  2835. if ($result !== true) {
  2836. return $result;
  2837. }
  2838. if ($token) {
  2839. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2840. }
  2841. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2842. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2843. $data = json_decode($json, true);
  2844. return $data['resources']['core'];
  2845. }
  2846. private function checkDiskSpace($config)
  2847. {
  2848. $minSpaceFree = 1024 * 1024;
  2849. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2850. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2851. ) {
  2852. return '<error>The disk hosting '.$dir.' is full</error>';
  2853. }
  2854. return true;
  2855. }
  2856. private function checkPubKeys($config)
  2857. {
  2858. $home = $config->get('home');
  2859. $errors = array();
  2860. $io = $this->getIO();
  2861. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2862. $io->write('');
  2863. }
  2864. if (file_exists($home.'/keys.tags.pub')) {
  2865. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2866. } else {
  2867. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2868. }
  2869. if (file_exists($home.'/keys.dev.pub')) {
  2870. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2871. } else {
  2872. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2873. }
  2874. if ($errors) {
  2875. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2876. }
  2877. return $errors ?: true;
  2878. }
  2879. private function checkVersion($config)
  2880. {
  2881. $result = $this->checkConnectivity();
  2882. if ($result !== true) {
  2883. return $result;
  2884. }
  2885. $versionsUtil = new Versions($config, $this->rfs);
  2886. $latest = $versionsUtil->getLatest();
  2887. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2888. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2889. }
  2890. return true;
  2891. }
  2892. private function outputResult($result)
  2893. {
  2894. $io = $this->getIO();
  2895. if (true === $result) {
  2896. $io->write('<info>OK</info>');
  2897. return;
  2898. }
  2899. $hadError = false;
  2900. $hadWarning = false;
  2901. if ($result instanceof \Exception) {
  2902. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2903. }
  2904. if (!$result) {
  2905. $hadError = true;
  2906. } else {
  2907. if (!is_array($result)) {
  2908. $result = array($result);
  2909. }
  2910. foreach ($result as $message) {
  2911. if (false !== strpos($message, '<error>')) {
  2912. $hadError = true;
  2913. } elseif (false !== strpos($message, '<warning>')) {
  2914. $hadWarning = true;
  2915. }
  2916. }
  2917. }
  2918. if ($hadError) {
  2919. $io->write('<error>FAIL</error>');
  2920. $this->exitCode = max($this->exitCode, 2);
  2921. } elseif ($hadWarning) {
  2922. $io->write('<warning>WARNING</warning>');
  2923. $this->exitCode = max($this->exitCode, 1);
  2924. }
  2925. if ($result) {
  2926. foreach ($result as $message) {
  2927. $io->write($message);
  2928. }
  2929. }
  2930. }
  2931. private function checkPlatform()
  2932. {
  2933. $output = '';
  2934. $out = function ($msg, $style) use (&$output) {
  2935. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2936. };
  2937. $errors = array();
  2938. $warnings = array();
  2939. $displayIniMessage = false;
  2940. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2941. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2942. if (!function_exists('json_decode')) {
  2943. $errors['json'] = true;
  2944. }
  2945. if (!extension_loaded('Phar')) {
  2946. $errors['phar'] = true;
  2947. }
  2948. if (!extension_loaded('filter')) {
  2949. $errors['filter'] = true;
  2950. }
  2951. if (!extension_loaded('hash')) {
  2952. $errors['hash'] = true;
  2953. }
  2954. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2955. $errors['iconv_mbstring'] = true;
  2956. }
  2957. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  2958. $errors['allow_url_fopen'] = true;
  2959. }
  2960. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2961. $errors['ioncube'] = ioncube_loader_version();
  2962. }
  2963. if (PHP_VERSION_ID < 50302) {
  2964. $errors['php'] = PHP_VERSION;
  2965. }
  2966. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2967. $warnings['php'] = PHP_VERSION;
  2968. }
  2969. if (!extension_loaded('openssl')) {
  2970. $errors['openssl'] = true;
  2971. }
  2972. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2973. $warnings['openssl_version'] = true;
  2974. }
  2975. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  2976. $warnings['apc_cli'] = true;
  2977. }
  2978. if (!extension_loaded('zlib')) {
  2979. $warnings['zlib'] = true;
  2980. }
  2981. ob_start();
  2982. phpinfo(INFO_GENERAL);
  2983. $phpinfo = ob_get_clean();
  2984. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2985. $configure = $match[1];
  2986. if (false !== strpos($configure, '--enable-sigchild')) {
  2987. $warnings['sigchild'] = true;
  2988. }
  2989. if (false !== strpos($configure, '--with-curlwrappers')) {
  2990. $warnings['curlwrappers'] = true;
  2991. }
  2992. }
  2993. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  2994. $warnings['xdebug_profile'] = true;
  2995. } elseif (extension_loaded('xdebug')) {
  2996. $warnings['xdebug_loaded'] = true;
  2997. }
  2998. if (!empty($errors)) {
  2999. foreach ($errors as $error => $current) {
  3000. switch ($error) {
  3001. case 'json':
  3002. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3003. $text .= "Install it or recompile php without --disable-json";
  3004. break;
  3005. case 'phar':
  3006. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3007. $text .= "Install it or recompile php without --disable-phar";
  3008. break;
  3009. case 'filter':
  3010. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3011. $text .= "Install it or recompile php without --disable-filter";
  3012. break;
  3013. case 'hash':
  3014. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3015. $text .= "Install it or recompile php without --disable-hash";
  3016. break;
  3017. case 'iconv_mbstring':
  3018. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3019. $text .= "Install either of them or recompile php without --disable-iconv";
  3020. break;
  3021. case 'unicode':
  3022. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3023. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3024. $text .= " detect_unicode = Off";
  3025. $displayIniMessage = true;
  3026. break;
  3027. case 'suhosin':
  3028. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3029. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  3030. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3031. $displayIniMessage = true;
  3032. break;
  3033. case 'php':
  3034. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3035. break;
  3036. case 'allow_url_fopen':
  3037. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3038. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3039. $text .= " allow_url_fopen = On";
  3040. $displayIniMessage = true;
  3041. break;
  3042. case 'ioncube':
  3043. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3044. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  3045. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3046. $displayIniMessage = true;
  3047. break;
  3048. case 'openssl':
  3049. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3050. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3051. break;
  3052. }
  3053. $out($text, 'error');
  3054. }
  3055. $output .= PHP_EOL;
  3056. }
  3057. if (!empty($warnings)) {
  3058. foreach ($warnings as $warning => $current) {
  3059. switch ($warning) {
  3060. case 'apc_cli':
  3061. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3062. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3063. $text .= " apc.enable_cli = Off";
  3064. $displayIniMessage = true;
  3065. break;
  3066. case 'zlib':
  3067. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3068. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3069. $displayIniMessage = true;
  3070. break;
  3071. case 'sigchild':
  3072. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3073. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3074. $text .= " https://bugs.php.net/bug.php?id=22999";
  3075. break;
  3076. case 'curlwrappers':
  3077. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3078. $text .= " Recompile it without this flag if possible";
  3079. break;
  3080. case 'php':
  3081. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3082. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3083. break;
  3084. case 'openssl_version':
  3085. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3086. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3087. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3088. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3089. break;
  3090. case 'xdebug_loaded':
  3091. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3092. $text .= " Disabling it when using Composer is recommended.";
  3093. break;
  3094. case 'xdebug_profile':
  3095. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3096. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3097. $text .= " xdebug.profiler_enabled = 0";
  3098. $displayIniMessage = true;
  3099. break;
  3100. }
  3101. $out($text, 'comment');
  3102. }
  3103. }
  3104. if ($displayIniMessage) {
  3105. $out($iniMessage, 'comment');
  3106. }
  3107. return !$warnings && !$errors ? true : $output;
  3108. }
  3109. private function checkConnectivity()
  3110. {
  3111. if (!ini_get('allow_url_fopen')) {
  3112. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3113. return $result;
  3114. }
  3115. return true;
  3116. }
  3117. }
  3118. <?php
  3119. namespace Composer\Command;
  3120. use Composer\Plugin\CommandEvent;
  3121. use Composer\Plugin\PluginEvents;
  3122. use Symfony\Component\Console\Input\InputInterface;
  3123. use Symfony\Component\Console\Input\InputOption;
  3124. use Symfony\Component\Console\Output\OutputInterface;
  3125. class DumpAutoloadCommand extends BaseCommand
  3126. {
  3127. protected function configure()
  3128. {
  3129. $this
  3130. ->setName('dump-autoload')
  3131. ->setAliases(array('dumpautoload'))
  3132. ->setDescription('Dumps the autoloader.')
  3133. ->setDefinition(array(
  3134. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3135. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3136. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3137. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3138. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3139. ))
  3140. ->setHelp(
  3141. <<<EOT
  3142. <info>php composer.phar dump-autoload</info>
  3143. EOT
  3144. )
  3145. ;
  3146. }
  3147. protected function execute(InputInterface $input, OutputInterface $output)
  3148. {
  3149. $composer = $this->getComposer();
  3150. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3151. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3152. $installationManager = $composer->getInstallationManager();
  3153. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3154. $package = $composer->getPackage();
  3155. $config = $composer->getConfig();
  3156. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3157. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3158. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3159. if ($authoritative) {
  3160. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>', false);
  3161. } elseif ($optimize) {
  3162. $this->getIO()->writeError('<info>Generating optimized autoload files</info>', false);
  3163. } else {
  3164. $this->getIO()->writeError('<info>Generating autoload files</info>', false);
  3165. }
  3166. $generator = $composer->getAutoloadGenerator();
  3167. $generator->setDevMode(!$input->getOption('no-dev'));
  3168. $generator->setClassMapAuthoritative($authoritative);
  3169. $generator->setApcu($apcu);
  3170. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3171. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3172. if ($authoritative) {
  3173. $this->getIO()->overwriteError('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3174. } elseif ($optimize) {
  3175. $this->getIO()->overwriteError('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3176. } else {
  3177. $this->getIO()->overwriteError('<info>Generated autoload files containing '. $numberOfClasses .' classes</info>');
  3178. }
  3179. }
  3180. }
  3181. <?php
  3182. namespace Composer\Command;
  3183. use Symfony\Component\Console\Input\InputInterface;
  3184. use Symfony\Component\Console\Input\InputOption;
  3185. use Symfony\Component\Console\Output\OutputInterface;
  3186. use Symfony\Component\Console\Input\InputArgument;
  3187. class ExecCommand extends BaseCommand
  3188. {
  3189. protected function configure()
  3190. {
  3191. $this
  3192. ->setName('exec')
  3193. ->setDescription('Executes a vendored binary/script.')
  3194. ->setDefinition(array(
  3195. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3196. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3197. new InputArgument(
  3198. 'args',
  3199. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3200. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3201. ),
  3202. ))
  3203. ;
  3204. }
  3205. protected function execute(InputInterface $input, OutputInterface $output)
  3206. {
  3207. $composer = $this->getComposer();
  3208. $binDir = $composer->getConfig()->get('bin-dir');
  3209. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3210. $bins = glob($binDir . '/*');
  3211. $bins = array_merge($bins, array_map(function ($e) {
  3212. return "$e (local)";
  3213. }, $composer->getPackage()->getBinaries()));
  3214. if (!$bins) {
  3215. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3216. }
  3217. $this->getIO()->write(
  3218. <<<EOT
  3219. <comment>Available binaries:</comment>
  3220. EOT
  3221. );
  3222. foreach ($bins as $bin) {
  3223. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3224. continue;
  3225. }
  3226. $previousBin = $bin;
  3227. $bin = basename($bin);
  3228. $this->getIO()->write(
  3229. <<<EOT
  3230. <info>- $bin</info>
  3231. EOT
  3232. );
  3233. }
  3234. return 0;
  3235. }
  3236. $binary = $input->getArgument('binary');
  3237. $dispatcher = $composer->getEventDispatcher();
  3238. $dispatcher->addListener('__exec_command', $binary);
  3239. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3240. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3241. }
  3242. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3243. }
  3244. }
  3245. <?php
  3246. namespace Composer\Command;
  3247. use Composer\Factory;
  3248. use Composer\Util\Filesystem;
  3249. use Symfony\Component\Console\Input\InputInterface;
  3250. use Symfony\Component\Console\Input\InputArgument;
  3251. use Symfony\Component\Console\Input\StringInput;
  3252. use Symfony\Component\Console\Output\OutputInterface;
  3253. class GlobalCommand extends BaseCommand
  3254. {
  3255. protected function configure()
  3256. {
  3257. $this
  3258. ->setName('global')
  3259. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3260. ->setDefinition(array(
  3261. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3262. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3263. ))
  3264. ->setHelp(
  3265. <<<EOT
  3266. Use this command as a wrapper to run other Composer commands
  3267. within the global context of COMPOSER_HOME.
  3268. You can use this to install CLI utilities globally, all you need
  3269. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3270. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3271. and /home/<user>/.composer on unix systems.
  3272. If your system uses freedesktop.org standards, then it will first check
  3273. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3274. Note: This path may vary depending on customizations to bin-dir in
  3275. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3276. EOT
  3277. )
  3278. ;
  3279. }
  3280. public function run(InputInterface $input, OutputInterface $output)
  3281. {
  3282. $tokens = preg_split('{\s+}', $input->__toString());
  3283. $args = array();
  3284. foreach ($tokens as $token) {
  3285. if ($token && $token[0] !== '-') {
  3286. $args[] = $token;
  3287. if (count($args) >= 2) {
  3288. break;
  3289. }
  3290. }
  3291. }
  3292. if (count($args) < 2) {
  3293. return parent::run($input, $output);
  3294. }
  3295. $config = Factory::createConfig();
  3296. $home = $config->get('home');
  3297. if (!is_dir($home)) {
  3298. $fs = new Filesystem();
  3299. $fs->ensureDirectoryExists($home);
  3300. if (!is_dir($home)) {
  3301. throw new \RuntimeException('Could not create home directory');
  3302. }
  3303. }
  3304. try {
  3305. chdir($home);
  3306. } catch (\Exception $e) {
  3307. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3308. }
  3309. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3310. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3311. $this->getApplication()->resetComposer();
  3312. return $this->getApplication()->run($input, $output);
  3313. }
  3314. public function isProxyCommand()
  3315. {
  3316. return true;
  3317. }
  3318. }
  3319. <?php
  3320. namespace Composer\Command;
  3321. use Composer\Package\CompletePackageInterface;
  3322. use Composer\Repository\RepositoryInterface;
  3323. use Composer\Repository\ArrayRepository;
  3324. use Composer\Repository\RepositoryFactory;
  3325. use Composer\Util\Platform;
  3326. use Composer\Util\ProcessExecutor;
  3327. use Symfony\Component\Console\Input\InputArgument;
  3328. use Symfony\Component\Console\Input\InputOption;
  3329. use Symfony\Component\Console\Input\InputInterface;
  3330. use Symfony\Component\Console\Output\OutputInterface;
  3331. class HomeCommand extends BaseCommand
  3332. {
  3333. protected function configure()
  3334. {
  3335. $this
  3336. ->setName('browse')
  3337. ->setAliases(array('home'))
  3338. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3339. ->setDefinition(array(
  3340. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3341. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3342. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3343. ))
  3344. ->setHelp(
  3345. <<<EOT
  3346. The home command opens or shows a package's repository URL or
  3347. homepage in your default browser.
  3348. To open the homepage by default, use -H or --homepage.
  3349. To show instead of open the repository or homepage URL, use -s or --show.
  3350. EOT
  3351. );
  3352. }
  3353. protected function execute(InputInterface $input, OutputInterface $output)
  3354. {
  3355. $repos = $this->initializeRepos();
  3356. $io = $this->getIO();
  3357. $return = 0;
  3358. $packages = $input->getArgument('packages');
  3359. if (!$packages) {
  3360. $io->writeError('No package specified, opening homepage for the root package');
  3361. $packages = array($this->getComposer()->getPackage()->getName());
  3362. }
  3363. foreach ($packages as $packageName) {
  3364. $handled = false;
  3365. $packageExists = false;
  3366. foreach ($repos as $repo) {
  3367. foreach ($repo->findPackages($packageName) as $package) {
  3368. $packageExists = true;
  3369. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3370. $handled = true;
  3371. break 2;
  3372. }
  3373. }
  3374. }
  3375. if (!$packageExists) {
  3376. $return = 1;
  3377. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3378. }
  3379. if (!$handled) {
  3380. $return = 1;
  3381. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3382. }
  3383. }
  3384. return $return;
  3385. }
  3386. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3387. {
  3388. $support = $package->getSupport();
  3389. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3390. if (!$url || $showHomepage) {
  3391. $url = $package->getHomepage();
  3392. }
  3393. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3394. return false;
  3395. }
  3396. if ($showOnly) {
  3397. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3398. } else {
  3399. $this->openBrowser($url);
  3400. }
  3401. return true;
  3402. }
  3403. private function openBrowser($url)
  3404. {
  3405. $url = ProcessExecutor::escape($url);
  3406. $process = new ProcessExecutor($this->getIO());
  3407. if (Platform::isWindows()) {
  3408. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3409. }
  3410. $linux = $process->execute('which xdg-open', $output);
  3411. $osx = $process->execute('which open', $output);
  3412. if (0 === $linux) {
  3413. $process->execute('xdg-open ' . $url, $output);
  3414. } elseif (0 === $osx) {
  3415. $process->execute('open ' . $url, $output);
  3416. } else {
  3417. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3418. }
  3419. }
  3420. private function initializeRepos()
  3421. {
  3422. $composer = $this->getComposer(false);
  3423. if ($composer) {
  3424. return array_merge(
  3425. array(new ArrayRepository(array($composer->getPackage()))),
  3426. array($composer->getRepositoryManager()->getLocalRepository()),
  3427. $composer->getRepositoryManager()->getRepositories()
  3428. );
  3429. }
  3430. return RepositoryFactory::defaultRepos($this->getIO());
  3431. }
  3432. }
  3433. <?php
  3434. namespace Composer\Command;
  3435. use Composer\DependencyResolver\Pool;
  3436. use Composer\Factory;
  3437. use Composer\Json\JsonFile;
  3438. use Composer\Package\BasePackage;
  3439. use Composer\Package\Version\VersionParser;
  3440. use Composer\Package\Version\VersionSelector;
  3441. use Composer\Repository\CompositeRepository;
  3442. use Composer\Repository\PlatformRepository;
  3443. use Composer\Repository\RepositoryFactory;
  3444. use Composer\Util\ProcessExecutor;
  3445. use Symfony\Component\Console\Input\ArrayInput;
  3446. use Symfony\Component\Console\Input\InputInterface;
  3447. use Symfony\Component\Console\Input\InputOption;
  3448. use Symfony\Component\Console\Output\OutputInterface;
  3449. use Symfony\Component\Process\ExecutableFinder;
  3450. use Symfony\Component\Process\Process;
  3451. class InitCommand extends BaseCommand
  3452. {
  3453. protected $repos;
  3454. private $gitConfig;
  3455. private $pools;
  3456. protected function configure()
  3457. {
  3458. $this
  3459. ->setName('init')
  3460. ->setDescription('Creates a basic composer.json file in current directory.')
  3461. ->setDefinition(array(
  3462. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3463. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3464. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3465. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3466. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3467. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3468. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3469. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3470. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3471. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3472. ))
  3473. ->setHelp(
  3474. <<<EOT
  3475. The <info>init</info> command creates a basic composer.json file
  3476. in the current directory.
  3477. <info>php composer.phar init</info>
  3478. EOT
  3479. )
  3480. ;
  3481. }
  3482. protected function execute(InputInterface $input, OutputInterface $output)
  3483. {
  3484. $io = $this->getIO();
  3485. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3486. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3487. if (isset($options['author'])) {
  3488. $options['authors'] = $this->formatAuthors($options['author']);
  3489. unset($options['author']);
  3490. }
  3491. $repositories = $input->getOption('repository');
  3492. if ($repositories) {
  3493. $config = Factory::createConfig($io);
  3494. foreach ($repositories as $repo) {
  3495. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3496. }
  3497. }
  3498. if (isset($options['stability'])) {
  3499. $options['minimum-stability'] = $options['stability'];
  3500. unset($options['stability']);
  3501. }
  3502. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3503. if (array() === $options['require']) {
  3504. $options['require'] = new \stdClass;
  3505. }
  3506. if (isset($options['require-dev'])) {
  3507. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3508. if (array() === $options['require-dev']) {
  3509. $options['require-dev'] = new \stdClass;
  3510. }
  3511. }
  3512. $file = new JsonFile(Factory::getComposerFile());
  3513. $json = $file->encode($options);
  3514. if ($input->isInteractive()) {
  3515. $io->writeError(array('', $json, ''));
  3516. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3517. $io->writeError('<error>Command aborted</error>');
  3518. return 1;
  3519. }
  3520. }
  3521. $file->write($options);
  3522. if ($input->isInteractive() && is_dir('.git')) {
  3523. $ignoreFile = realpath('.gitignore');
  3524. if (false === $ignoreFile) {
  3525. $ignoreFile = realpath('.') . '/.gitignore';
  3526. }
  3527. if (!$this->hasVendorIgnore($ignoreFile)) {
  3528. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3529. if ($io->askConfirmation($question, true)) {
  3530. $this->addVendorIgnore($ignoreFile);
  3531. }
  3532. }
  3533. }
  3534. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3535. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3536. $this->installDependencies($output);
  3537. }
  3538. }
  3539. protected function interact(InputInterface $input, OutputInterface $output)
  3540. {
  3541. $git = $this->getGitConfig();
  3542. $io = $this->getIO();
  3543. $formatter = $this->getHelperSet()->get('formatter');
  3544. $repositories = $input->getOption('repository');
  3545. if ($repositories) {
  3546. $config = Factory::createConfig($io);
  3547. $repos = array(new PlatformRepository);
  3548. foreach ($repositories as $repo) {
  3549. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3550. }
  3551. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3552. 'type' => 'composer',
  3553. 'url' => 'https://repo.packagist.org',
  3554. ));
  3555. $this->repos = new CompositeRepository($repos);
  3556. unset($repos, $config, $repositories);
  3557. }
  3558. $io->writeError(array(
  3559. '',
  3560. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3561. '',
  3562. ));
  3563. $io->writeError(array(
  3564. '',
  3565. 'This command will guide you through creating your composer.json config.',
  3566. '',
  3567. ));
  3568. $cwd = realpath(".");
  3569. if (!$name = $input->getOption('name')) {
  3570. $name = basename($cwd);
  3571. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3572. $name = strtolower($name);
  3573. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3574. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3575. } elseif (isset($git['github.user'])) {
  3576. $name = $git['github.user'] . '/' . $name;
  3577. } elseif (!empty($_SERVER['USERNAME'])) {
  3578. $name = $_SERVER['USERNAME'] . '/' . $name;
  3579. } elseif (!empty($_SERVER['USER'])) {
  3580. $name = $_SERVER['USER'] . '/' . $name;
  3581. } elseif (get_current_user()) {
  3582. $name = get_current_user() . '/' . $name;
  3583. } else {
  3584. $name .= '/' . $name;
  3585. }
  3586. $name = strtolower($name);
  3587. } else {
  3588. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3589. throw new \InvalidArgumentException(
  3590. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3591. );
  3592. }
  3593. }
  3594. $name = $io->askAndValidate(
  3595. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3596. function ($value) use ($name) {
  3597. if (null === $value) {
  3598. return $name;
  3599. }
  3600. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3601. throw new \InvalidArgumentException(
  3602. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3603. );
  3604. }
  3605. return $value;
  3606. },
  3607. null,
  3608. $name
  3609. );
  3610. $input->setOption('name', $name);
  3611. $description = $input->getOption('description') ?: false;
  3612. $description = $io->ask(
  3613. 'Description [<comment>'.$description.'</comment>]: ',
  3614. $description
  3615. );
  3616. $input->setOption('description', $description);
  3617. if (null === $author = $input->getOption('author')) {
  3618. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3619. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3620. } elseif (isset($git['user.name'])) {
  3621. $author_name = $git['user.name'];
  3622. }
  3623. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3624. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3625. } elseif (isset($git['user.email'])) {
  3626. $author_email = $git['user.email'];
  3627. }
  3628. if (isset($author_name) && isset($author_email)) {
  3629. $author = sprintf('%s <%s>', $author_name, $author_email);
  3630. }
  3631. }
  3632. $self = $this;
  3633. $author = $io->askAndValidate(
  3634. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3635. function ($value) use ($self, $author) {
  3636. if ($value === 'n' || $value === 'no') {
  3637. return;
  3638. }
  3639. $value = $value ?: $author;
  3640. $author = $self->parseAuthorString($value);
  3641. return sprintf('%s <%s>', $author['name'], $author['email']);
  3642. },
  3643. null,
  3644. $author
  3645. );
  3646. $input->setOption('author', $author);
  3647. $minimumStability = $input->getOption('stability') ?: null;
  3648. $minimumStability = $io->askAndValidate(
  3649. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3650. function ($value) use ($minimumStability) {
  3651. if (null === $value) {
  3652. return $minimumStability;
  3653. }
  3654. if (!isset(BasePackage::$stabilities[$value])) {
  3655. throw new \InvalidArgumentException(
  3656. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3657. implode(', ', array_keys(BasePackage::$stabilities))
  3658. );
  3659. }
  3660. return $value;
  3661. },
  3662. null,
  3663. $minimumStability
  3664. );
  3665. $input->setOption('stability', $minimumStability);
  3666. $type = $input->getOption('type') ?: false;
  3667. $type = $io->ask(
  3668. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3669. $type
  3670. );
  3671. $input->setOption('type', $type);
  3672. if (null === $license = $input->getOption('license')) {
  3673. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3674. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3675. }
  3676. }
  3677. $license = $io->ask(
  3678. 'License [<comment>'.$license.'</comment>]: ',
  3679. $license
  3680. );
  3681. $input->setOption('license', $license);
  3682. $io->writeError(array('', 'Define your dependencies.', ''));
  3683. $repos = $this->getRepos();
  3684. $preferredStability = $minimumStability ?: 'stable';
  3685. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3686. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3687. $require = $input->getOption('require');
  3688. $requirements = array();
  3689. if ($require || $io->askConfirmation($question, true)) {
  3690. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3691. }
  3692. $input->setOption('require', $requirements);
  3693. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3694. $requireDev = $input->getOption('require-dev');
  3695. $devRequirements = array();
  3696. if ($requireDev || $io->askConfirmation($question, true)) {
  3697. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3698. }
  3699. $input->setOption('require-dev', $devRequirements);
  3700. }
  3701. public function parseAuthorString($author)
  3702. {
  3703. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3704. if ($this->isValidEmail($match['email'])) {
  3705. return array(
  3706. 'name' => trim($match['name']),
  3707. 'email' => $match['email'],
  3708. );
  3709. }
  3710. }
  3711. throw new \InvalidArgumentException(
  3712. 'Invalid author string. Must be in the format: '.
  3713. 'John Smith <john@example.com>'
  3714. );
  3715. }
  3716. protected function findPackages($name)
  3717. {
  3718. return $this->getRepos()->search($name);
  3719. }
  3720. protected function getRepos()
  3721. {
  3722. if (!$this->repos) {
  3723. $this->repos = new CompositeRepository(array_merge(
  3724. array(new PlatformRepository),
  3725. RepositoryFactory::defaultRepos($this->getIO())
  3726. ));
  3727. }
  3728. return $this->repos;
  3729. }
  3730. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true)
  3731. {
  3732. if ($requires) {
  3733. $requires = $this->normalizeRequirements($requires);
  3734. $result = array();
  3735. $io = $this->getIO();
  3736. foreach ($requires as $requirement) {
  3737. if (!isset($requirement['version'])) {
  3738. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3739. $requirement['version'] = $version;
  3740. $requirement['name'] = $name;
  3741. $io->writeError(sprintf(
  3742. 'Using version <info>%s</info> for <info>%s</info>',
  3743. $requirement['version'],
  3744. $requirement['name']
  3745. ));
  3746. } else {
  3747. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev');
  3748. $requirement['name'] = $name;
  3749. }
  3750. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3751. }
  3752. return $result;
  3753. }
  3754. $versionParser = new VersionParser();
  3755. $io = $this->getIO();
  3756. while (null !== $package = $io->ask('Search for a package: ')) {
  3757. $matches = $this->findPackages($package);
  3758. if (count($matches)) {
  3759. $exactMatch = null;
  3760. $choices = array();
  3761. foreach ($matches as $position => $foundPackage) {
  3762. $abandoned = '';
  3763. if (isset($foundPackage['abandoned'])) {
  3764. if (is_string($foundPackage['abandoned'])) {
  3765. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3766. } else {
  3767. $replacement = 'No replacement was suggested';
  3768. }
  3769. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3770. }
  3771. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3772. if ($foundPackage['name'] === $package) {
  3773. $exactMatch = true;
  3774. break;
  3775. }
  3776. }
  3777. if (!$exactMatch) {
  3778. $io->writeError(array(
  3779. '',
  3780. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3781. '',
  3782. ));
  3783. $io->writeError($choices);
  3784. $io->writeError('');
  3785. $validator = function ($selection) use ($matches, $versionParser) {
  3786. if ('' === $selection) {
  3787. return false;
  3788. }
  3789. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3790. $package = $matches[(int) $selection];
  3791. return $package['name'];
  3792. }
  3793. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3794. if (isset($packageMatches['version'])) {
  3795. $versionParser->parseConstraints($packageMatches['version']);
  3796. return $packageMatches['name'].' '.$packageMatches['version'];
  3797. }
  3798. return $packageMatches['name'];
  3799. }
  3800. throw new \Exception('Not a valid selection');
  3801. };
  3802. $package = $io->askAndValidate(
  3803. 'Enter package # to add, or the complete package name if it is not listed: ',
  3804. $validator,
  3805. 3,
  3806. false
  3807. );
  3808. }
  3809. if (false !== $package && false === strpos($package, ' ')) {
  3810. $validator = function ($input) {
  3811. $input = trim($input);
  3812. return $input ?: false;
  3813. };
  3814. $constraint = $io->askAndValidate(
  3815. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3816. $validator,
  3817. 3,
  3818. false
  3819. );
  3820. if (false === $constraint) {
  3821. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3822. $io->writeError(sprintf(
  3823. 'Using version <info>%s</info> for <info>%s</info>',
  3824. $constraint,
  3825. $package
  3826. ));
  3827. }
  3828. $package .= ' '.$constraint;
  3829. }
  3830. if (false !== $package) {
  3831. $requires[] = $package;
  3832. }
  3833. }
  3834. }
  3835. return $requires;
  3836. }
  3837. protected function formatAuthors($author)
  3838. {
  3839. return array($this->parseAuthorString($author));
  3840. }
  3841. protected function formatRequirements(array $requirements)
  3842. {
  3843. $requires = array();
  3844. $requirements = $this->normalizeRequirements($requirements);
  3845. foreach ($requirements as $requirement) {
  3846. $requires[$requirement['name']] = $requirement['version'];
  3847. }
  3848. return $requires;
  3849. }
  3850. protected function getGitConfig()
  3851. {
  3852. if (null !== $this->gitConfig) {
  3853. return $this->gitConfig;
  3854. }
  3855. $finder = new ExecutableFinder();
  3856. $gitBin = $finder->find('git');
  3857. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  3858. $cmd = new Process(array($gitBin, 'config', '-l'));
  3859. } else {
  3860. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3861. }
  3862. $cmd->run();
  3863. if ($cmd->isSuccessful()) {
  3864. $this->gitConfig = array();
  3865. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3866. foreach ($matches as $match) {
  3867. $this->gitConfig[$match[1]] = $match[2];
  3868. }
  3869. return $this->gitConfig;
  3870. }
  3871. return $this->gitConfig = array();
  3872. }
  3873. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3874. {
  3875. if (!file_exists($ignoreFile)) {
  3876. return false;
  3877. }
  3878. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3879. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3880. foreach ($lines as $line) {
  3881. if (preg_match($pattern, $line)) {
  3882. return true;
  3883. }
  3884. }
  3885. return false;
  3886. }
  3887. protected function normalizeRequirements(array $requirements)
  3888. {
  3889. $parser = new VersionParser();
  3890. return $parser->parseNameVersionPairs($requirements);
  3891. }
  3892. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3893. {
  3894. $contents = "";
  3895. if (file_exists($ignoreFile)) {
  3896. $contents = file_get_contents($ignoreFile);
  3897. if ("\n" !== substr($contents, 0, -1)) {
  3898. $contents .= "\n";
  3899. }
  3900. }
  3901. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3902. }
  3903. protected function isValidEmail($email)
  3904. {
  3905. if (!function_exists('filter_var')) {
  3906. return true;
  3907. }
  3908. if (PHP_VERSION_ID < 50303) {
  3909. return true;
  3910. }
  3911. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3912. }
  3913. private function getPool(InputInterface $input, $minimumStability = null)
  3914. {
  3915. $key = $minimumStability ?: 'default';
  3916. if (!isset($this->pools[$key])) {
  3917. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3918. $pool->addRepository($this->getRepos());
  3919. }
  3920. return $this->pools[$key];
  3921. }
  3922. private function getMinimumStability(InputInterface $input)
  3923. {
  3924. if ($input->hasOption('stability')) {
  3925. return $input->getOption('stability') ?: 'stable';
  3926. }
  3927. $file = Factory::getComposerFile();
  3928. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3929. if (!empty($composer['minimum-stability'])) {
  3930. return $composer['minimum-stability'];
  3931. }
  3932. }
  3933. return 'stable';
  3934. }
  3935. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3936. {
  3937. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3938. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3939. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3940. $phpVersion = null;
  3941. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3942. }
  3943. if (!$package) {
  3944. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3945. throw new \InvalidArgumentException(sprintf(
  3946. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3947. $name,
  3948. $requiredVersion,
  3949. $phpVersion
  3950. ));
  3951. }
  3952. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3953. throw new \InvalidArgumentException(sprintf(
  3954. 'Could not find package %s in a version matching %s',
  3955. $name,
  3956. $requiredVersion
  3957. ));
  3958. }
  3959. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3960. throw new \InvalidArgumentException(sprintf(
  3961. 'Could not find package %s in any version matching your PHP version (%s)',
  3962. $name,
  3963. $phpVersion
  3964. ));
  3965. }
  3966. $similar = $this->findSimilar($name);
  3967. if ($similar) {
  3968. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3969. throw new \InvalidArgumentException(sprintf(
  3970. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3971. $name,
  3972. $this->getMinimumStability($input)
  3973. ));
  3974. }
  3975. throw new \InvalidArgumentException(sprintf(
  3976. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3977. $name,
  3978. implode("\n ", $similar)
  3979. ));
  3980. }
  3981. throw new \InvalidArgumentException(sprintf(
  3982. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  3983. $name,
  3984. $this->getMinimumStability($input)
  3985. ));
  3986. }
  3987. return array(
  3988. $package->getPrettyName(),
  3989. $versionSelector->findRecommendedRequireVersion($package),
  3990. );
  3991. }
  3992. private function findSimilar($package)
  3993. {
  3994. try {
  3995. $results = $this->repos->search($package);
  3996. } catch (\Exception $e) {
  3997. return array();
  3998. }
  3999. $similarPackages = array();
  4000. foreach ($results as $result) {
  4001. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4002. }
  4003. asort($similarPackages);
  4004. return array_keys(array_slice($similarPackages, 0, 5));
  4005. }
  4006. private function installDependencies($output)
  4007. {
  4008. try {
  4009. $installCommand = $this->getApplication()->find('install');
  4010. $installCommand->run(new ArrayInput(array()), $output);
  4011. } catch (\Exception $e) {
  4012. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4013. }
  4014. }
  4015. private function hasDependencies($options)
  4016. {
  4017. $requires = (array) $options['require'];
  4018. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4019. return !empty($requires) || !empty($devRequires);
  4020. }
  4021. }
  4022. <?php
  4023. namespace Composer\Command;
  4024. use Composer\Installer;
  4025. use Composer\Plugin\CommandEvent;
  4026. use Composer\Plugin\PluginEvents;
  4027. use Symfony\Component\Console\Input\InputInterface;
  4028. use Symfony\Component\Console\Input\InputOption;
  4029. use Symfony\Component\Console\Input\InputArgument;
  4030. use Symfony\Component\Console\Output\OutputInterface;
  4031. class InstallCommand extends BaseCommand
  4032. {
  4033. protected function configure()
  4034. {
  4035. $this
  4036. ->setName('install')
  4037. ->setAliases(array('i'))
  4038. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4039. ->setDefinition(array(
  4040. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4041. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4042. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4043. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4044. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4045. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4046. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4047. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4048. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4049. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4050. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4051. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4052. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4053. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4054. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4055. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4056. ))
  4057. ->setHelp(
  4058. <<<EOT
  4059. The <info>install</info> command reads the composer.lock file from
  4060. the current directory, processes it, and downloads and installs all the
  4061. libraries and dependencies outlined in that file. If the file does not
  4062. exist it will look for composer.json and do the same.
  4063. <info>php composer.phar install</info>
  4064. EOT
  4065. )
  4066. ;
  4067. }
  4068. protected function execute(InputInterface $input, OutputInterface $output)
  4069. {
  4070. $io = $this->getIO();
  4071. if ($args = $input->getArgument('packages')) {
  4072. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4073. return 1;
  4074. }
  4075. if ($input->getOption('no-custom-installers')) {
  4076. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4077. $input->setOption('no-plugins', true);
  4078. }
  4079. if ($input->getOption('dev')) {
  4080. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4081. }
  4082. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4083. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4084. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4085. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4086. $install = Installer::create($io, $composer);
  4087. $config = $composer->getConfig();
  4088. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4089. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4090. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4091. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4092. $install
  4093. ->setDryRun($input->getOption('dry-run'))
  4094. ->setVerbose($input->getOption('verbose'))
  4095. ->setPreferSource($preferSource)
  4096. ->setPreferDist($preferDist)
  4097. ->setDevMode(!$input->getOption('no-dev'))
  4098. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4099. ->setRunScripts(!$input->getOption('no-scripts'))
  4100. ->setSkipSuggest($input->getOption('no-suggest'))
  4101. ->setOptimizeAutoloader($optimize)
  4102. ->setClassMapAuthoritative($authoritative)
  4103. ->setApcuAutoloader($apcu)
  4104. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4105. ;
  4106. if ($input->getOption('no-plugins')) {
  4107. $install->disablePlugins();
  4108. }
  4109. return $install->run();
  4110. }
  4111. }
  4112. <?php
  4113. namespace Composer\Command;
  4114. use Composer\Json\JsonFile;
  4115. use Composer\Plugin\CommandEvent;
  4116. use Composer\Plugin\PluginEvents;
  4117. use Composer\Package\PackageInterface;
  4118. use Composer\Repository\RepositoryInterface;
  4119. use Symfony\Component\Console\Helper\Table;
  4120. use Symfony\Component\Console\Input\InputInterface;
  4121. use Symfony\Component\Console\Input\InputOption;
  4122. use Symfony\Component\Console\Output\OutputInterface;
  4123. class LicensesCommand extends BaseCommand
  4124. {
  4125. protected function configure()
  4126. {
  4127. $this
  4128. ->setName('licenses')
  4129. ->setDescription('Shows information about licenses of dependencies.')
  4130. ->setDefinition(array(
  4131. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4132. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4133. ))
  4134. ->setHelp(
  4135. <<<EOT
  4136. The license command displays detailed information about the licenses of
  4137. the installed dependencies.
  4138. EOT
  4139. )
  4140. ;
  4141. }
  4142. protected function execute(InputInterface $input, OutputInterface $output)
  4143. {
  4144. $composer = $this->getComposer();
  4145. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4146. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4147. $root = $composer->getPackage();
  4148. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4149. if ($input->getOption('no-dev')) {
  4150. $packages = $this->filterRequiredPackages($repo, $root);
  4151. } else {
  4152. $packages = $this->appendPackages($repo->getPackages(), array());
  4153. }
  4154. ksort($packages);
  4155. $io = $this->getIO();
  4156. switch ($format = $input->getOption('format')) {
  4157. case 'text':
  4158. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4159. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4160. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4161. $io->write('Dependencies:');
  4162. $io->write('');
  4163. $table = new Table($output);
  4164. $table->setStyle('compact');
  4165. $tableStyle = $table->getStyle();
  4166. $tableStyle->setVerticalBorderChar('');
  4167. $tableStyle->setCellRowContentFormat('%s ');
  4168. $table->setHeaders(array('Name', 'Version', 'License'));
  4169. foreach ($packages as $package) {
  4170. $table->addRow(array(
  4171. $package->getPrettyName(),
  4172. $package->getFullPrettyVersion(),
  4173. implode(', ', $package->getLicense()) ?: 'none',
  4174. ));
  4175. }
  4176. $table->render();
  4177. break;
  4178. case 'json':
  4179. $dependencies = array();
  4180. foreach ($packages as $package) {
  4181. $dependencies[$package->getPrettyName()] = array(
  4182. 'version' => $package->getFullPrettyVersion(),
  4183. 'license' => $package->getLicense(),
  4184. );
  4185. }
  4186. $io->write(JsonFile::encode(array(
  4187. 'name' => $root->getPrettyName(),
  4188. 'version' => $root->getFullPrettyVersion(),
  4189. 'license' => $root->getLicense(),
  4190. 'dependencies' => $dependencies,
  4191. )));
  4192. break;
  4193. default:
  4194. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4195. }
  4196. }
  4197. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4198. {
  4199. $requires = array_keys($package->getRequires());
  4200. $packageListNames = array_keys($bucket);
  4201. $packages = array_filter(
  4202. $repo->getPackages(),
  4203. function ($package) use ($requires, $packageListNames) {
  4204. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4205. }
  4206. );
  4207. $bucket = $this->appendPackages($packages, $bucket);
  4208. foreach ($packages as $package) {
  4209. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4210. }
  4211. return $bucket;
  4212. }
  4213. public function appendPackages(array $packages, array $bucket)
  4214. {
  4215. foreach ($packages as $package) {
  4216. $bucket[$package->getName()] = $package;
  4217. }
  4218. return $bucket;
  4219. }
  4220. }
  4221. <?php
  4222. namespace Composer\Command;
  4223. use Symfony\Component\Console\Input\InputInterface;
  4224. use Symfony\Component\Console\Input\InputArgument;
  4225. use Symfony\Component\Console\Input\ArrayInput;
  4226. use Symfony\Component\Console\Input\InputOption;
  4227. use Symfony\Component\Console\Output\OutputInterface;
  4228. class OutdatedCommand extends ShowCommand
  4229. {
  4230. protected function configure()
  4231. {
  4232. $this
  4233. ->setName('outdated')
  4234. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4235. ->setDefinition(array(
  4236. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4237. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4238. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4239. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4240. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4241. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4242. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4243. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4244. ))
  4245. ->setHelp(
  4246. <<<EOT
  4247. The outdated command is just a proxy for `composer show -l`
  4248. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4249. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4250. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4251. compatibility breaks according to semver, so upgrade when you can but it
  4252. may involve work.
  4253. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4254. EOT
  4255. )
  4256. ;
  4257. }
  4258. protected function execute(InputInterface $input, OutputInterface $output)
  4259. {
  4260. $args = array(
  4261. 'show',
  4262. '--latest' => true,
  4263. );
  4264. if (!$input->getOption('all')) {
  4265. $args['--outdated'] = true;
  4266. }
  4267. if ($input->getOption('direct')) {
  4268. $args['--direct'] = true;
  4269. }
  4270. if ($input->getArgument('package')) {
  4271. $args['package'] = $input->getArgument('package');
  4272. }
  4273. if ($input->getOption('strict')) {
  4274. $args['--strict'] = true;
  4275. }
  4276. if ($input->getOption('minor-only')) {
  4277. $args['--minor-only'] = true;
  4278. }
  4279. $args['--format'] = $input->getOption('format');
  4280. $args['--ignore'] = $input->getOption('ignore');
  4281. $input = new ArrayInput($args);
  4282. return $this->getApplication()->run($input, $output);
  4283. }
  4284. public function isProxyCommand()
  4285. {
  4286. return true;
  4287. }
  4288. }
  4289. <?php
  4290. namespace Composer\Command;
  4291. use Symfony\Component\Console\Input\InputInterface;
  4292. use Symfony\Component\Console\Output\OutputInterface;
  4293. class ProhibitsCommand extends BaseDependencyCommand
  4294. {
  4295. protected function configure()
  4296. {
  4297. parent::configure();
  4298. $this
  4299. ->setName('prohibits')
  4300. ->setAliases(array('why-not'))
  4301. ->setDescription('Shows which packages prevent the given package from being installed.')
  4302. ->setHelp(
  4303. <<<EOT
  4304. Displays detailed information about why a package cannot be installed.
  4305. <info>php composer.phar prohibits composer/composer</info>
  4306. EOT
  4307. )
  4308. ;
  4309. }
  4310. protected function execute(InputInterface $input, OutputInterface $output)
  4311. {
  4312. return parent::doExecute($input, $output, true);
  4313. }
  4314. }
  4315. <?php
  4316. namespace Composer\Command;
  4317. use Composer\Config\JsonConfigSource;
  4318. use Composer\Installer;
  4319. use Composer\Plugin\CommandEvent;
  4320. use Composer\Plugin\PluginEvents;
  4321. use Composer\Json\JsonFile;
  4322. use Composer\Factory;
  4323. use Symfony\Component\Console\Input\InputInterface;
  4324. use Symfony\Component\Console\Input\InputOption;
  4325. use Symfony\Component\Console\Input\InputArgument;
  4326. use Symfony\Component\Console\Output\OutputInterface;
  4327. use Composer\Package\BasePackage;
  4328. class RemoveCommand extends BaseCommand
  4329. {
  4330. protected function configure()
  4331. {
  4332. $this
  4333. ->setName('remove')
  4334. ->setDescription('Removes a package from the require or require-dev.')
  4335. ->setDefinition(array(
  4336. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4337. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4338. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4339. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4340. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4341. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4342. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4343. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4344. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4345. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4346. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4347. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4348. ))
  4349. ->setHelp(
  4350. <<<EOT
  4351. The <info>remove</info> command removes a package from the current
  4352. list of installed packages
  4353. <info>php composer.phar remove</info>
  4354. EOT
  4355. )
  4356. ;
  4357. }
  4358. protected function execute(InputInterface $input, OutputInterface $output)
  4359. {
  4360. $packages = $input->getArgument('packages');
  4361. $packages = array_map('strtolower', $packages);
  4362. $file = Factory::getComposerFile();
  4363. $jsonFile = new JsonFile($file);
  4364. $composer = $jsonFile->read();
  4365. $composerBackup = file_get_contents($jsonFile->getPath());
  4366. $json = new JsonConfigSource($jsonFile);
  4367. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4368. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4369. $io = $this->getIO();
  4370. if ($input->getOption('update-with-dependencies')) {
  4371. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4372. }
  4373. foreach (array('require', 'require-dev') as $linkType) {
  4374. if (isset($composer[$linkType])) {
  4375. foreach ($composer[$linkType] as $name => $version) {
  4376. $composer[$linkType][strtolower($name)] = $name;
  4377. }
  4378. }
  4379. }
  4380. foreach ($packages as $package) {
  4381. if (isset($composer[$type][$package])) {
  4382. $json->removeLink($type, $composer[$type][$package]);
  4383. } elseif (isset($composer[$altType][$package])) {
  4384. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4385. if ($io->isInteractive()) {
  4386. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4387. $json->removeLink($altType, $composer[$altType][$package]);
  4388. }
  4389. }
  4390. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4391. foreach ($matches as $matchedPackage) {
  4392. $json->removeLink($type, $matchedPackage);
  4393. }
  4394. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4395. foreach ($matches as $matchedPackage) {
  4396. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4397. if ($io->isInteractive()) {
  4398. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4399. $json->removeLink($altType, $matchedPackage);
  4400. }
  4401. }
  4402. }
  4403. } else {
  4404. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4405. }
  4406. }
  4407. if ($input->getOption('no-update')) {
  4408. return 0;
  4409. }
  4410. $this->resetComposer();
  4411. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4412. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4413. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4414. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4415. $install = Installer::create($io, $composer);
  4416. $updateDevMode = !$input->getOption('update-no-dev');
  4417. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4418. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4419. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4420. $install
  4421. ->setVerbose($input->getOption('verbose'))
  4422. ->setDevMode($updateDevMode)
  4423. ->setOptimizeAutoloader($optimize)
  4424. ->setClassMapAuthoritative($authoritative)
  4425. ->setApcuAutoloader($apcu)
  4426. ->setUpdate(true)
  4427. ->setUpdateWhitelist($packages)
  4428. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4429. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4430. ->setRunScripts(!$input->getOption('no-scripts'))
  4431. ;
  4432. $status = $install->run();
  4433. if ($status !== 0) {
  4434. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4435. file_put_contents($jsonFile->getPath(), $composerBackup);
  4436. }
  4437. return $status;
  4438. }
  4439. }
  4440. <?php
  4441. namespace Composer\Command;
  4442. use Symfony\Component\Console\Input\InputInterface;
  4443. use Symfony\Component\Console\Input\InputArgument;
  4444. use Symfony\Component\Console\Input\InputOption;
  4445. use Symfony\Component\Console\Output\OutputInterface;
  4446. use Composer\Factory;
  4447. use Composer\Installer;
  4448. use Composer\Json\JsonFile;
  4449. use Composer\Json\JsonManipulator;
  4450. use Composer\Package\Version\VersionParser;
  4451. use Composer\Plugin\CommandEvent;
  4452. use Composer\Plugin\PluginEvents;
  4453. use Composer\Repository\CompositeRepository;
  4454. use Composer\Repository\PlatformRepository;
  4455. class RequireCommand extends InitCommand
  4456. {
  4457. private $newlyCreated;
  4458. private $json;
  4459. private $file;
  4460. private $composerBackup;
  4461. protected function configure()
  4462. {
  4463. $this
  4464. ->setName('require')
  4465. ->setDescription('Adds required packages to your composer.json and installs them.')
  4466. ->setDefinition(array(
  4467. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4468. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4469. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4470. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4471. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4472. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4473. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4474. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4475. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4476. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4477. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4478. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4479. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4480. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4481. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4482. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4483. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4484. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4485. ))
  4486. ->setHelp(
  4487. <<<EOT
  4488. The require command adds required packages to your composer.json and installs them.
  4489. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4490. matches to require.
  4491. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4492. If you do not want to install the new dependencies immediately you can call it with --no-update
  4493. EOT
  4494. )
  4495. ;
  4496. }
  4497. protected function execute(InputInterface $input, OutputInterface $output)
  4498. {
  4499. if (function_exists('pcntl_async_signals')) {
  4500. pcntl_async_signals(true);
  4501. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4502. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4503. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4504. }
  4505. $this->file = Factory::getComposerFile();
  4506. $io = $this->getIO();
  4507. $this->newlyCreated = !file_exists($this->file);
  4508. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4509. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4510. return 1;
  4511. }
  4512. if (!is_readable($this->file)) {
  4513. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4514. return 1;
  4515. }
  4516. if (!is_writable($this->file)) {
  4517. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4518. return 1;
  4519. }
  4520. if (filesize($this->file) === 0) {
  4521. file_put_contents($this->file, "{\n}\n");
  4522. }
  4523. $this->json = new JsonFile($this->file);
  4524. $this->composerBackup = file_get_contents($this->json->getPath());
  4525. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4526. $repos = $composer->getRepositoryManager()->getRepositories();
  4527. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4528. $this->repos = new CompositeRepository(array_merge(
  4529. array(new PlatformRepository(array(), $platformOverrides)),
  4530. $repos
  4531. ));
  4532. if ($composer->getPackage()->getPreferStable()) {
  4533. $preferredStability = 'stable';
  4534. } else {
  4535. $preferredStability = $composer->getPackage()->getMinimumStability();
  4536. }
  4537. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4538. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'));
  4539. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4540. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4541. $requirements = $this->formatRequirements($requirements);
  4542. $versionParser = new VersionParser();
  4543. foreach ($requirements as $constraint) {
  4544. $versionParser->parseConstraints($constraint);
  4545. }
  4546. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4547. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4548. $composerDefinition = $this->json->read();
  4549. foreach ($requirements as $package => $version) {
  4550. $composerDefinition[$requireKey][$package] = $version;
  4551. unset($composerDefinition[$removeKey][$package]);
  4552. }
  4553. $this->json->write($composerDefinition);
  4554. }
  4555. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4556. if ($input->getOption('no-update')) {
  4557. return 0;
  4558. }
  4559. $updateDevMode = !$input->getOption('update-no-dev');
  4560. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4561. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4562. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4563. $this->resetComposer();
  4564. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4565. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4566. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4567. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4568. $install = Installer::create($io, $composer);
  4569. $install
  4570. ->setVerbose($input->getOption('verbose'))
  4571. ->setPreferSource($input->getOption('prefer-source'))
  4572. ->setPreferDist($input->getOption('prefer-dist'))
  4573. ->setDevMode($updateDevMode)
  4574. ->setRunScripts(!$input->getOption('no-scripts'))
  4575. ->setSkipSuggest($input->getOption('no-suggest'))
  4576. ->setOptimizeAutoloader($optimize)
  4577. ->setClassMapAuthoritative($authoritative)
  4578. ->setApcuAutoloader($apcu)
  4579. ->setUpdate(true)
  4580. ->setUpdateWhitelist(array_keys($requirements))
  4581. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4582. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4583. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4584. ->setPreferStable($input->getOption('prefer-stable'))
  4585. ->setPreferLowest($input->getOption('prefer-lowest'))
  4586. ;
  4587. $status = $install->run();
  4588. if ($status !== 0) {
  4589. $this->revertComposerFile(false);
  4590. }
  4591. return $status;
  4592. }
  4593. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4594. {
  4595. $contents = file_get_contents($json->getPath());
  4596. $manipulator = new JsonManipulator($contents);
  4597. foreach ($new as $package => $constraint) {
  4598. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4599. return false;
  4600. }
  4601. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4602. return false;
  4603. }
  4604. }
  4605. file_put_contents($json->getPath(), $manipulator->getContents());
  4606. return true;
  4607. }
  4608. protected function interact(InputInterface $input, OutputInterface $output)
  4609. {
  4610. return;
  4611. }
  4612. public function revertComposerFile($hardExit = true)
  4613. {
  4614. $io = $this->getIO();
  4615. if ($this->newlyCreated) {
  4616. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4617. unlink($this->json->getPath());
  4618. } else {
  4619. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4620. file_put_contents($this->json->getPath(), $this->composerBackup);
  4621. }
  4622. if ($hardExit) {
  4623. exit(1);
  4624. }
  4625. }
  4626. }
  4627. <?php
  4628. namespace Composer\Command;
  4629. use Composer\Script\Event as ScriptEvent;
  4630. use Composer\Script\ScriptEvents;
  4631. use Composer\Util\ProcessExecutor;
  4632. use Symfony\Component\Console\Input\InputInterface;
  4633. use Symfony\Component\Console\Input\InputOption;
  4634. use Symfony\Component\Console\Input\InputArgument;
  4635. use Symfony\Component\Console\Output\OutputInterface;
  4636. use Symfony\Component\Console\Helper\Table;
  4637. class RunScriptCommand extends BaseCommand
  4638. {
  4639. protected $scriptEvents = array(
  4640. ScriptEvents::PRE_INSTALL_CMD,
  4641. ScriptEvents::POST_INSTALL_CMD,
  4642. ScriptEvents::PRE_UPDATE_CMD,
  4643. ScriptEvents::POST_UPDATE_CMD,
  4644. ScriptEvents::PRE_STATUS_CMD,
  4645. ScriptEvents::POST_STATUS_CMD,
  4646. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4647. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4648. ScriptEvents::PRE_ARCHIVE_CMD,
  4649. ScriptEvents::POST_ARCHIVE_CMD,
  4650. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4651. ScriptEvents::POST_AUTOLOAD_DUMP,
  4652. );
  4653. protected function configure()
  4654. {
  4655. $this
  4656. ->setName('run-script')
  4657. ->setDescription('Runs the scripts defined in composer.json.')
  4658. ->setDefinition(array(
  4659. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4660. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4661. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4662. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4663. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4664. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4665. ))
  4666. ->setHelp(
  4667. <<<EOT
  4668. The <info>run-script</info> command runs scripts defined in composer.json:
  4669. <info>php composer.phar run-script post-update-cmd</info>
  4670. EOT
  4671. )
  4672. ;
  4673. }
  4674. protected function execute(InputInterface $input, OutputInterface $output)
  4675. {
  4676. if ($input->getOption('list')) {
  4677. return $this->listScripts($output);
  4678. } elseif (!$input->getArgument('script')) {
  4679. throw new \RuntimeException('Missing required argument "script"');
  4680. }
  4681. $script = $input->getArgument('script');
  4682. if (!in_array($script, $this->scriptEvents)) {
  4683. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4684. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4685. }
  4686. }
  4687. $composer = $this->getComposer();
  4688. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4689. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4690. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4691. if (!$hasListeners) {
  4692. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4693. }
  4694. $args = $input->getArgument('args');
  4695. if (null !== $timeout = $input->getOption('timeout')) {
  4696. if (!ctype_digit($timeout)) {
  4697. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4698. }
  4699. ProcessExecutor::setTimeout((int) $timeout);
  4700. }
  4701. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4702. }
  4703. protected function listScripts(OutputInterface $output)
  4704. {
  4705. $scripts = $this->getComposer()->getPackage()->getScripts();
  4706. if (!count($scripts)) {
  4707. return 0;
  4708. }
  4709. $io = $this->getIO();
  4710. $io->writeError('<info>scripts:</info>');
  4711. $table = array();
  4712. foreach ($scripts as $name => $script) {
  4713. $description = '';
  4714. try {
  4715. $cmd = $this->getApplication()->find($name);
  4716. if ($cmd instanceof ScriptAliasCommand) {
  4717. $description = $cmd->getDescription();
  4718. }
  4719. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4720. }
  4721. $table[] = array(' '.$name, $description);
  4722. }
  4723. $renderer = new Table($output);
  4724. $renderer->setStyle('compact');
  4725. $rendererStyle = $renderer->getStyle();
  4726. $rendererStyle->setVerticalBorderChar('');
  4727. $rendererStyle->setCellRowContentFormat('%s ');
  4728. $renderer->setRows($table)->render();
  4729. return 0;
  4730. }
  4731. }
  4732. <?php
  4733. namespace Composer\Command;
  4734. use Symfony\Component\Console\Input\InputInterface;
  4735. use Symfony\Component\Console\Input\InputOption;
  4736. use Symfony\Component\Console\Input\InputArgument;
  4737. use Symfony\Component\Console\Output\OutputInterface;
  4738. class ScriptAliasCommand extends BaseCommand
  4739. {
  4740. private $script;
  4741. private $description;
  4742. public function __construct($script, $description)
  4743. {
  4744. $this->script = $script;
  4745. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4746. parent::__construct();
  4747. }
  4748. protected function configure()
  4749. {
  4750. $this
  4751. ->setName($this->script)
  4752. ->setDescription($this->description)
  4753. ->setDefinition(array(
  4754. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4755. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4756. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4757. ))
  4758. ->setHelp(
  4759. <<<EOT
  4760. The <info>run-script</info> command runs scripts defined in composer.json:
  4761. <info>php composer.phar run-script post-update-cmd</info>
  4762. EOT
  4763. )
  4764. ;
  4765. }
  4766. protected function execute(InputInterface $input, OutputInterface $output)
  4767. {
  4768. $composer = $this->getComposer();
  4769. $args = $input->getArguments();
  4770. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4771. }
  4772. }
  4773. <?php
  4774. namespace Composer\Command;
  4775. use Composer\Factory;
  4776. use Symfony\Component\Console\Input\InputInterface;
  4777. use Symfony\Component\Console\Input\InputArgument;
  4778. use Symfony\Component\Console\Input\InputOption;
  4779. use Symfony\Component\Console\Output\OutputInterface;
  4780. use Composer\Repository\CompositeRepository;
  4781. use Composer\Repository\PlatformRepository;
  4782. use Composer\Repository\RepositoryInterface;
  4783. use Composer\Plugin\CommandEvent;
  4784. use Composer\Plugin\PluginEvents;
  4785. class SearchCommand extends BaseCommand
  4786. {
  4787. protected $matches;
  4788. protected $lowMatches = array();
  4789. protected $tokens;
  4790. protected $output;
  4791. protected $onlyName;
  4792. protected function configure()
  4793. {
  4794. $this
  4795. ->setName('search')
  4796. ->setDescription('Searches for packages.')
  4797. ->setDefinition(array(
  4798. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4799. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4800. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4801. ))
  4802. ->setHelp(
  4803. <<<EOT
  4804. The search command searches for packages by its name
  4805. <info>php composer.phar search symfony composer</info>
  4806. EOT
  4807. )
  4808. ;
  4809. }
  4810. protected function execute(InputInterface $input, OutputInterface $output)
  4811. {
  4812. $platformRepo = new PlatformRepository;
  4813. $io = $this->getIO();
  4814. if (!($composer = $this->getComposer(false))) {
  4815. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4816. }
  4817. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4818. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4819. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4820. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4821. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4822. $onlyName = $input->getOption('only-name');
  4823. $type = $input->getOption('type') ?: null;
  4824. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4825. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4826. foreach ($results as $result) {
  4827. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4828. }
  4829. }
  4830. }
  4831. <?php
  4832. namespace Composer\Command;
  4833. use Composer\Composer;
  4834. use Composer\Factory;
  4835. use Composer\Config;
  4836. use Composer\Util\Filesystem;
  4837. use Composer\SelfUpdate\Keys;
  4838. use Composer\SelfUpdate\Versions;
  4839. use Composer\IO\IOInterface;
  4840. use Composer\Downloader\FilesystemException;
  4841. use Symfony\Component\Console\Input\InputInterface;
  4842. use Symfony\Component\Console\Input\InputOption;
  4843. use Symfony\Component\Console\Input\InputArgument;
  4844. use Symfony\Component\Console\Output\OutputInterface;
  4845. use Symfony\Component\Finder\Finder;
  4846. class SelfUpdateCommand extends BaseCommand
  4847. {
  4848. const HOMEPAGE = 'getcomposer.org';
  4849. const OLD_INSTALL_EXT = '-old.phar';
  4850. protected function configure()
  4851. {
  4852. $this
  4853. ->setName('self-update')
  4854. ->setAliases(array('selfupdate'))
  4855. ->setDescription('Updates composer.phar to the latest version.')
  4856. ->setDefinition(array(
  4857. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4858. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4859. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4860. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4861. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4862. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4863. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4864. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4865. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4866. ))
  4867. ->setHelp(
  4868. <<<EOT
  4869. The <info>self-update</info> command checks getcomposer.org for newer
  4870. versions of composer and if found, installs the latest.
  4871. <info>php composer.phar self-update</info>
  4872. EOT
  4873. )
  4874. ;
  4875. }
  4876. protected function execute(InputInterface $input, OutputInterface $output)
  4877. {
  4878. $config = Factory::createConfig();
  4879. if ($config->get('disable-tls') === true) {
  4880. $baseUrl = 'http://' . self::HOMEPAGE;
  4881. } else {
  4882. $baseUrl = 'https://' . self::HOMEPAGE;
  4883. }
  4884. $io = $this->getIO();
  4885. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4886. $versionsUtil = new Versions($config, $remoteFilesystem);
  4887. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4888. if ($input->getOption($channel)) {
  4889. $versionsUtil->setChannel($channel);
  4890. }
  4891. }
  4892. if ($input->getOption('set-channel-only')) {
  4893. return 0;
  4894. }
  4895. $cacheDir = $config->get('cache-dir');
  4896. $rollbackDir = $config->get('data-dir');
  4897. $home = $config->get('home');
  4898. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4899. if ($input->getOption('update-keys')) {
  4900. return $this->fetchKeys($io, $config);
  4901. }
  4902. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4903. if (!is_writable($tmpDir)) {
  4904. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4905. }
  4906. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4907. $composeUser = posix_getpwuid(posix_geteuid());
  4908. $homeOwner = posix_getpwuid(fileowner($home));
  4909. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4910. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4911. }
  4912. }
  4913. if ($input->getOption('rollback')) {
  4914. return $this->rollback($output, $rollbackDir, $localFilename);
  4915. }
  4916. $latest = $versionsUtil->getLatest();
  4917. $latestVersion = $latest['version'];
  4918. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4919. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4920. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4921. return 1;
  4922. }
  4923. if (Composer::VERSION === $updateVersion) {
  4924. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4925. if ($input->getOption('clean-backups')) {
  4926. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4927. }
  4928. return 0;
  4929. }
  4930. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4931. $backupFile = sprintf(
  4932. '%s/%s-%s%s',
  4933. $rollbackDir,
  4934. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4935. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4936. self::OLD_INSTALL_EXT
  4937. );
  4938. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4939. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4940. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4941. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4942. $io->writeError(' ', false);
  4943. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4944. $io->writeError('');
  4945. if (!file_exists($tempFilename) || !$signature) {
  4946. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4947. return 1;
  4948. }
  4949. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4950. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4951. } else {
  4952. if (!extension_loaded('openssl')) {
  4953. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4954. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4955. }
  4956. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4957. if (!file_exists($sigFile)) {
  4958. file_put_contents(
  4959. $home.'/keys.dev.pub',
  4960. <<<DEVPUBKEY
  4961. -----BEGIN PUBLIC KEY-----
  4962. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4963. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4964. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4965. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4966. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4967. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4968. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4969. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4970. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4971. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4972. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4973. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4974. -----END PUBLIC KEY-----
  4975. DEVPUBKEY
  4976. );
  4977. file_put_contents(
  4978. $home.'/keys.tags.pub',
  4979. <<<TAGSPUBKEY
  4980. -----BEGIN PUBLIC KEY-----
  4981. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4982. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4983. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4984. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4985. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4986. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4987. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4988. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4989. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4990. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4991. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4992. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4993. -----END PUBLIC KEY-----
  4994. TAGSPUBKEY
  4995. );
  4996. }
  4997. $pubkeyid = openssl_pkey_get_public($sigFile);
  4998. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4999. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5000. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5001. }
  5002. $signature = json_decode($signature, true);
  5003. $signature = base64_decode($signature['sha384']);
  5004. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5005. openssl_free_key($pubkeyid);
  5006. if (!$verified) {
  5007. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  5008. }
  5009. }
  5010. if ($input->getOption('clean-backups')) {
  5011. $this->cleanBackups($rollbackDir);
  5012. }
  5013. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5014. @unlink($tempFilename);
  5015. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  5016. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5017. return 1;
  5018. }
  5019. if (file_exists($backupFile)) {
  5020. $io->writeError(sprintf(
  5021. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5022. Composer::VERSION
  5023. ));
  5024. } else {
  5025. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5026. }
  5027. }
  5028. protected function fetchKeys(IOInterface $io, Config $config)
  5029. {
  5030. if (!$io->isInteractive()) {
  5031. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5032. }
  5033. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5034. $validator = function ($value) {
  5035. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5036. throw new \UnexpectedValueException('Invalid input');
  5037. }
  5038. return trim($value)."\n";
  5039. };
  5040. $devKey = '';
  5041. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5042. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5043. while ($line = $io->ask('')) {
  5044. $devKey .= trim($line)."\n";
  5045. if (trim($line) === '-----END PUBLIC KEY-----') {
  5046. break;
  5047. }
  5048. }
  5049. }
  5050. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5051. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5052. $tagsKey = '';
  5053. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5054. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5055. while ($line = $io->ask('')) {
  5056. $tagsKey .= trim($line)."\n";
  5057. if (trim($line) === '-----END PUBLIC KEY-----') {
  5058. break;
  5059. }
  5060. }
  5061. }
  5062. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5063. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5064. $io->write('Public keys stored in '.$config->get('home'));
  5065. }
  5066. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5067. {
  5068. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5069. if (!$rollbackVersion) {
  5070. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5071. }
  5072. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5073. if (!is_file($oldFile)) {
  5074. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5075. }
  5076. if (!is_readable($oldFile)) {
  5077. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5078. }
  5079. $io = $this->getIO();
  5080. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5081. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  5082. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  5083. return 1;
  5084. }
  5085. return 0;
  5086. }
  5087. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5088. {
  5089. try {
  5090. @chmod($newFilename, fileperms($localFilename));
  5091. if (!ini_get('phar.readonly')) {
  5092. $phar = new \Phar($newFilename);
  5093. unset($phar);
  5094. }
  5095. if ($backupTarget && file_exists($localFilename)) {
  5096. @copy($localFilename, $backupTarget);
  5097. }
  5098. rename($newFilename, $localFilename);
  5099. return null;
  5100. } catch (\Exception $e) {
  5101. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5102. throw $e;
  5103. }
  5104. return $e;
  5105. }
  5106. }
  5107. protected function cleanBackups($rollbackDir, $except = null)
  5108. {
  5109. $finder = $this->getOldInstallationFinder($rollbackDir);
  5110. $io = $this->getIO();
  5111. $fs = new Filesystem;
  5112. foreach ($finder as $file) {
  5113. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5114. continue;
  5115. }
  5116. $file = (string) $file;
  5117. $io->writeError('<info>Removing: '.$file.'</info>');
  5118. $fs->remove($file);
  5119. }
  5120. }
  5121. protected function getLastBackupVersion($rollbackDir)
  5122. {
  5123. $finder = $this->getOldInstallationFinder($rollbackDir);
  5124. $finder->sortByName();
  5125. $files = iterator_to_array($finder);
  5126. if (count($files)) {
  5127. return basename(end($files), self::OLD_INSTALL_EXT);
  5128. }
  5129. return false;
  5130. }
  5131. protected function getOldInstallationFinder($rollbackDir)
  5132. {
  5133. $finder = Finder::create()
  5134. ->depth(0)
  5135. ->files()
  5136. ->name('*' . self::OLD_INSTALL_EXT)
  5137. ->in($rollbackDir);
  5138. return $finder;
  5139. }
  5140. }
  5141. <?php
  5142. namespace Composer\Command;
  5143. use Composer\Composer;
  5144. use Composer\DependencyResolver\DefaultPolicy;
  5145. use Composer\DependencyResolver\Pool;
  5146. use Composer\Json\JsonFile;
  5147. use Composer\Package\BasePackage;
  5148. use Composer\Package\CompletePackageInterface;
  5149. use Composer\Package\PackageInterface;
  5150. use Composer\Package\Version\VersionParser;
  5151. use Composer\Package\Version\VersionSelector;
  5152. use Composer\Plugin\CommandEvent;
  5153. use Composer\Plugin\PluginEvents;
  5154. use Composer\Repository\ArrayRepository;
  5155. use Composer\Repository\ComposerRepository;
  5156. use Composer\Repository\CompositeRepository;
  5157. use Composer\Repository\PlatformRepository;
  5158. use Composer\Repository\RepositoryFactory;
  5159. use Composer\Repository\RepositoryInterface;
  5160. use Composer\Semver\Constraint\ConstraintInterface;
  5161. use Composer\Semver\Semver;
  5162. use Composer\Spdx\SpdxLicenses;
  5163. use Composer\Util\Platform;
  5164. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5165. use Symfony\Component\Console\Input\InputArgument;
  5166. use Symfony\Component\Console\Input\InputInterface;
  5167. use Symfony\Component\Console\Input\InputOption;
  5168. use Symfony\Component\Console\Output\OutputInterface;
  5169. use Symfony\Component\Console\Terminal;
  5170. class ShowCommand extends BaseCommand
  5171. {
  5172. protected $versionParser;
  5173. protected $colors;
  5174. private $pool;
  5175. protected function configure()
  5176. {
  5177. $this
  5178. ->setName('show')
  5179. ->setAliases(array('info'))
  5180. ->setDescription('Shows information about packages.')
  5181. ->setDefinition(array(
  5182. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5183. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5184. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5185. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5186. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5187. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5188. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5189. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5190. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5191. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5192. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5193. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5194. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5195. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5196. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5197. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5198. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5199. ))
  5200. ->setHelp(
  5201. <<<EOT
  5202. The show command displays detailed information about a package, or
  5203. lists all packages available.
  5204. EOT
  5205. )
  5206. ;
  5207. }
  5208. protected function execute(InputInterface $input, OutputInterface $output)
  5209. {
  5210. $this->versionParser = new VersionParser;
  5211. if ($input->getOption('tree')) {
  5212. $this->initStyles($output);
  5213. }
  5214. $composer = $this->getComposer(false);
  5215. $io = $this->getIO();
  5216. if ($input->getOption('installed')) {
  5217. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  5218. }
  5219. if ($input->getOption('outdated')) {
  5220. $input->setOption('latest', true);
  5221. } elseif ($input->getOption('ignore')) {
  5222. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5223. }
  5224. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5225. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5226. return 1;
  5227. }
  5228. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5229. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5230. return 1;
  5231. }
  5232. if ($input->getOption('tree') && $input->getOption('latest')) {
  5233. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5234. return 1;
  5235. }
  5236. $format = $input->getOption('format');
  5237. if (!in_array($format, array('text', 'json'))) {
  5238. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5239. return 1;
  5240. }
  5241. $platformOverrides = array();
  5242. if ($composer) {
  5243. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5244. }
  5245. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5246. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5247. if ($input->getOption('self')) {
  5248. $package = $this->getComposer()->getPackage();
  5249. $repos = $installedRepo = new ArrayRepository(array($package));
  5250. } elseif ($input->getOption('platform')) {
  5251. $repos = $installedRepo = $platformRepo;
  5252. } elseif ($input->getOption('available')) {
  5253. $installedRepo = $platformRepo;
  5254. if ($composer) {
  5255. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5256. } else {
  5257. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5258. $repos = new CompositeRepository($defaultRepos);
  5259. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5260. }
  5261. } elseif ($input->getOption('all') && $composer) {
  5262. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5263. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5264. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5265. } elseif ($input->getOption('all')) {
  5266. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5267. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5268. $installedRepo = $platformRepo;
  5269. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5270. } else {
  5271. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5272. $rootPkg = $this->getComposer()->getPackage();
  5273. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5274. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5275. }
  5276. }
  5277. if ($composer) {
  5278. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5279. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5280. }
  5281. if ($input->getOption('latest') && null === $composer) {
  5282. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5283. $input->setOption('latest', false);
  5284. }
  5285. $packageFilter = $input->getArgument('package');
  5286. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5287. if (empty($package)) {
  5288. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5289. if (empty($package)) {
  5290. $options = $input->getOptions();
  5291. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5292. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5293. }
  5294. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5295. return 1;
  5296. }
  5297. } else {
  5298. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5299. }
  5300. $exitCode = 0;
  5301. if ($input->getOption('tree')) {
  5302. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5303. if ('json' === $format) {
  5304. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5305. } else {
  5306. $this->displayPackageTree(array($arrayTree));
  5307. }
  5308. } else {
  5309. $latestPackage = null;
  5310. if ($input->getOption('latest')) {
  5311. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5312. }
  5313. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5314. $exitCode = 1;
  5315. }
  5316. if ($input->getOption('path')) {
  5317. $io->write($package->getName(), false);
  5318. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5319. return $exitCode;
  5320. }
  5321. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5322. $this->printLinks($package, 'requires');
  5323. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5324. if ($package->getSuggests()) {
  5325. $io->write("\n<info>suggests</info>");
  5326. foreach ($package->getSuggests() as $suggested => $reason) {
  5327. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5328. }
  5329. }
  5330. $this->printLinks($package, 'provides');
  5331. $this->printLinks($package, 'conflicts');
  5332. $this->printLinks($package, 'replaces');
  5333. }
  5334. return $exitCode;
  5335. }
  5336. if ($input->getOption('tree')) {
  5337. $rootRequires = $this->getRootRequires();
  5338. $packages = $installedRepo->getPackages();
  5339. usort($packages, 'strcmp');
  5340. $arrayTree = array();
  5341. foreach ($packages as $package) {
  5342. if (in_array($package->getName(), $rootRequires, true)) {
  5343. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5344. }
  5345. }
  5346. if ('json' === $format) {
  5347. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5348. } else {
  5349. $this->displayPackageTree($arrayTree);
  5350. }
  5351. return 0;
  5352. }
  5353. if ($repos instanceof CompositeRepository) {
  5354. $repos = $repos->getRepositories();
  5355. } elseif (!is_array($repos)) {
  5356. $repos = array($repos);
  5357. }
  5358. $packages = array();
  5359. if (null !== $packageFilter) {
  5360. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5361. }
  5362. $packageListFilter = array();
  5363. if ($input->getOption('direct')) {
  5364. $packageListFilter = $this->getRootRequires();
  5365. }
  5366. if (class_exists('Symfony\Component\Console\Terminal')) {
  5367. $terminal = new Terminal();
  5368. $width = $terminal->getWidth();
  5369. } else {
  5370. list($width) = $this->getApplication()->getTerminalDimensions();
  5371. }
  5372. if (null === $width) {
  5373. $width = PHP_INT_MAX;
  5374. }
  5375. if (Platform::isWindows()) {
  5376. $width--;
  5377. } else {
  5378. $width = max(80, $width);
  5379. }
  5380. if ($input->getOption('path') && null === $composer) {
  5381. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5382. $input->setOption('path', false);
  5383. }
  5384. foreach ($repos as $repo) {
  5385. if ($repo === $platformRepo) {
  5386. $type = 'platform';
  5387. } elseif (
  5388. $repo === $installedRepo
  5389. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5390. ) {
  5391. $type = 'installed';
  5392. } else {
  5393. $type = 'available';
  5394. }
  5395. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5396. foreach ($repo->getProviderNames() as $name) {
  5397. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5398. $packages[$type][$name] = $name;
  5399. }
  5400. }
  5401. } else {
  5402. foreach ($repo->getPackages() as $package) {
  5403. if (!isset($packages[$type][$package->getName()])
  5404. || !is_object($packages[$type][$package->getName()])
  5405. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5406. ) {
  5407. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5408. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5409. $packages[$type][$package->getName()] = $package;
  5410. }
  5411. }
  5412. }
  5413. }
  5414. }
  5415. }
  5416. $showAllTypes = $input->getOption('all');
  5417. $showLatest = $input->getOption('latest');
  5418. $showMinorOnly = $input->getOption('minor-only');
  5419. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5420. $indent = $showAllTypes ? ' ' : '';
  5421. $latestPackages = array();
  5422. $exitCode = 0;
  5423. $viewData = array();
  5424. $viewMetaData = array();
  5425. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5426. if (isset($packages[$type])) {
  5427. ksort($packages[$type]);
  5428. $nameLength = $versionLength = $latestLength = 0;
  5429. if ($showLatest && $showVersion) {
  5430. foreach ($packages[$type] as $package) {
  5431. if (is_object($package)) {
  5432. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5433. if ($latestPackage === false) {
  5434. continue;
  5435. }
  5436. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5437. }
  5438. }
  5439. }
  5440. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5441. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5442. $writeLatest = $writeVersion && $showLatest;
  5443. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5444. $hasOutdatedPackages = false;
  5445. $viewData[$type] = array();
  5446. foreach ($packages[$type] as $package) {
  5447. $packageViewData = array();
  5448. if (is_object($package)) {
  5449. $latestPackage = null;
  5450. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5451. $latestPackage = $latestPackages[$package->getPrettyName()];
  5452. }
  5453. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5454. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5455. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5456. continue;
  5457. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5458. $hasOutdatedPackages = true;
  5459. }
  5460. $packageViewData['name'] = $package->getPrettyName();
  5461. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5462. if ($writeVersion) {
  5463. $packageViewData['version'] = $package->getFullPrettyVersion();
  5464. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5465. }
  5466. if ($writeLatest && $latestPackage) {
  5467. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5468. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5469. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5470. }
  5471. if ($writeDescription) {
  5472. $packageViewData['description'] = $package->getDescription();
  5473. }
  5474. if ($writePath) {
  5475. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5476. }
  5477. if ($latestPackage && $latestPackage->isAbandoned()) {
  5478. $replacement = is_string($latestPackage->getReplacementPackage())
  5479. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5480. : 'No replacement was suggested';
  5481. $packageWarning = sprintf(
  5482. 'Package %s is abandoned, you should avoid using it. %s.',
  5483. $package->getPrettyName(),
  5484. $replacement
  5485. );
  5486. $packageViewData['warning'] = $packageWarning;
  5487. }
  5488. } else {
  5489. $packageViewData['name'] = $package;
  5490. $nameLength = max($nameLength, strlen($package));
  5491. }
  5492. $viewData[$type][] = $packageViewData;
  5493. }
  5494. $viewMetaData[$type] = array(
  5495. 'nameLength' => $nameLength,
  5496. 'versionLength' => $versionLength,
  5497. 'latestLength' => $latestLength,
  5498. );
  5499. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5500. $exitCode = 1;
  5501. break;
  5502. }
  5503. }
  5504. }
  5505. if ('json' === $format) {
  5506. $io->write(JsonFile::encode($viewData));
  5507. } else {
  5508. foreach ($viewData as $type => $packages) {
  5509. $nameLength = $viewMetaData[$type]['nameLength'];
  5510. $versionLength = $viewMetaData[$type]['versionLength'];
  5511. $latestLength = $viewMetaData[$type]['latestLength'];
  5512. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5513. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5514. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5515. if ($writeLatest && !$io->isDecorated()) {
  5516. $latestLength += 2;
  5517. }
  5518. if ($showAllTypes) {
  5519. if ('available' === $type) {
  5520. $io->write('<comment>' . $type . '</comment>:');
  5521. } else {
  5522. $io->write('<info>' . $type . '</info>:');
  5523. }
  5524. }
  5525. foreach ($packages as $package) {
  5526. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5527. if (isset($package['version']) && $writeVersion) {
  5528. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5529. }
  5530. if (isset($package['latest']) && $writeLatest) {
  5531. $latestVersion = $package['latest'];
  5532. $updateStatus = $package['latest-status'];
  5533. $style = $this->updateStatusToVersionStyle($updateStatus);
  5534. if (!$io->isDecorated()) {
  5535. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5536. }
  5537. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5538. }
  5539. if (isset($package['description']) && $writeDescription) {
  5540. $description = strtok($package['description'], "\r\n");
  5541. $remaining = $width - $nameLength - $versionLength - 4;
  5542. if ($writeLatest) {
  5543. $remaining -= $latestLength;
  5544. }
  5545. if (strlen($description) > $remaining) {
  5546. $description = substr($description, 0, $remaining - 3) . '...';
  5547. }
  5548. $io->write(' ' . $description, false);
  5549. }
  5550. if (isset($package['path'])) {
  5551. $io->write(' ' . $package['path'], false);
  5552. }
  5553. $io->write('');
  5554. if (isset($package['warning'])) {
  5555. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5556. }
  5557. }
  5558. if ($showAllTypes) {
  5559. $io->write('');
  5560. }
  5561. }
  5562. }
  5563. return $exitCode;
  5564. }
  5565. protected function getRootRequires()
  5566. {
  5567. $rootPackage = $this->getComposer()->getPackage();
  5568. return array_map(
  5569. 'strtolower',
  5570. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5571. );
  5572. }
  5573. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5574. {
  5575. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5576. }
  5577. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5578. {
  5579. $name = strtolower($name);
  5580. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5581. $policy = new DefaultPolicy();
  5582. $pool = new Pool('dev');
  5583. $pool->addRepository($repos);
  5584. $matchedPackage = null;
  5585. $versions = array();
  5586. $matches = $pool->whatProvides($name, $constraint);
  5587. foreach ($matches as $index => $package) {
  5588. if ($package->getName() !== $name) {
  5589. unset($matches[$index]);
  5590. continue;
  5591. }
  5592. if (null === $version && $installedRepo->hasPackage($package)) {
  5593. $matchedPackage = $package;
  5594. }
  5595. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5596. $matches[$index] = $package->getId();
  5597. }
  5598. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5599. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5600. }
  5601. return array($matchedPackage, $versions);
  5602. }
  5603. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5604. {
  5605. $io = $this->getIO();
  5606. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5607. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5608. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5609. $this->printVersions($package, $versions, $installedRepo);
  5610. if ($latestPackage) {
  5611. $style = $this->getVersionStyle($latestPackage, $package);
  5612. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5613. } else {
  5614. $latestPackage = $package;
  5615. }
  5616. $io->write('<info>type</info> : ' . $package->getType());
  5617. $this->printLicenses($package);
  5618. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5619. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5620. if ($installedRepo->hasPackage($package)) {
  5621. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5622. }
  5623. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5624. if ($latestPackage->isAbandoned()) {
  5625. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5626. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5627. : null;
  5628. $io->writeError(
  5629. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5630. );
  5631. }
  5632. if ($package->getSupport()) {
  5633. $io->write("\n<info>support</info>");
  5634. foreach ($package->getSupport() as $type => $value) {
  5635. $io->write('<comment>' . $type . '</comment> : '.$value);
  5636. }
  5637. }
  5638. if ($package->getAutoload()) {
  5639. $io->write("\n<info>autoload</info>");
  5640. foreach ($package->getAutoload() as $type => $autoloads) {
  5641. $io->write('<comment>' . $type . '</comment>');
  5642. if ($type === 'psr-0') {
  5643. foreach ($autoloads as $name => $path) {
  5644. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5645. }
  5646. } elseif ($type === 'psr-4') {
  5647. foreach ($autoloads as $name => $path) {
  5648. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5649. }
  5650. } elseif ($type === 'classmap') {
  5651. $io->write(implode(', ', $autoloads));
  5652. }
  5653. }
  5654. if ($package->getIncludePaths()) {
  5655. $io->write('<comment>include-path</comment>');
  5656. $io->write(implode(', ', $package->getIncludePaths()));
  5657. }
  5658. }
  5659. }
  5660. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5661. {
  5662. uasort($versions, 'version_compare');
  5663. $versions = array_keys(array_reverse($versions));
  5664. if ($installedRepo->hasPackage($package)) {
  5665. $installedVersion = $package->getPrettyVersion();
  5666. $key = array_search($installedVersion, $versions);
  5667. if (false !== $key) {
  5668. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5669. }
  5670. }
  5671. $versions = implode(', ', $versions);
  5672. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5673. }
  5674. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5675. {
  5676. $title = $title ?: $linkType;
  5677. $io = $this->getIO();
  5678. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5679. $io->write("\n<info>" . $title . "</info>");
  5680. foreach ($links as $link) {
  5681. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5682. }
  5683. }
  5684. }
  5685. protected function printLicenses(CompletePackageInterface $package)
  5686. {
  5687. $spdxLicenses = new SpdxLicenses();
  5688. $licenses = $package->getLicense();
  5689. $io = $this->getIO();
  5690. foreach ($licenses as $licenseId) {
  5691. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5692. if (!$license) {
  5693. $out = $licenseId;
  5694. } else {
  5695. if ($license[1] === true) {
  5696. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5697. } else {
  5698. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5699. }
  5700. }
  5701. $io->write('<info>license</info> : ' . $out);
  5702. }
  5703. }
  5704. protected function initStyles(OutputInterface $output)
  5705. {
  5706. $this->colors = array(
  5707. 'green',
  5708. 'yellow',
  5709. 'cyan',
  5710. 'magenta',
  5711. 'blue',
  5712. );
  5713. foreach ($this->colors as $color) {
  5714. $style = new OutputFormatterStyle($color);
  5715. $output->getFormatter()->setStyle($color, $style);
  5716. }
  5717. }
  5718. protected function displayPackageTree(array $arrayTree)
  5719. {
  5720. $io = $this->getIO();
  5721. foreach ($arrayTree as $package) {
  5722. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5723. $io->write(' ' . $package['version'], false);
  5724. $io->write(' ' . strtok($package['description'], "\r\n"));
  5725. if (isset($package['requires'])) {
  5726. $requires = $package['requires'];
  5727. $treeBar = '├';
  5728. $j = 0;
  5729. $total = count($requires);
  5730. foreach ($requires as $require) {
  5731. $requireName = $require['name'];
  5732. $j++;
  5733. if ($j === $total) {
  5734. $treeBar = 'â””';
  5735. }
  5736. $level = 1;
  5737. $color = $this->colors[$level];
  5738. $info = sprintf(
  5739. '%s──<%s>%s</%s> %s',
  5740. $treeBar,
  5741. $color,
  5742. $requireName,
  5743. $color,
  5744. $require['version']
  5745. );
  5746. $this->writeTreeLine($info);
  5747. $treeBar = str_replace('â””', ' ', $treeBar);
  5748. $packagesInTree = array($package['name'], $requireName);
  5749. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5750. }
  5751. }
  5752. }
  5753. }
  5754. protected function generatePackageTree(
  5755. PackageInterface $package,
  5756. RepositoryInterface $installedRepo,
  5757. RepositoryInterface $distantRepos
  5758. ) {
  5759. $requires = $package->getRequires();
  5760. ksort($requires);
  5761. $children = array();
  5762. foreach ($requires as $requireName => $require) {
  5763. $packagesInTree = array($package->getName(), $requireName);
  5764. $treeChildDesc = array(
  5765. 'name' => $requireName,
  5766. 'version' => $require->getPrettyConstraint(),
  5767. );
  5768. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5769. if ($deepChildren) {
  5770. $treeChildDesc['requires'] = $deepChildren;
  5771. }
  5772. $children[] = $treeChildDesc;
  5773. }
  5774. $tree = array(
  5775. 'name' => $package->getPrettyName(),
  5776. 'version' => $package->getPrettyVersion(),
  5777. 'description' => $package->getDescription(),
  5778. );
  5779. if ($children) {
  5780. $tree['requires'] = $children;
  5781. }
  5782. return $tree;
  5783. }
  5784. protected function displayTree(
  5785. $package,
  5786. array $packagesInTree,
  5787. $previousTreeBar = '├',
  5788. $level = 1
  5789. ) {
  5790. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5791. if (isset($package['requires'])) {
  5792. $requires = $package['requires'];
  5793. $treeBar = $previousTreeBar . ' ├';
  5794. $i = 0;
  5795. $total = count($requires);
  5796. foreach ($requires as $require) {
  5797. $currentTree = $packagesInTree;
  5798. $i++;
  5799. if ($i === $total) {
  5800. $treeBar = $previousTreeBar . ' â””';
  5801. }
  5802. $colorIdent = $level % count($this->colors);
  5803. $color = $this->colors[$colorIdent];
  5804. $circularWarn = in_array(
  5805. $require['name'],
  5806. $currentTree,
  5807. true
  5808. ) ? '(circular dependency aborted here)' : '';
  5809. $info = rtrim(sprintf(
  5810. '%s──<%s>%s</%s> %s %s',
  5811. $treeBar,
  5812. $color,
  5813. $require['name'],
  5814. $color,
  5815. $require['version'],
  5816. $circularWarn
  5817. ));
  5818. $this->writeTreeLine($info);
  5819. $treeBar = str_replace('â””', ' ', $treeBar);
  5820. $currentTree[] = $require['name'];
  5821. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5822. }
  5823. }
  5824. }
  5825. protected function addTree(
  5826. $name,
  5827. $package,
  5828. RepositoryInterface $installedRepo,
  5829. RepositoryInterface $distantRepos,
  5830. array $packagesInTree
  5831. ) {
  5832. $children = array();
  5833. list($package, $versions) = $this->getPackage(
  5834. $installedRepo,
  5835. $distantRepos,
  5836. $name,
  5837. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5838. );
  5839. if (is_object($package)) {
  5840. $requires = $package->getRequires();
  5841. ksort($requires);
  5842. foreach ($requires as $requireName => $require) {
  5843. $currentTree = $packagesInTree;
  5844. $treeChildDesc = array(
  5845. 'name' => $requireName,
  5846. 'version' => $require->getPrettyConstraint(),
  5847. );
  5848. if (!in_array($requireName, $currentTree, true)) {
  5849. $currentTree[] = $requireName;
  5850. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5851. if ($deepChildren) {
  5852. $treeChildDesc['requires'] = $deepChildren;
  5853. }
  5854. }
  5855. $children[] = $treeChildDesc;
  5856. }
  5857. }
  5858. return $children;
  5859. }
  5860. private function updateStatusToVersionStyle($updateStatus)
  5861. {
  5862. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5863. }
  5864. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5865. {
  5866. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5867. return 'up-to-date';
  5868. }
  5869. $constraint = $package->getVersion();
  5870. if (0 !== strpos($constraint, 'dev-')) {
  5871. $constraint = '^'.$constraint;
  5872. }
  5873. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5874. return 'semver-safe-update';
  5875. }
  5876. return 'update-possible';
  5877. }
  5878. private function writeTreeLine($line)
  5879. {
  5880. $io = $this->getIO();
  5881. if (!$io->isDecorated()) {
  5882. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5883. }
  5884. $io->write($line);
  5885. }
  5886. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5887. {
  5888. $name = $package->getName();
  5889. $versionSelector = new VersionSelector($this->getPool($composer));
  5890. $stability = $composer->getPackage()->getMinimumStability();
  5891. $flags = $composer->getPackage()->getStabilityFlags();
  5892. if (isset($flags[$name])) {
  5893. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5894. }
  5895. $bestStability = $stability;
  5896. if ($composer->getPackage()->getPreferStable()) {
  5897. $bestStability = $package->getStability();
  5898. }
  5899. $targetVersion = null;
  5900. if (0 === strpos($package->getVersion(), 'dev-')) {
  5901. $targetVersion = $package->getVersion();
  5902. }
  5903. if ($targetVersion === null && $minorOnly) {
  5904. $targetVersion = '^' . $package->getVersion();
  5905. }
  5906. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5907. }
  5908. private function getPool(Composer $composer)
  5909. {
  5910. if (!$this->pool) {
  5911. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5912. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5913. }
  5914. return $this->pool;
  5915. }
  5916. }
  5917. <?php
  5918. namespace Composer\Command;
  5919. use Symfony\Component\Console\Input\InputInterface;
  5920. use Symfony\Component\Console\Input\InputOption;
  5921. use Symfony\Component\Console\Output\OutputInterface;
  5922. use Composer\Downloader\ChangeReportInterface;
  5923. use Composer\Downloader\DvcsDownloaderInterface;
  5924. use Composer\Downloader\VcsCapableDownloaderInterface;
  5925. use Composer\Package\Dumper\ArrayDumper;
  5926. use Composer\Package\Version\VersionGuesser;
  5927. use Composer\Package\Version\VersionParser;
  5928. use Composer\Plugin\CommandEvent;
  5929. use Composer\Plugin\PluginEvents;
  5930. use Composer\Script\ScriptEvents;
  5931. use Composer\Util\ProcessExecutor;
  5932. class StatusCommand extends BaseCommand
  5933. {
  5934. const EXIT_CODE_ERRORS = 1;
  5935. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5936. const EXIT_CODE_VERSION_CHANGES = 4;
  5937. protected function configure()
  5938. {
  5939. $this
  5940. ->setName('status')
  5941. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5942. ->setDefinition(array(
  5943. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5944. ))
  5945. ->setHelp(
  5946. <<<EOT
  5947. The status command displays a list of dependencies that have
  5948. been modified locally.
  5949. EOT
  5950. )
  5951. ;
  5952. }
  5953. protected function execute(InputInterface $input, OutputInterface $output)
  5954. {
  5955. $composer = $this->getComposer();
  5956. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5957. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5958. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5959. $dm = $composer->getDownloadManager();
  5960. $im = $composer->getInstallationManager();
  5961. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5962. $errors = array();
  5963. $io = $this->getIO();
  5964. $unpushedChanges = array();
  5965. $vcsVersionChanges = array();
  5966. $parser = new VersionParser;
  5967. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5968. $dumper = new ArrayDumper;
  5969. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5970. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5971. $targetDir = $im->getInstallPath($package);
  5972. if ($downloader instanceof ChangeReportInterface) {
  5973. if (is_link($targetDir)) {
  5974. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5975. }
  5976. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5977. $errors[$targetDir] = $changes;
  5978. }
  5979. }
  5980. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5981. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5982. switch ($package->getInstallationSource()) {
  5983. case 'source':
  5984. $previousRef = $package->getSourceReference();
  5985. break;
  5986. case 'dist':
  5987. $previousRef = $package->getDistReference();
  5988. break;
  5989. default:
  5990. $previousRef = null;
  5991. }
  5992. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5993. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5994. $vcsVersionChanges[$targetDir] = array(
  5995. 'previous' => array(
  5996. 'version' => $package->getPrettyVersion(),
  5997. 'ref' => $previousRef,
  5998. ),
  5999. 'current' => array(
  6000. 'version' => $currentVersion['pretty_version'],
  6001. 'ref' => $currentVersion['commit'],
  6002. ),
  6003. );
  6004. }
  6005. }
  6006. }
  6007. if ($downloader instanceof DvcsDownloaderInterface) {
  6008. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6009. $unpushedChanges[$targetDir] = $unpushed;
  6010. }
  6011. }
  6012. }
  6013. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6014. $io->writeError('<info>No local changes</info>');
  6015. return 0;
  6016. }
  6017. if ($errors) {
  6018. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6019. foreach ($errors as $path => $changes) {
  6020. if ($input->getOption('verbose')) {
  6021. $indentedChanges = implode("\n", array_map(function ($line) {
  6022. return ' ' . ltrim($line);
  6023. }, explode("\n", $changes)));
  6024. $io->write('<info>'.$path.'</info>:');
  6025. $io->write($indentedChanges);
  6026. } else {
  6027. $io->write($path);
  6028. }
  6029. }
  6030. }
  6031. if ($unpushedChanges) {
  6032. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6033. foreach ($unpushedChanges as $path => $changes) {
  6034. if ($input->getOption('verbose')) {
  6035. $indentedChanges = implode("\n", array_map(function ($line) {
  6036. return ' ' . ltrim($line);
  6037. }, explode("\n", $changes)));
  6038. $io->write('<info>'.$path.'</info>:');
  6039. $io->write($indentedChanges);
  6040. } else {
  6041. $io->write($path);
  6042. }
  6043. }
  6044. }
  6045. if ($vcsVersionChanges) {
  6046. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6047. foreach ($vcsVersionChanges as $path => $changes) {
  6048. if ($input->getOption('verbose')) {
  6049. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6050. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6051. if ($io->isVeryVerbose()) {
  6052. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6053. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6054. }
  6055. $io->write('<info>'.$path.'</info>:');
  6056. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6057. } else {
  6058. $io->write($path);
  6059. }
  6060. }
  6061. }
  6062. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6063. $io->writeError('Use --verbose (-v) to see a list of files');
  6064. }
  6065. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6066. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6067. }
  6068. }
  6069. <?php
  6070. namespace Composer\Command;
  6071. use Composer\Repository\PlatformRepository;
  6072. use Symfony\Component\Console\Input\InputArgument;
  6073. use Symfony\Component\Console\Input\InputInterface;
  6074. use Symfony\Component\Console\Input\InputOption;
  6075. use Symfony\Component\Console\Output\OutputInterface;
  6076. class SuggestsCommand extends BaseCommand
  6077. {
  6078. protected function configure()
  6079. {
  6080. $this
  6081. ->setName('suggests')
  6082. ->setDescription('Shows package suggestions.')
  6083. ->setDefinition(array(
  6084. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6085. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6086. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6087. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6088. ))
  6089. ->setHelp(
  6090. <<<EOT
  6091. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6092. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6093. EOT
  6094. )
  6095. ;
  6096. }
  6097. protected function execute(InputInterface $input, OutputInterface $output)
  6098. {
  6099. $lock = $this->getComposer()->getLocker()->getLockData();
  6100. if (empty($lock)) {
  6101. throw new \RuntimeException('Lockfile seems to be empty?');
  6102. }
  6103. $packages = $lock['packages'];
  6104. if (!$input->getOption('no-dev')) {
  6105. $packages += $lock['packages-dev'];
  6106. }
  6107. $filter = $input->getArgument('packages');
  6108. $installed = array();
  6109. foreach ($packages as $package) {
  6110. $installed[] = $package['name'];
  6111. if (!empty($package['provide'])) {
  6112. $installed = array_merge($installed, array_keys($package['provide']));
  6113. }
  6114. if (!empty($package['replace'])) {
  6115. $installed = array_merge($installed, array_keys($package['replace']));
  6116. }
  6117. }
  6118. $installed = array_flip($installed);
  6119. ksort($installed);
  6120. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6121. $suggesters = array();
  6122. $suggested = array();
  6123. foreach ($packages as $package) {
  6124. $packageName = $package['name'];
  6125. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6126. continue;
  6127. }
  6128. foreach ($package['suggest'] as $suggestion => $reason) {
  6129. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6130. continue;
  6131. }
  6132. if (!isset($installed[$suggestion])) {
  6133. $suggesters[$packageName][$suggestion] = $reason;
  6134. $suggested[$suggestion][$packageName] = $reason;
  6135. }
  6136. }
  6137. }
  6138. ksort($suggesters);
  6139. ksort($suggested);
  6140. $mode = 0;
  6141. $io = $this->getIO();
  6142. if ($input->getOption('by-package') || $io->isVerbose()) {
  6143. $mode |= 1;
  6144. }
  6145. if ($input->getOption('by-suggestion')) {
  6146. $mode |= 2;
  6147. }
  6148. if ($mode === 0) {
  6149. foreach (array_keys($suggested) as $suggestion) {
  6150. $io->write(sprintf('<info>%s</info>', $suggestion));
  6151. }
  6152. return;
  6153. }
  6154. if ($mode & 1) {
  6155. foreach ($suggesters as $suggester => $suggestions) {
  6156. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6157. foreach ($suggestions as $suggestion => $reason) {
  6158. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6159. }
  6160. $io->write('');
  6161. }
  6162. }
  6163. if ($mode & 2) {
  6164. if ($mode & 1) {
  6165. $io->write(str_repeat('-', 78));
  6166. }
  6167. foreach ($suggested as $suggestion => $suggesters) {
  6168. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6169. foreach ($suggesters as $suggester => $reason) {
  6170. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6171. }
  6172. $io->write('');
  6173. }
  6174. }
  6175. }
  6176. }
  6177. <?php
  6178. namespace Composer\Command;
  6179. use Composer\Composer;
  6180. use Composer\Installer;
  6181. use Composer\IO\IOInterface;
  6182. use Composer\Plugin\CommandEvent;
  6183. use Composer\Plugin\PluginEvents;
  6184. use Symfony\Component\Console\Helper\Table;
  6185. use Symfony\Component\Console\Input\InputInterface;
  6186. use Symfony\Component\Console\Input\InputOption;
  6187. use Symfony\Component\Console\Input\InputArgument;
  6188. use Symfony\Component\Console\Output\OutputInterface;
  6189. use Symfony\Component\Console\Question\Question;
  6190. class UpdateCommand extends BaseCommand
  6191. {
  6192. protected function configure()
  6193. {
  6194. $this
  6195. ->setName('update')
  6196. ->setAliases(array('u', 'upgrade'))
  6197. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6198. ->setDefinition(array(
  6199. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6200. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6201. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6202. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6203. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6204. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6205. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6206. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6207. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6208. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6209. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6210. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6211. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6212. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  6213. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6214. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6215. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6216. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6217. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6218. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6219. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6220. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6221. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6222. ))
  6223. ->setHelp(
  6224. <<<EOT
  6225. The <info>update</info> command reads the composer.json file from the
  6226. current directory, processes it, and updates, removes or installs all the
  6227. dependencies.
  6228. <info>php composer.phar update</info>
  6229. To limit the update operation to a few packages, you can list the package(s)
  6230. you want to update as such:
  6231. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6232. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6233. from a specific vendor:
  6234. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6235. To select packages names interactively with auto-completion use <info>-i</info>.
  6236. EOT
  6237. )
  6238. ;
  6239. }
  6240. protected function execute(InputInterface $input, OutputInterface $output)
  6241. {
  6242. $io = $this->getIO();
  6243. if ($input->getOption('no-custom-installers')) {
  6244. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6245. $input->setOption('no-plugins', true);
  6246. }
  6247. if ($input->getOption('dev')) {
  6248. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6249. }
  6250. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6251. $packages = $input->getArgument('packages');
  6252. if ($input->getOption('interactive')) {
  6253. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6254. }
  6255. if ($input->getOption('root-reqs')) {
  6256. $require = array_keys($composer->getPackage()->getRequires());
  6257. if (!$input->getOption('no-dev')) {
  6258. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6259. $require = array_merge($require, $requireDev);
  6260. }
  6261. if (!empty($packages)) {
  6262. $packages = array_intersect($packages, $require);
  6263. } else {
  6264. $packages = $require;
  6265. }
  6266. }
  6267. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6268. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6269. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6270. $install = Installer::create($io, $composer);
  6271. $config = $composer->getConfig();
  6272. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6273. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6274. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6275. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6276. $install
  6277. ->setDryRun($input->getOption('dry-run'))
  6278. ->setVerbose($input->getOption('verbose'))
  6279. ->setPreferSource($preferSource)
  6280. ->setPreferDist($preferDist)
  6281. ->setDevMode(!$input->getOption('no-dev'))
  6282. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6283. ->setRunScripts(!$input->getOption('no-scripts'))
  6284. ->setSkipSuggest($input->getOption('no-suggest'))
  6285. ->setOptimizeAutoloader($optimize)
  6286. ->setClassMapAuthoritative($authoritative)
  6287. ->setApcuAutoloader($apcu)
  6288. ->setUpdate(true)
  6289. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6290. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6291. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6292. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6293. ->setPreferStable($input->getOption('prefer-stable'))
  6294. ->setPreferLowest($input->getOption('prefer-lowest'))
  6295. ;
  6296. if ($input->getOption('no-plugins')) {
  6297. $install->disablePlugins();
  6298. }
  6299. return $install->run();
  6300. }
  6301. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6302. {
  6303. if (!$input->isInteractive()) {
  6304. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6305. }
  6306. $requires = array_merge(
  6307. $composer->getPackage()->getRequires(),
  6308. $composer->getPackage()->getDevRequires()
  6309. );
  6310. $autocompleterValues = array();
  6311. foreach ($requires as $require) {
  6312. $target = $require->getTarget();
  6313. $autocompleterValues[strtolower($target)] = $target;
  6314. }
  6315. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6316. foreach ($installedPackages as $package) {
  6317. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6318. }
  6319. $helper = $this->getHelper('question');
  6320. $question = new Question('<comment>Enter package name: </comment>', null);
  6321. $io->writeError('<info>Press enter without value to end submission</info>');
  6322. do {
  6323. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6324. $question->setAutocompleterValues($autocompleterValues);
  6325. $addedPackage = $helper->ask($input, $output, $question);
  6326. if (!is_string($addedPackage) || empty($addedPackage)) {
  6327. break;
  6328. }
  6329. $addedPackage = strtolower($addedPackage);
  6330. if (!in_array($addedPackage, $packages)) {
  6331. $packages[] = $addedPackage;
  6332. }
  6333. } while (true);
  6334. $packages = array_filter($packages);
  6335. if (!$packages) {
  6336. throw new \InvalidArgumentException('You must enter minimum one package.');
  6337. }
  6338. $table = new Table($output);
  6339. $table->setHeaders(array('Selected packages'));
  6340. foreach ($packages as $package) {
  6341. $table->addRow(array($package));
  6342. }
  6343. $table->render();
  6344. if ($io->askConfirmation(sprintf(
  6345. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6346. 1 === count($packages) ? '' : 's'
  6347. ), true)) {
  6348. return $packages;
  6349. }
  6350. throw new \RuntimeException('Installation aborted.');
  6351. }
  6352. }
  6353. <?php
  6354. namespace Composer\Command;
  6355. use Composer\Factory;
  6356. use Composer\Package\Loader\ValidatingArrayLoader;
  6357. use Composer\Plugin\CommandEvent;
  6358. use Composer\Plugin\PluginEvents;
  6359. use Composer\Util\ConfigValidator;
  6360. use Symfony\Component\Console\Input\InputArgument;
  6361. use Symfony\Component\Console\Input\InputInterface;
  6362. use Symfony\Component\Console\Input\InputOption;
  6363. use Symfony\Component\Console\Output\OutputInterface;
  6364. class ValidateCommand extends BaseCommand
  6365. {
  6366. protected function configure()
  6367. {
  6368. $this
  6369. ->setName('validate')
  6370. ->setDescription('Validates a composer.json and composer.lock.')
  6371. ->setDefinition(array(
  6372. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  6373. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6374. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6375. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6376. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6377. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6378. ))
  6379. ->setHelp(
  6380. <<<EOT
  6381. The validate command validates a given composer.json and composer.lock
  6382. Exit codes in case of errors are:
  6383. 1 validation warning(s), only when --strict is given
  6384. 2 validation error(s)
  6385. 3 file unreadable or missing
  6386. EOT
  6387. );
  6388. }
  6389. protected function execute(InputInterface $input, OutputInterface $output)
  6390. {
  6391. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6392. $io = $this->getIO();
  6393. if (!file_exists($file)) {
  6394. $io->writeError('<error>' . $file . ' not found.</error>');
  6395. return 3;
  6396. }
  6397. if (!is_readable($file)) {
  6398. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6399. return 3;
  6400. }
  6401. $validator = new ConfigValidator($io);
  6402. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6403. $checkPublish = !$input->getOption('no-check-publish');
  6404. $checkLock = !$input->getOption('no-check-lock');
  6405. $isStrict = $input->getOption('strict');
  6406. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6407. $lockErrors = array();
  6408. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6409. $locker = $composer->getLocker();
  6410. if ($locker->isLocked() && !$locker->isFresh()) {
  6411. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6412. }
  6413. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true, $isStrict);
  6414. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6415. if ($input->getOption('with-dependencies')) {
  6416. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6417. foreach ($localRepo->getPackages() as $package) {
  6418. $path = $composer->getInstallationManager()->getInstallPath($package);
  6419. $file = $path . '/composer.json';
  6420. if (is_dir($path) && file_exists($file)) {
  6421. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6422. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6423. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6424. $exitCode = max($depCode, $exitCode);
  6425. }
  6426. }
  6427. }
  6428. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6429. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6430. $exitCode = max($eventCode, $exitCode);
  6431. return $exitCode;
  6432. }
  6433. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
  6434. {
  6435. if (!$errors && !$publishErrors && !$warnings) {
  6436. $io->write('<info>' . $name . ' is valid</info>');
  6437. } elseif (!$errors && !$publishErrors) {
  6438. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6439. if ($printSchemaUrl) {
  6440. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6441. }
  6442. } elseif (!$errors) {
  6443. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6444. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6445. if ($printSchemaUrl) {
  6446. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6447. }
  6448. } else {
  6449. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6450. }
  6451. if ($checkPublish) {
  6452. $errors = array_merge($errors, $publishErrors);
  6453. } elseif (!$isStrict) {
  6454. $warnings = array_merge($warnings, $publishErrors);
  6455. }
  6456. if ($checkLock) {
  6457. $errors = array_merge($errors, $lockErrors);
  6458. } elseif (!$isStrict) {
  6459. $warnings = array_merge($warnings, $lockErrors);
  6460. }
  6461. $messages = array(
  6462. 'error' => $errors,
  6463. 'warning' => $warnings,
  6464. );
  6465. foreach ($messages as $style => $msgs) {
  6466. foreach ($msgs as $msg) {
  6467. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6468. }
  6469. }
  6470. }
  6471. }
  6472. <?php
  6473. namespace Composer;
  6474. use Composer\Package\RootPackageInterface;
  6475. use Composer\Package\Locker;
  6476. use Composer\Repository\RepositoryManager;
  6477. use Composer\Installer\InstallationManager;
  6478. use Composer\Plugin\PluginManager;
  6479. use Composer\Downloader\DownloadManager;
  6480. use Composer\EventDispatcher\EventDispatcher;
  6481. use Composer\Autoload\AutoloadGenerator;
  6482. use Composer\Package\Archiver\ArchiveManager;
  6483. class Composer
  6484. {
  6485. const VERSION = '1.8.4';
  6486. const BRANCH_ALIAS_VERSION = '';
  6487. const RELEASE_DATE = '2019-02-11 10:52:10';
  6488. private $package;
  6489. private $locker;
  6490. private $repositoryManager;
  6491. private $downloadManager;
  6492. private $installationManager;
  6493. private $pluginManager;
  6494. private $config;
  6495. private $eventDispatcher;
  6496. private $autoloadGenerator;
  6497. private $archiveManager;
  6498. public function setPackage(RootPackageInterface $package)
  6499. {
  6500. $this->package = $package;
  6501. }
  6502. public function getPackage()
  6503. {
  6504. return $this->package;
  6505. }
  6506. public function setConfig(Config $config)
  6507. {
  6508. $this->config = $config;
  6509. }
  6510. public function getConfig()
  6511. {
  6512. return $this->config;
  6513. }
  6514. public function setLocker(Locker $locker)
  6515. {
  6516. $this->locker = $locker;
  6517. }
  6518. public function getLocker()
  6519. {
  6520. return $this->locker;
  6521. }
  6522. public function setRepositoryManager(RepositoryManager $manager)
  6523. {
  6524. $this->repositoryManager = $manager;
  6525. }
  6526. public function getRepositoryManager()
  6527. {
  6528. return $this->repositoryManager;
  6529. }
  6530. public function setDownloadManager(DownloadManager $manager)
  6531. {
  6532. $this->downloadManager = $manager;
  6533. }
  6534. public function getDownloadManager()
  6535. {
  6536. return $this->downloadManager;
  6537. }
  6538. public function setArchiveManager(ArchiveManager $manager)
  6539. {
  6540. $this->archiveManager = $manager;
  6541. }
  6542. public function getArchiveManager()
  6543. {
  6544. return $this->archiveManager;
  6545. }
  6546. public function setInstallationManager(InstallationManager $manager)
  6547. {
  6548. $this->installationManager = $manager;
  6549. }
  6550. public function getInstallationManager()
  6551. {
  6552. return $this->installationManager;
  6553. }
  6554. public function setPluginManager(PluginManager $manager)
  6555. {
  6556. $this->pluginManager = $manager;
  6557. }
  6558. public function getPluginManager()
  6559. {
  6560. return $this->pluginManager;
  6561. }
  6562. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6563. {
  6564. $this->eventDispatcher = $eventDispatcher;
  6565. }
  6566. public function getEventDispatcher()
  6567. {
  6568. return $this->eventDispatcher;
  6569. }
  6570. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6571. {
  6572. $this->autoloadGenerator = $autoloadGenerator;
  6573. }
  6574. public function getAutoloadGenerator()
  6575. {
  6576. return $this->autoloadGenerator;
  6577. }
  6578. }
  6579. <?php
  6580. namespace Composer;
  6581. use Composer\Config\ConfigSourceInterface;
  6582. use Composer\Downloader\TransportException;
  6583. use Composer\IO\IOInterface;
  6584. use Composer\Util\Platform;
  6585. class Config
  6586. {
  6587. const RELATIVE_PATHS = 1;
  6588. public static $defaultConfig = array(
  6589. 'process-timeout' => 300,
  6590. 'use-include-path' => false,
  6591. 'preferred-install' => 'auto',
  6592. 'notify-on-install' => true,
  6593. 'github-protocols' => array('https', 'ssh', 'git'),
  6594. 'vendor-dir' => 'vendor',
  6595. 'bin-dir' => '{$vendor-dir}/bin',
  6596. 'cache-dir' => '{$home}/cache',
  6597. 'data-dir' => '{$home}',
  6598. 'cache-files-dir' => '{$cache-dir}/files',
  6599. 'cache-repo-dir' => '{$cache-dir}/repo',
  6600. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6601. 'cache-ttl' => 15552000,
  6602. 'cache-files-ttl' => null,
  6603. 'cache-files-maxsize' => '300MiB',
  6604. 'bin-compat' => 'auto',
  6605. 'discard-changes' => false,
  6606. 'autoloader-suffix' => null,
  6607. 'sort-packages' => false,
  6608. 'optimize-autoloader' => false,
  6609. 'classmap-authoritative' => false,
  6610. 'apcu-autoloader' => false,
  6611. 'prepend-autoloader' => true,
  6612. 'github-domains' => array('github.com'),
  6613. 'bitbucket-expose-hostname' => true,
  6614. 'disable-tls' => false,
  6615. 'secure-http' => true,
  6616. 'cafile' => null,
  6617. 'capath' => null,
  6618. 'github-expose-hostname' => true,
  6619. 'gitlab-domains' => array('gitlab.com'),
  6620. 'store-auths' => 'prompt',
  6621. 'platform' => array(),
  6622. 'archive-format' => 'tar',
  6623. 'archive-dir' => '.',
  6624. 'htaccess-protect' => true,
  6625. );
  6626. public static $defaultRepositories = array(
  6627. 'packagist.org' => array(
  6628. 'type' => 'composer',
  6629. 'url' => 'https?://repo.packagist.org',
  6630. 'allow_ssl_downgrade' => true,
  6631. ),
  6632. );
  6633. private $config;
  6634. private $baseDir;
  6635. private $repositories;
  6636. private $configSource;
  6637. private $authConfigSource;
  6638. private $useEnvironment;
  6639. private $warnedHosts = array();
  6640. public function __construct($useEnvironment = true, $baseDir = null)
  6641. {
  6642. $this->config = static::$defaultConfig;
  6643. $this->repositories = static::$defaultRepositories;
  6644. $this->useEnvironment = (bool) $useEnvironment;
  6645. $this->baseDir = $baseDir;
  6646. }
  6647. public function setConfigSource(ConfigSourceInterface $source)
  6648. {
  6649. $this->configSource = $source;
  6650. }
  6651. public function getConfigSource()
  6652. {
  6653. return $this->configSource;
  6654. }
  6655. public function setAuthConfigSource(ConfigSourceInterface $source)
  6656. {
  6657. $this->authConfigSource = $source;
  6658. }
  6659. public function getAuthConfigSource()
  6660. {
  6661. return $this->authConfigSource;
  6662. }
  6663. public function merge($config)
  6664. {
  6665. if (!empty($config['config']) && is_array($config['config'])) {
  6666. foreach ($config['config'] as $key => $val) {
  6667. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6668. $this->config[$key] = array_merge($this->config[$key], $val);
  6669. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6670. if (is_array($val) || is_array($this->config[$key])) {
  6671. if (is_string($val)) {
  6672. $val = array('*' => $val);
  6673. }
  6674. if (is_string($this->config[$key])) {
  6675. $this->config[$key] = array('*' => $this->config[$key]);
  6676. }
  6677. $this->config[$key] = array_merge($this->config[$key], $val);
  6678. if (isset($this->config[$key]['*'])) {
  6679. $wildcard = $this->config[$key]['*'];
  6680. unset($this->config[$key]['*']);
  6681. $this->config[$key]['*'] = $wildcard;
  6682. }
  6683. } else {
  6684. $this->config[$key] = $val;
  6685. }
  6686. } else {
  6687. $this->config[$key] = $val;
  6688. }
  6689. }
  6690. }
  6691. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6692. $this->repositories = array_reverse($this->repositories, true);
  6693. $newRepos = array_reverse($config['repositories'], true);
  6694. foreach ($newRepos as $name => $repository) {
  6695. if (false === $repository) {
  6696. $this->disableRepoByName($name);
  6697. continue;
  6698. }
  6699. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6700. $this->disableRepoByName(key($repository));
  6701. continue;
  6702. }
  6703. if (is_int($name)) {
  6704. $this->repositories[] = $repository;
  6705. } else {
  6706. if ($name === 'packagist') {
  6707. $this->repositories[$name . '.org'] = $repository;
  6708. } else {
  6709. $this->repositories[$name] = $repository;
  6710. }
  6711. }
  6712. }
  6713. $this->repositories = array_reverse($this->repositories, true);
  6714. }
  6715. }
  6716. public function getRepositories()
  6717. {
  6718. return $this->repositories;
  6719. }
  6720. public function get($key, $flags = 0)
  6721. {
  6722. switch ($key) {
  6723. case 'vendor-dir':
  6724. case 'bin-dir':
  6725. case 'process-timeout':
  6726. case 'data-dir':
  6727. case 'cache-dir':
  6728. case 'cache-files-dir':
  6729. case 'cache-repo-dir':
  6730. case 'cache-vcs-dir':
  6731. case 'cafile':
  6732. case 'capath':
  6733. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6734. $val = $this->getComposerEnv($env);
  6735. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6736. $val = Platform::expandPath($val);
  6737. if (substr($key, -4) !== '-dir') {
  6738. return $val;
  6739. }
  6740. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6741. case 'htaccess-protect':
  6742. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  6743. if (false === $value) {
  6744. $value = $this->config[$key];
  6745. }
  6746. return $value !== 'false' && (bool) $value;
  6747. case 'cache-ttl':
  6748. return (int) $this->config[$key];
  6749. case 'cache-files-maxsize':
  6750. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6751. throw new \RuntimeException(
  6752. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6753. );
  6754. }
  6755. $size = $matches[1];
  6756. if (isset($matches[2])) {
  6757. switch (strtolower($matches[2])) {
  6758. case 'g':
  6759. $size *= 1024;
  6760. case 'm':
  6761. $size *= 1024;
  6762. case 'k':
  6763. $size *= 1024;
  6764. break;
  6765. }
  6766. }
  6767. return $size;
  6768. case 'cache-files-ttl':
  6769. if (isset($this->config[$key])) {
  6770. return (int) $this->config[$key];
  6771. }
  6772. return (int) $this->config['cache-ttl'];
  6773. case 'home':
  6774. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6775. return rtrim($this->process($val, $flags), '/\\');
  6776. case 'bin-compat':
  6777. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6778. if (!in_array($value, array('auto', 'full'))) {
  6779. throw new \RuntimeException(
  6780. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6781. );
  6782. }
  6783. return $value;
  6784. case 'discard-changes':
  6785. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6786. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6787. throw new \RuntimeException(
  6788. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6789. );
  6790. }
  6791. if ('stash' === $env) {
  6792. return 'stash';
  6793. }
  6794. return $env !== 'false' && (bool) $env;
  6795. }
  6796. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6797. throw new \RuntimeException(
  6798. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6799. );
  6800. }
  6801. return $this->config[$key];
  6802. case 'github-protocols':
  6803. $protos = $this->config['github-protocols'];
  6804. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6805. unset($protos[$index]);
  6806. }
  6807. if (reset($protos) === 'http') {
  6808. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6809. }
  6810. return $protos;
  6811. case 'disable-tls':
  6812. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6813. case 'secure-http':
  6814. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6815. default:
  6816. if (!isset($this->config[$key])) {
  6817. return null;
  6818. }
  6819. return $this->process($this->config[$key], $flags);
  6820. }
  6821. }
  6822. public function all($flags = 0)
  6823. {
  6824. $all = array(
  6825. 'repositories' => $this->getRepositories(),
  6826. );
  6827. foreach (array_keys($this->config) as $key) {
  6828. $all['config'][$key] = $this->get($key, $flags);
  6829. }
  6830. return $all;
  6831. }
  6832. public function raw()
  6833. {
  6834. return array(
  6835. 'repositories' => $this->getRepositories(),
  6836. 'config' => $this->config,
  6837. );
  6838. }
  6839. public function has($key)
  6840. {
  6841. return array_key_exists($key, $this->config);
  6842. }
  6843. private function process($value, $flags)
  6844. {
  6845. $config = $this;
  6846. if (!is_string($value)) {
  6847. return $value;
  6848. }
  6849. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6850. return $config->get($match[1], $flags);
  6851. }, $value);
  6852. }
  6853. private function realpath($path)
  6854. {
  6855. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6856. return $path;
  6857. }
  6858. return $this->baseDir . '/' . $path;
  6859. }
  6860. private function getComposerEnv($var)
  6861. {
  6862. if ($this->useEnvironment) {
  6863. return getenv($var);
  6864. }
  6865. return false;
  6866. }
  6867. private function disableRepoByName($name)
  6868. {
  6869. if (isset($this->repositories[$name])) {
  6870. unset($this->repositories[$name]);
  6871. } elseif ($name === 'packagist') {
  6872. unset($this->repositories['packagist.org']);
  6873. }
  6874. }
  6875. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6876. {
  6877. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6878. return;
  6879. }
  6880. $scheme = parse_url($url, PHP_URL_SCHEME);
  6881. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6882. if ($this->get('secure-http')) {
  6883. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6884. } elseif ($io) {
  6885. $host = parse_url($url, PHP_URL_HOST);
  6886. if (!isset($this->warnedHosts[$host])) {
  6887. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6888. }
  6889. $this->warnedHosts[$host] = true;
  6890. }
  6891. }
  6892. }
  6893. }
  6894. <?php
  6895. namespace Composer\Config;
  6896. interface ConfigSourceInterface
  6897. {
  6898. public function addRepository($name, $config);
  6899. public function removeRepository($name);
  6900. public function addConfigSetting($name, $value);
  6901. public function removeConfigSetting($name);
  6902. public function addProperty($name, $value);
  6903. public function removeProperty($name);
  6904. public function addLink($type, $name, $value);
  6905. public function removeLink($type, $name);
  6906. public function getName();
  6907. }
  6908. <?php
  6909. namespace Composer\Config;
  6910. use Composer\Json\JsonFile;
  6911. use Composer\Json\JsonManipulator;
  6912. use Composer\Util\Silencer;
  6913. class JsonConfigSource implements ConfigSourceInterface
  6914. {
  6915. private $file;
  6916. private $authConfig;
  6917. public function __construct(JsonFile $file, $authConfig = false)
  6918. {
  6919. $this->file = $file;
  6920. $this->authConfig = $authConfig;
  6921. }
  6922. public function getName()
  6923. {
  6924. return $this->file->getPath();
  6925. }
  6926. public function addRepository($name, $config)
  6927. {
  6928. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6929. if (isset($config['repositories'])) {
  6930. foreach ($config['repositories'] as $index => $val) {
  6931. if ($index === $repo) {
  6932. continue;
  6933. }
  6934. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6935. unset($config['repositories'][$index]);
  6936. $config['repositories']['packagist.org'] = false;
  6937. break;
  6938. }
  6939. }
  6940. }
  6941. $config['repositories'][$repo] = $repoConfig;
  6942. });
  6943. }
  6944. public function removeRepository($name)
  6945. {
  6946. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6947. unset($config['repositories'][$repo]);
  6948. });
  6949. }
  6950. public function addConfigSetting($name, $value)
  6951. {
  6952. $authConfig = $this->authConfig;
  6953. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6954. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6955. list($key, $host) = explode('.', $key, 2);
  6956. if ($authConfig) {
  6957. $config[$key][$host] = $val;
  6958. } else {
  6959. $config['config'][$key][$host] = $val;
  6960. }
  6961. } else {
  6962. $config['config'][$key] = $val;
  6963. }
  6964. });
  6965. }
  6966. public function removeConfigSetting($name)
  6967. {
  6968. $authConfig = $this->authConfig;
  6969. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6970. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6971. list($key, $host) = explode('.', $key, 2);
  6972. if ($authConfig) {
  6973. unset($config[$key][$host]);
  6974. } else {
  6975. unset($config['config'][$key][$host]);
  6976. }
  6977. } else {
  6978. unset($config['config'][$key]);
  6979. }
  6980. });
  6981. }
  6982. public function addProperty($name, $value)
  6983. {
  6984. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6985. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  6986. $bits = explode('.', $key);
  6987. $last = array_pop($bits);
  6988. $arr = &$config[reset($bits)];
  6989. foreach ($bits as $bit) {
  6990. if (!isset($arr[$bit])) {
  6991. $arr[$bit] = array();
  6992. }
  6993. $arr = &$arr[$bit];
  6994. }
  6995. $arr[$last] = $val;
  6996. } else {
  6997. $config[$key] = $val;
  6998. }
  6999. });
  7000. }
  7001. public function removeProperty($name)
  7002. {
  7003. $authConfig = $this->authConfig;
  7004. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7005. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7006. $bits = explode('.', $key);
  7007. $last = array_pop($bits);
  7008. $arr = &$config[reset($bits)];
  7009. foreach ($bits as $bit) {
  7010. if (!isset($arr[$bit])) {
  7011. return;
  7012. }
  7013. $arr = &$arr[$bit];
  7014. }
  7015. unset($arr[$last]);
  7016. } else {
  7017. unset($config[$key]);
  7018. }
  7019. });
  7020. }
  7021. public function addLink($type, $name, $value)
  7022. {
  7023. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7024. $config[$type][$name] = $value;
  7025. });
  7026. }
  7027. public function removeLink($type, $name)
  7028. {
  7029. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7030. unset($config[$type][$name]);
  7031. });
  7032. }
  7033. protected function manipulateJson($method, $args, $fallback)
  7034. {
  7035. $args = func_get_args();
  7036. array_shift($args);
  7037. $fallback = array_pop($args);
  7038. if ($this->file->exists()) {
  7039. if (!is_writable($this->file->getPath())) {
  7040. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7041. }
  7042. if (!is_readable($this->file->getPath())) {
  7043. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7044. }
  7045. $contents = file_get_contents($this->file->getPath());
  7046. } elseif ($this->authConfig) {
  7047. $contents = "{\n}\n";
  7048. } else {
  7049. $contents = "{\n \"config\": {\n }\n}\n";
  7050. }
  7051. $manipulator = new JsonManipulator($contents);
  7052. $newFile = !$this->file->exists();
  7053. if ($this->authConfig && $method === 'addConfigSetting') {
  7054. $method = 'addSubNode';
  7055. list($mainNode, $name) = explode('.', $args[0], 2);
  7056. $args = array($mainNode, $name, $args[1]);
  7057. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7058. $method = 'removeSubNode';
  7059. list($mainNode, $name) = explode('.', $args[0], 2);
  7060. $args = array($mainNode, $name);
  7061. }
  7062. if (call_user_func_array(array($manipulator, $method), $args)) {
  7063. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7064. } else {
  7065. $config = $this->file->read();
  7066. $this->arrayUnshiftRef($args, $config);
  7067. call_user_func_array($fallback, $args);
  7068. $this->file->write($config);
  7069. }
  7070. if ($newFile) {
  7071. Silencer::call('chmod', $this->file->getPath(), 0600);
  7072. }
  7073. }
  7074. private function arrayUnshiftRef(&$array, &$value)
  7075. {
  7076. $return = array_unshift($array, '');
  7077. $array[0] = &$value;
  7078. return $return;
  7079. }
  7080. }
  7081. <?php
  7082. namespace Composer\Console;
  7083. use Composer\IO\NullIO;
  7084. use Composer\Util\Platform;
  7085. use Composer\Util\Silencer;
  7086. use Symfony\Component\Console\Application as BaseApplication;
  7087. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7088. use Symfony\Component\Console\Input\InputInterface;
  7089. use Symfony\Component\Console\Input\InputOption;
  7090. use Symfony\Component\Console\Output\OutputInterface;
  7091. use Composer\Command;
  7092. use Composer\Composer;
  7093. use Composer\Factory;
  7094. use Composer\IO\IOInterface;
  7095. use Composer\IO\ConsoleIO;
  7096. use Composer\Json\JsonValidationException;
  7097. use Composer\Util\ErrorHandler;
  7098. use Composer\EventDispatcher\ScriptExecutionException;
  7099. use Composer\Exception\NoSslException;
  7100. class Application extends BaseApplication
  7101. {
  7102. protected $composer;
  7103. protected $io;
  7104. private static $logo = ' ______
  7105. / ____/___ ____ ___ ____ ____ ________ _____
  7106. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7107. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7108. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7109. /_/
  7110. ';
  7111. private $hasPluginCommands = false;
  7112. private $disablePluginsByDefault = false;
  7113. public function __construct()
  7114. {
  7115. static $shutdownRegistered = false;
  7116. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7117. ini_set('xdebug.show_exception_trace', false);
  7118. ini_set('xdebug.scream', false);
  7119. }
  7120. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7121. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7122. }
  7123. if (!$shutdownRegistered) {
  7124. $shutdownRegistered = true;
  7125. register_shutdown_function(function () {
  7126. $lastError = error_get_last();
  7127. if ($lastError && $lastError['message'] &&
  7128. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7129. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7130. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7131. }
  7132. });
  7133. }
  7134. $this->io = new NullIO();
  7135. parent::__construct('Composer', Composer::VERSION);
  7136. }
  7137. public function run(InputInterface $input = null, OutputInterface $output = null)
  7138. {
  7139. if (null === $output) {
  7140. $output = Factory::createOutput();
  7141. }
  7142. return parent::run($input, $output);
  7143. }
  7144. public function doRun(InputInterface $input, OutputInterface $output)
  7145. {
  7146. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7147. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  7148. ErrorHandler::register($io);
  7149. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7150. $oldWorkingDir = getcwd();
  7151. chdir($newWorkDir);
  7152. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7153. }
  7154. $commandName = '';
  7155. if ($name = $this->getCommandName($input)) {
  7156. try {
  7157. $commandName = $this->find($name)->getName();
  7158. } catch (CommandNotFoundException $e) {
  7159. $commandName = false;
  7160. } catch (\InvalidArgumentException $e) {
  7161. }
  7162. }
  7163. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7164. $dir = dirname(getcwd());
  7165. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7166. while (dirname($dir) !== $dir && $dir !== $home) {
  7167. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7168. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7169. $oldWorkingDir = getcwd();
  7170. chdir($dir);
  7171. }
  7172. break;
  7173. }
  7174. $dir = dirname($dir);
  7175. }
  7176. }
  7177. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7178. try {
  7179. foreach ($this->getPluginCommands() as $command) {
  7180. if ($this->has($command->getName())) {
  7181. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7182. } else {
  7183. $this->add($command);
  7184. }
  7185. }
  7186. } catch (NoSslException $e) {
  7187. }
  7188. $this->hasPluginCommands = true;
  7189. }
  7190. $isProxyCommand = false;
  7191. if ($name = $this->getCommandName($input)) {
  7192. try {
  7193. $command = $this->find($name);
  7194. $commandName = $command->getName();
  7195. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7196. } catch (\InvalidArgumentException $e) {
  7197. }
  7198. }
  7199. if (!$isProxyCommand) {
  7200. $io->writeError(sprintf(
  7201. 'Running %s (%s) with %s on %s',
  7202. Composer::VERSION,
  7203. Composer::RELEASE_DATE,
  7204. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7205. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7206. ), true, IOInterface::DEBUG);
  7207. if (PHP_VERSION_ID < 50302) {
  7208. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7209. }
  7210. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7211. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7212. }
  7213. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7214. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  7215. }
  7216. if (getenv('COMPOSER_NO_INTERACTION')) {
  7217. $input->setInteractive(false);
  7218. }
  7219. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  7220. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7221. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7222. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7223. }
  7224. if ($uid = (int) getenv('SUDO_UID')) {
  7225. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7226. }
  7227. }
  7228. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7229. }
  7230. Silencer::call(function () use ($io) {
  7231. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7232. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7233. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  7234. }
  7235. });
  7236. $file = Factory::getComposerFile();
  7237. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7238. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7239. foreach ($composer['scripts'] as $script => $dummy) {
  7240. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7241. if ($this->has($script)) {
  7242. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7243. } else {
  7244. $description = null;
  7245. if (isset($composer['scripts-descriptions'][$script])) {
  7246. $description = $composer['scripts-descriptions'][$script];
  7247. }
  7248. $this->add(new Command\ScriptAliasCommand($script, $description));
  7249. }
  7250. }
  7251. }
  7252. }
  7253. }
  7254. }
  7255. try {
  7256. if ($input->hasParameterOption('--profile')) {
  7257. $startTime = microtime(true);
  7258. $this->io->enableDebugging($startTime);
  7259. }
  7260. $result = parent::doRun($input, $output);
  7261. if (isset($oldWorkingDir)) {
  7262. chdir($oldWorkingDir);
  7263. }
  7264. if (isset($startTime)) {
  7265. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7266. }
  7267. restore_error_handler();
  7268. return $result;
  7269. } catch (ScriptExecutionException $e) {
  7270. return $e->getCode();
  7271. } catch (\Exception $e) {
  7272. $this->hintCommonErrors($e);
  7273. restore_error_handler();
  7274. throw $e;
  7275. }
  7276. }
  7277. private function getNewWorkingDir(InputInterface $input)
  7278. {
  7279. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7280. if (false !== $workingDir && !is_dir($workingDir)) {
  7281. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7282. }
  7283. return $workingDir;
  7284. }
  7285. private function hintCommonErrors($exception)
  7286. {
  7287. $io = $this->getIO();
  7288. Silencer::suppress();
  7289. try {
  7290. $composer = $this->getComposer(false, true);
  7291. if ($composer) {
  7292. $config = $composer->getConfig();
  7293. $minSpaceFree = 1024 * 1024;
  7294. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7295. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7296. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7297. ) {
  7298. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7299. }
  7300. }
  7301. } catch (\Exception $e) {
  7302. }
  7303. Silencer::restore();
  7304. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7305. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7306. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  7307. }
  7308. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7309. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7310. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7311. }
  7312. }
  7313. public function getComposer($required = true, $disablePlugins = null)
  7314. {
  7315. if (null === $disablePlugins) {
  7316. $disablePlugins = $this->disablePluginsByDefault;
  7317. }
  7318. if (null === $this->composer) {
  7319. try {
  7320. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7321. } catch (\InvalidArgumentException $e) {
  7322. if ($required) {
  7323. $this->io->writeError($e->getMessage());
  7324. exit(1);
  7325. }
  7326. } catch (JsonValidationException $e) {
  7327. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7328. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7329. throw new JsonValidationException($message);
  7330. }
  7331. }
  7332. return $this->composer;
  7333. }
  7334. public function resetComposer()
  7335. {
  7336. $this->composer = null;
  7337. }
  7338. public function getIO()
  7339. {
  7340. return $this->io;
  7341. }
  7342. public function getHelp()
  7343. {
  7344. return self::$logo . parent::getHelp();
  7345. }
  7346. protected function getDefaultCommands()
  7347. {
  7348. $commands = array_merge(parent::getDefaultCommands(), array(
  7349. new Command\AboutCommand(),
  7350. new Command\ConfigCommand(),
  7351. new Command\DependsCommand(),
  7352. new Command\ProhibitsCommand(),
  7353. new Command\InitCommand(),
  7354. new Command\InstallCommand(),
  7355. new Command\CreateProjectCommand(),
  7356. new Command\UpdateCommand(),
  7357. new Command\SearchCommand(),
  7358. new Command\ValidateCommand(),
  7359. new Command\ShowCommand(),
  7360. new Command\SuggestsCommand(),
  7361. new Command\RequireCommand(),
  7362. new Command\DumpAutoloadCommand(),
  7363. new Command\StatusCommand(),
  7364. new Command\ArchiveCommand(),
  7365. new Command\DiagnoseCommand(),
  7366. new Command\RunScriptCommand(),
  7367. new Command\LicensesCommand(),
  7368. new Command\GlobalCommand(),
  7369. new Command\ClearCacheCommand(),
  7370. new Command\RemoveCommand(),
  7371. new Command\HomeCommand(),
  7372. new Command\ExecCommand(),
  7373. new Command\OutdatedCommand(),
  7374. new Command\CheckPlatformReqsCommand(),
  7375. ));
  7376. if ('phar:' === substr(__FILE__, 0, 5)) {
  7377. $commands[] = new Command\SelfUpdateCommand();
  7378. }
  7379. return $commands;
  7380. }
  7381. public function getLongVersion()
  7382. {
  7383. if (Composer::BRANCH_ALIAS_VERSION) {
  7384. return sprintf(
  7385. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7386. $this->getName(),
  7387. Composer::BRANCH_ALIAS_VERSION,
  7388. $this->getVersion(),
  7389. Composer::RELEASE_DATE
  7390. );
  7391. }
  7392. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7393. }
  7394. protected function getDefaultInputDefinition()
  7395. {
  7396. $definition = parent::getDefaultInputDefinition();
  7397. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7398. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7399. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7400. return $definition;
  7401. }
  7402. private function getPluginCommands()
  7403. {
  7404. $commands = array();
  7405. $composer = $this->getComposer(false, false);
  7406. if (null === $composer) {
  7407. $composer = Factory::createGlobal($this->io, false);
  7408. }
  7409. if (null !== $composer) {
  7410. $pm = $composer->getPluginManager();
  7411. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7412. $newCommands = $capability->getCommands();
  7413. if (!is_array($newCommands)) {
  7414. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7415. }
  7416. foreach ($newCommands as $command) {
  7417. if (!$command instanceof Command\BaseCommand) {
  7418. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7419. }
  7420. }
  7421. $commands = array_merge($commands, $newCommands);
  7422. }
  7423. }
  7424. return $commands;
  7425. }
  7426. }
  7427. <?php
  7428. namespace Composer\Console;
  7429. use Symfony\Component\Console\Formatter\OutputFormatter;
  7430. class HtmlOutputFormatter extends OutputFormatter
  7431. {
  7432. private static $availableForegroundColors = array(
  7433. 30 => 'black',
  7434. 31 => 'red',
  7435. 32 => 'green',
  7436. 33 => 'yellow',
  7437. 34 => 'blue',
  7438. 35 => 'magenta',
  7439. 36 => 'cyan',
  7440. 37 => 'white',
  7441. );
  7442. private static $availableBackgroundColors = array(
  7443. 40 => 'black',
  7444. 41 => 'red',
  7445. 42 => 'green',
  7446. 43 => 'yellow',
  7447. 44 => 'blue',
  7448. 45 => 'magenta',
  7449. 46 => 'cyan',
  7450. 47 => 'white',
  7451. );
  7452. private static $availableOptions = array(
  7453. 1 => 'bold',
  7454. 4 => 'underscore',
  7455. );
  7456. public function __construct(array $styles = array())
  7457. {
  7458. parent::__construct(true, $styles);
  7459. }
  7460. public function format($message)
  7461. {
  7462. $formatted = parent::format($message);
  7463. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7464. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7465. }
  7466. private function formatHtml($matches)
  7467. {
  7468. $out = '<span style="';
  7469. foreach (explode(';', $matches[1]) as $code) {
  7470. if (isset(self::$availableForegroundColors[$code])) {
  7471. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7472. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7473. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7474. } elseif (isset(self::$availableOptions[$code])) {
  7475. switch (self::$availableOptions[$code]) {
  7476. case 'bold':
  7477. $out .= 'font-weight:bold;';
  7478. break;
  7479. case 'underscore':
  7480. $out .= 'text-decoration:underline;';
  7481. break;
  7482. }
  7483. }
  7484. }
  7485. return $out.'">'.$matches[2].'</span>';
  7486. }
  7487. }
  7488. <?php
  7489. namespace Composer\DependencyResolver;
  7490. class Decisions implements \Iterator, \Countable
  7491. {
  7492. const DECISION_LITERAL = 0;
  7493. const DECISION_REASON = 1;
  7494. protected $pool;
  7495. protected $decisionMap;
  7496. protected $decisionQueue = array();
  7497. public function __construct($pool)
  7498. {
  7499. $this->pool = $pool;
  7500. $this->decisionMap = array();
  7501. }
  7502. public function decide($literal, $level, $why)
  7503. {
  7504. $this->addDecision($literal, $level);
  7505. $this->decisionQueue[] = array(
  7506. self::DECISION_LITERAL => $literal,
  7507. self::DECISION_REASON => $why,
  7508. );
  7509. }
  7510. public function satisfy($literal)
  7511. {
  7512. $packageId = abs($literal);
  7513. return (
  7514. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7515. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7516. );
  7517. }
  7518. public function conflict($literal)
  7519. {
  7520. $packageId = abs($literal);
  7521. return (
  7522. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7523. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7524. );
  7525. }
  7526. public function decided($literalOrPackageId)
  7527. {
  7528. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7529. }
  7530. public function undecided($literalOrPackageId)
  7531. {
  7532. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7533. }
  7534. public function decidedInstall($literalOrPackageId)
  7535. {
  7536. $packageId = abs($literalOrPackageId);
  7537. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7538. }
  7539. public function decisionLevel($literalOrPackageId)
  7540. {
  7541. $packageId = abs($literalOrPackageId);
  7542. if (isset($this->decisionMap[$packageId])) {
  7543. return abs($this->decisionMap[$packageId]);
  7544. }
  7545. return 0;
  7546. }
  7547. public function decisionRule($literalOrPackageId)
  7548. {
  7549. $packageId = abs($literalOrPackageId);
  7550. foreach ($this->decisionQueue as $i => $decision) {
  7551. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7552. return $decision[self::DECISION_REASON];
  7553. }
  7554. }
  7555. return null;
  7556. }
  7557. public function atOffset($queueOffset)
  7558. {
  7559. return $this->decisionQueue[$queueOffset];
  7560. }
  7561. public function validOffset($queueOffset)
  7562. {
  7563. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7564. }
  7565. public function lastReason()
  7566. {
  7567. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7568. }
  7569. public function lastLiteral()
  7570. {
  7571. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7572. }
  7573. public function reset()
  7574. {
  7575. while ($decision = array_pop($this->decisionQueue)) {
  7576. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7577. }
  7578. }
  7579. public function resetToOffset($offset)
  7580. {
  7581. while (count($this->decisionQueue) > $offset + 1) {
  7582. $decision = array_pop($this->decisionQueue);
  7583. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7584. }
  7585. }
  7586. public function revertLast()
  7587. {
  7588. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7589. array_pop($this->decisionQueue);
  7590. }
  7591. public function count()
  7592. {
  7593. return count($this->decisionQueue);
  7594. }
  7595. public function rewind()
  7596. {
  7597. end($this->decisionQueue);
  7598. }
  7599. public function current()
  7600. {
  7601. return current($this->decisionQueue);
  7602. }
  7603. public function key()
  7604. {
  7605. return key($this->decisionQueue);
  7606. }
  7607. public function next()
  7608. {
  7609. return prev($this->decisionQueue);
  7610. }
  7611. public function valid()
  7612. {
  7613. return false !== current($this->decisionQueue);
  7614. }
  7615. public function isEmpty()
  7616. {
  7617. return count($this->decisionQueue) === 0;
  7618. }
  7619. protected function addDecision($literal, $level)
  7620. {
  7621. $packageId = abs($literal);
  7622. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7623. if ($previousDecision != 0) {
  7624. $literalString = $this->pool->literalToString($literal);
  7625. $package = $this->pool->literalToPackage($literal);
  7626. throw new SolverBugException(
  7627. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7628. );
  7629. }
  7630. if ($literal > 0) {
  7631. $this->decisionMap[$packageId] = $level;
  7632. } else {
  7633. $this->decisionMap[$packageId] = -$level;
  7634. }
  7635. }
  7636. public function __toString()
  7637. {
  7638. $decisionMap = $this->decisionMap;
  7639. ksort($decisionMap);
  7640. $str = '[';
  7641. foreach ($decisionMap as $packageId => $level) {
  7642. $str .= $packageId.':'.$level.',';
  7643. }
  7644. $str .= ']';
  7645. return $str;
  7646. }
  7647. }
  7648. <?php
  7649. namespace Composer\DependencyResolver;
  7650. use Composer\Package\PackageInterface;
  7651. use Composer\Package\AliasPackage;
  7652. use Composer\Package\BasePackage;
  7653. use Composer\Semver\Constraint\Constraint;
  7654. class DefaultPolicy implements PolicyInterface
  7655. {
  7656. private $preferStable;
  7657. private $preferLowest;
  7658. public function __construct($preferStable = false, $preferLowest = false)
  7659. {
  7660. $this->preferStable = $preferStable;
  7661. $this->preferLowest = $preferLowest;
  7662. }
  7663. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7664. {
  7665. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7666. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7667. }
  7668. $constraint = new Constraint($operator, $b->getVersion());
  7669. $version = new Constraint('==', $a->getVersion());
  7670. return $constraint->matchSpecific($version, true);
  7671. }
  7672. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7673. {
  7674. $packages = array();
  7675. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7676. if ($candidate !== $package) {
  7677. $packages[] = $candidate;
  7678. }
  7679. }
  7680. return $packages;
  7681. }
  7682. public function getPriority(Pool $pool, PackageInterface $package)
  7683. {
  7684. return $pool->getPriority($package->getRepository());
  7685. }
  7686. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7687. {
  7688. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7689. foreach ($packages as &$literals) {
  7690. $policy = $this;
  7691. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7692. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7693. });
  7694. }
  7695. foreach ($packages as &$literals) {
  7696. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7697. $literals = $this->pruneToBestVersion($pool, $literals);
  7698. $literals = $this->pruneRemoteAliases($pool, $literals);
  7699. }
  7700. $selected = call_user_func_array('array_merge', $packages);
  7701. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7702. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7703. });
  7704. return $selected;
  7705. }
  7706. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7707. {
  7708. $packages = array();
  7709. foreach ($literals as $literal) {
  7710. $packageName = $pool->literalToPackage($literal)->getName();
  7711. if (!isset($packages[$packageName])) {
  7712. $packages[$packageName] = array();
  7713. }
  7714. if (isset($installedMap[abs($literal)])) {
  7715. array_unshift($packages[$packageName], $literal);
  7716. } else {
  7717. $packages[$packageName][] = $literal;
  7718. }
  7719. }
  7720. return $packages;
  7721. }
  7722. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7723. {
  7724. if ($a->getRepository() === $b->getRepository()) {
  7725. if ($a->getName() === $b->getName()) {
  7726. $aAliased = $a instanceof AliasPackage;
  7727. $bAliased = $b instanceof AliasPackage;
  7728. if ($aAliased && !$bAliased) {
  7729. return -1;
  7730. }
  7731. if (!$aAliased && $bAliased) {
  7732. return 1;
  7733. }
  7734. }
  7735. if (!$ignoreReplace) {
  7736. if ($this->replaces($a, $b)) {
  7737. return 1;
  7738. }
  7739. if ($this->replaces($b, $a)) {
  7740. return -1;
  7741. }
  7742. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7743. $requiredVendor = substr($requiredPackage, 0, $pos);
  7744. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7745. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7746. if ($bIsSameVendor !== $aIsSameVendor) {
  7747. return $aIsSameVendor ? -1 : 1;
  7748. }
  7749. }
  7750. }
  7751. if ($a->id === $b->id) {
  7752. return 0;
  7753. }
  7754. return ($a->id < $b->id) ? -1 : 1;
  7755. }
  7756. if (isset($installedMap[$a->id])) {
  7757. return -1;
  7758. }
  7759. if (isset($installedMap[$b->id])) {
  7760. return 1;
  7761. }
  7762. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7763. }
  7764. protected function replaces(PackageInterface $source, PackageInterface $target)
  7765. {
  7766. foreach ($source->getReplaces() as $link) {
  7767. if ($link->getTarget() === $target->getName()
  7768. ) {
  7769. return true;
  7770. }
  7771. }
  7772. return false;
  7773. }
  7774. protected function pruneToBestVersion(Pool $pool, $literals)
  7775. {
  7776. $operator = $this->preferLowest ? '<' : '>';
  7777. $bestLiterals = array($literals[0]);
  7778. $bestPackage = $pool->literalToPackage($literals[0]);
  7779. foreach ($literals as $i => $literal) {
  7780. if (0 === $i) {
  7781. continue;
  7782. }
  7783. $package = $pool->literalToPackage($literal);
  7784. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7785. $bestPackage = $package;
  7786. $bestLiterals = array($literal);
  7787. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7788. $bestLiterals[] = $literal;
  7789. }
  7790. }
  7791. return $bestLiterals;
  7792. }
  7793. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7794. {
  7795. $selected = array();
  7796. $priority = null;
  7797. foreach ($literals as $literal) {
  7798. $package = $pool->literalToPackage($literal);
  7799. if (isset($installedMap[$package->id])) {
  7800. $selected[] = $literal;
  7801. continue;
  7802. }
  7803. if (null === $priority) {
  7804. $priority = $this->getPriority($pool, $package);
  7805. }
  7806. if ($this->getPriority($pool, $package) != $priority) {
  7807. break;
  7808. }
  7809. $selected[] = $literal;
  7810. }
  7811. return $selected;
  7812. }
  7813. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7814. {
  7815. $hasLocalAlias = false;
  7816. foreach ($literals as $literal) {
  7817. $package = $pool->literalToPackage($literal);
  7818. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7819. $hasLocalAlias = true;
  7820. break;
  7821. }
  7822. }
  7823. if (!$hasLocalAlias) {
  7824. return $literals;
  7825. }
  7826. $selected = array();
  7827. foreach ($literals as $literal) {
  7828. $package = $pool->literalToPackage($literal);
  7829. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7830. $selected[] = $literal;
  7831. }
  7832. }
  7833. return $selected;
  7834. }
  7835. }
  7836. <?php
  7837. namespace Composer\DependencyResolver;
  7838. use Composer\Package\PackageInterface;
  7839. use Composer\Package\Link;
  7840. class GenericRule extends Rule
  7841. {
  7842. protected $literals;
  7843. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7844. {
  7845. parent::__construct($reason, $reasonData, $job);
  7846. sort($literals);
  7847. $this->literals = $literals;
  7848. }
  7849. public function getLiterals()
  7850. {
  7851. return $this->literals;
  7852. }
  7853. public function getHash()
  7854. {
  7855. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7856. return $data['hash'];
  7857. }
  7858. public function equals(Rule $rule)
  7859. {
  7860. return $this->literals === $rule->getLiterals();
  7861. }
  7862. public function isAssertion()
  7863. {
  7864. return 1 === count($this->literals);
  7865. }
  7866. public function __toString()
  7867. {
  7868. $result = $this->isDisabled() ? 'disabled(' : '(';
  7869. foreach ($this->literals as $i => $literal) {
  7870. if ($i != 0) {
  7871. $result .= '|';
  7872. }
  7873. $result .= $literal;
  7874. }
  7875. $result .= ')';
  7876. return $result;
  7877. }
  7878. }
  7879. <?php
  7880. namespace Composer\DependencyResolver\Operation;
  7881. use Composer\Package\PackageInterface;
  7882. class InstallOperation extends SolverOperation
  7883. {
  7884. protected $package;
  7885. public function __construct(PackageInterface $package, $reason = null)
  7886. {
  7887. parent::__construct($reason);
  7888. $this->package = $package;
  7889. }
  7890. public function getPackage()
  7891. {
  7892. return $this->package;
  7893. }
  7894. public function getJobType()
  7895. {
  7896. return 'install';
  7897. }
  7898. public function __toString()
  7899. {
  7900. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7901. }
  7902. }
  7903. <?php
  7904. namespace Composer\DependencyResolver\Operation;
  7905. use Composer\Package\AliasPackage;
  7906. use Composer\Package\PackageInterface;
  7907. class MarkAliasInstalledOperation extends SolverOperation
  7908. {
  7909. protected $package;
  7910. public function __construct(AliasPackage $package, $reason = null)
  7911. {
  7912. parent::__construct($reason);
  7913. $this->package = $package;
  7914. }
  7915. public function getPackage()
  7916. {
  7917. return $this->package;
  7918. }
  7919. public function getJobType()
  7920. {
  7921. return 'markAliasInstalled';
  7922. }
  7923. public function __toString()
  7924. {
  7925. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7926. }
  7927. }
  7928. <?php
  7929. namespace Composer\DependencyResolver\Operation;
  7930. use Composer\Package\AliasPackage;
  7931. use Composer\Package\PackageInterface;
  7932. class MarkAliasUninstalledOperation extends SolverOperation
  7933. {
  7934. protected $package;
  7935. public function __construct(AliasPackage $package, $reason = null)
  7936. {
  7937. parent::__construct($reason);
  7938. $this->package = $package;
  7939. }
  7940. public function getPackage()
  7941. {
  7942. return $this->package;
  7943. }
  7944. public function getJobType()
  7945. {
  7946. return 'markAliasUninstalled';
  7947. }
  7948. public function __toString()
  7949. {
  7950. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7951. }
  7952. }
  7953. <?php
  7954. namespace Composer\DependencyResolver\Operation;
  7955. interface OperationInterface
  7956. {
  7957. public function getJobType();
  7958. public function getReason();
  7959. public function __toString();
  7960. }
  7961. <?php
  7962. namespace Composer\DependencyResolver\Operation;
  7963. use Composer\Package\PackageInterface;
  7964. abstract class SolverOperation implements OperationInterface
  7965. {
  7966. protected $reason;
  7967. public function __construct($reason = null)
  7968. {
  7969. $this->reason = $reason;
  7970. }
  7971. public function getReason()
  7972. {
  7973. return $this->reason;
  7974. }
  7975. protected function formatVersion(PackageInterface $package)
  7976. {
  7977. return $package->getFullPrettyVersion();
  7978. }
  7979. }
  7980. <?php
  7981. namespace Composer\DependencyResolver\Operation;
  7982. use Composer\Package\PackageInterface;
  7983. class UninstallOperation extends SolverOperation
  7984. {
  7985. protected $package;
  7986. public function __construct(PackageInterface $package, $reason = null)
  7987. {
  7988. parent::__construct($reason);
  7989. $this->package = $package;
  7990. }
  7991. public function getPackage()
  7992. {
  7993. return $this->package;
  7994. }
  7995. public function getJobType()
  7996. {
  7997. return 'uninstall';
  7998. }
  7999. public function __toString()
  8000. {
  8001. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8002. }
  8003. }
  8004. <?php
  8005. namespace Composer\DependencyResolver\Operation;
  8006. use Composer\Package\PackageInterface;
  8007. class UpdateOperation extends SolverOperation
  8008. {
  8009. protected $initialPackage;
  8010. protected $targetPackage;
  8011. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8012. {
  8013. parent::__construct($reason);
  8014. $this->initialPackage = $initial;
  8015. $this->targetPackage = $target;
  8016. }
  8017. public function getInitialPackage()
  8018. {
  8019. return $this->initialPackage;
  8020. }
  8021. public function getTargetPackage()
  8022. {
  8023. return $this->targetPackage;
  8024. }
  8025. public function getJobType()
  8026. {
  8027. return 'update';
  8028. }
  8029. public function __toString()
  8030. {
  8031. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8032. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8033. }
  8034. }
  8035. <?php
  8036. namespace Composer\DependencyResolver;
  8037. use Composer\Package\PackageInterface;
  8038. interface PolicyInterface
  8039. {
  8040. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8041. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8042. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8043. }
  8044. <?php
  8045. namespace Composer\DependencyResolver;
  8046. use Composer\Package\BasePackage;
  8047. use Composer\Package\AliasPackage;
  8048. use Composer\Package\Version\VersionParser;
  8049. use Composer\Semver\Constraint\ConstraintInterface;
  8050. use Composer\Semver\Constraint\Constraint;
  8051. use Composer\Semver\Constraint\EmptyConstraint;
  8052. use Composer\Repository\RepositoryInterface;
  8053. use Composer\Repository\CompositeRepository;
  8054. use Composer\Repository\ComposerRepository;
  8055. use Composer\Repository\InstalledRepositoryInterface;
  8056. use Composer\Repository\PlatformRepository;
  8057. use Composer\Package\PackageInterface;
  8058. class Pool implements \Countable
  8059. {
  8060. const MATCH_NAME = -1;
  8061. const MATCH_NONE = 0;
  8062. const MATCH = 1;
  8063. const MATCH_PROVIDE = 2;
  8064. const MATCH_REPLACE = 3;
  8065. const MATCH_FILTERED = 4;
  8066. protected $repositories = array();
  8067. protected $providerRepos = array();
  8068. protected $packages = array();
  8069. protected $packageByName = array();
  8070. protected $packageByExactName = array();
  8071. protected $acceptableStabilities;
  8072. protected $stabilityFlags;
  8073. protected $versionParser;
  8074. protected $providerCache = array();
  8075. protected $filterRequires;
  8076. protected $whitelist = null;
  8077. protected $id = 1;
  8078. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8079. {
  8080. $this->versionParser = new VersionParser;
  8081. $this->acceptableStabilities = array();
  8082. foreach (BasePackage::$stabilities as $stability => $value) {
  8083. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8084. $this->acceptableStabilities[$stability] = $value;
  8085. }
  8086. }
  8087. $this->stabilityFlags = $stabilityFlags;
  8088. $this->filterRequires = $filterRequires;
  8089. foreach ($filterRequires as $name => $constraint) {
  8090. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8091. unset($this->filterRequires[$name]);
  8092. }
  8093. }
  8094. }
  8095. public function setWhitelist($whitelist)
  8096. {
  8097. $this->whitelist = $whitelist;
  8098. $this->providerCache = array();
  8099. }
  8100. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8101. {
  8102. if ($repo instanceof CompositeRepository) {
  8103. $repos = $repo->getRepositories();
  8104. } else {
  8105. $repos = array($repo);
  8106. }
  8107. foreach ($repos as $repo) {
  8108. $this->repositories[] = $repo;
  8109. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8110. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8111. $this->providerRepos[] = $repo;
  8112. $repo->setRootAliases($rootAliases);
  8113. $repo->resetPackageIds();
  8114. } else {
  8115. foreach ($repo->getPackages() as $package) {
  8116. $names = $package->getNames();
  8117. $stability = $package->getStability();
  8118. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8119. $package->setId($this->id++);
  8120. $this->packages[] = $package;
  8121. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8122. foreach ($names as $provided) {
  8123. $this->packageByName[$provided][] = $package;
  8124. }
  8125. $name = $package->getName();
  8126. if (isset($rootAliases[$name][$package->getVersion()])) {
  8127. $alias = $rootAliases[$name][$package->getVersion()];
  8128. if ($package instanceof AliasPackage) {
  8129. $package = $package->getAliasOf();
  8130. }
  8131. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8132. $aliasPackage->setRootPackageAlias(true);
  8133. $aliasPackage->setId($this->id++);
  8134. $package->getRepository()->addPackage($aliasPackage);
  8135. $this->packages[] = $aliasPackage;
  8136. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8137. foreach ($aliasPackage->getNames() as $name) {
  8138. $this->packageByName[$name][] = $aliasPackage;
  8139. }
  8140. }
  8141. }
  8142. }
  8143. }
  8144. }
  8145. }
  8146. public function getPriority(RepositoryInterface $repo)
  8147. {
  8148. $priority = array_search($repo, $this->repositories, true);
  8149. if (false === $priority) {
  8150. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8151. }
  8152. return -$priority;
  8153. }
  8154. public function packageById($id)
  8155. {
  8156. return $this->packages[$id - 1];
  8157. }
  8158. public function count()
  8159. {
  8160. return count($this->packages);
  8161. }
  8162. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8163. {
  8164. if ($bypassFilters) {
  8165. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8166. }
  8167. $key = ((int) $mustMatchName).$constraint;
  8168. if (isset($this->providerCache[$name][$key])) {
  8169. return $this->providerCache[$name][$key];
  8170. }
  8171. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8172. }
  8173. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8174. {
  8175. $candidates = array();
  8176. foreach ($this->providerRepos as $repo) {
  8177. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8178. $candidates[] = $candidate;
  8179. if ($candidate->id < 1) {
  8180. $candidate->setId($this->id++);
  8181. $this->packages[$this->id - 2] = $candidate;
  8182. }
  8183. }
  8184. }
  8185. if ($mustMatchName) {
  8186. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8187. return $candidate->getName() == $name;
  8188. });
  8189. if (isset($this->packageByExactName[$name])) {
  8190. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8191. }
  8192. } elseif (isset($this->packageByName[$name])) {
  8193. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8194. }
  8195. $matches = $provideMatches = array();
  8196. $nameMatch = false;
  8197. foreach ($candidates as $candidate) {
  8198. $aliasOfCandidate = null;
  8199. if ($candidate instanceof AliasPackage) {
  8200. $aliasOfCandidate = $candidate->getAliasOf();
  8201. }
  8202. if ($this->whitelist !== null && !$bypassFilters && (
  8203. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8204. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8205. )) {
  8206. continue;
  8207. }
  8208. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8209. case self::MATCH_NONE:
  8210. break;
  8211. case self::MATCH_NAME:
  8212. $nameMatch = true;
  8213. break;
  8214. case self::MATCH:
  8215. $nameMatch = true;
  8216. $matches[] = $candidate;
  8217. break;
  8218. case self::MATCH_PROVIDE:
  8219. $provideMatches[] = $candidate;
  8220. break;
  8221. case self::MATCH_REPLACE:
  8222. $matches[] = $candidate;
  8223. break;
  8224. case self::MATCH_FILTERED:
  8225. break;
  8226. default:
  8227. throw new \UnexpectedValueException('Unexpected match type');
  8228. }
  8229. }
  8230. if ($nameMatch) {
  8231. return $matches;
  8232. }
  8233. return array_merge($matches, $provideMatches);
  8234. }
  8235. public function literalToPackage($literal)
  8236. {
  8237. $packageId = abs($literal);
  8238. return $this->packageById($packageId);
  8239. }
  8240. public function literalToPrettyString($literal, $installedMap)
  8241. {
  8242. $package = $this->literalToPackage($literal);
  8243. if (isset($installedMap[$package->id])) {
  8244. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8245. } else {
  8246. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8247. }
  8248. return $prefix.' '.$package->getPrettyString();
  8249. }
  8250. public function isPackageAcceptable($name, $stability)
  8251. {
  8252. foreach ((array) $name as $n) {
  8253. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8254. return true;
  8255. }
  8256. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8257. return true;
  8258. }
  8259. }
  8260. return false;
  8261. }
  8262. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8263. {
  8264. $candidateName = $candidate->getName();
  8265. $candidateVersion = $candidate->getVersion();
  8266. $isDev = $candidate->getStability() === 'dev';
  8267. $isAlias = $candidate instanceof AliasPackage;
  8268. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8269. $requireFilter = $this->filterRequires[$name];
  8270. } else {
  8271. $requireFilter = new EmptyConstraint;
  8272. }
  8273. if ($candidateName === $name) {
  8274. $pkgConstraint = new Constraint('==', $candidateVersion);
  8275. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8276. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8277. }
  8278. return self::MATCH_NAME;
  8279. }
  8280. $provides = $candidate->getProvides();
  8281. $replaces = $candidate->getReplaces();
  8282. if (isset($replaces[0]) || isset($provides[0])) {
  8283. foreach ($provides as $link) {
  8284. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8285. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8286. }
  8287. }
  8288. foreach ($replaces as $link) {
  8289. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8290. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8291. }
  8292. }
  8293. return self::MATCH_NONE;
  8294. }
  8295. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8296. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8297. }
  8298. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8299. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8300. }
  8301. return self::MATCH_NONE;
  8302. }
  8303. }
  8304. <?php
  8305. namespace Composer\DependencyResolver;
  8306. use Composer\Package\CompletePackageInterface;
  8307. class Problem
  8308. {
  8309. protected $reasonSeen;
  8310. protected $reasons = array();
  8311. protected $section = 0;
  8312. protected $pool;
  8313. public function __construct(Pool $pool)
  8314. {
  8315. $this->pool = $pool;
  8316. }
  8317. public function addRule(Rule $rule)
  8318. {
  8319. $this->addReason(spl_object_hash($rule), array(
  8320. 'rule' => $rule,
  8321. 'job' => $rule->getJob(),
  8322. ));
  8323. }
  8324. public function getReasons()
  8325. {
  8326. return $this->reasons;
  8327. }
  8328. public function getPrettyString(array $installedMap = array())
  8329. {
  8330. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8331. if (count($reasons) === 1) {
  8332. reset($reasons);
  8333. $reason = current($reasons);
  8334. $rule = $reason['rule'];
  8335. $job = $reason['job'];
  8336. if (isset($job['constraint'])) {
  8337. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8338. } else {
  8339. $packages = array();
  8340. }
  8341. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8342. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  8343. $version = phpversion();
  8344. $available = $this->pool->whatProvides($job['packageName']);
  8345. if (count($available)) {
  8346. $firstAvailable = reset($available);
  8347. $version = $firstAvailable->getPrettyVersion();
  8348. $extra = $firstAvailable->getExtra();
  8349. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8350. $version .= '; ' . $firstAvailable->getDescription();
  8351. }
  8352. }
  8353. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  8354. if (defined('HHVM_VERSION') || count($available)) {
  8355. return $msg . 'your HHVM version does not satisfy that requirement.';
  8356. }
  8357. if ($job['packageName'] === 'hhvm') {
  8358. return $msg . 'you are running this with PHP and not HHVM.';
  8359. }
  8360. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8361. }
  8362. if (0 === stripos($job['packageName'], 'ext-')) {
  8363. if (false !== strpos($job['packageName'], ' ')) {
  8364. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  8365. }
  8366. $ext = substr($job['packageName'], 4);
  8367. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8368. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8369. }
  8370. if (0 === stripos($job['packageName'], 'lib-')) {
  8371. if (strtolower($job['packageName']) === 'lib-icu') {
  8372. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  8373. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8374. }
  8375. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8376. }
  8377. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8378. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8379. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8380. }
  8381. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8382. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8383. }
  8384. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8385. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8386. }
  8387. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8388. }
  8389. }
  8390. $messages = array();
  8391. foreach ($reasons as $reason) {
  8392. $rule = $reason['rule'];
  8393. $job = $reason['job'];
  8394. if ($job) {
  8395. $messages[] = $this->jobToText($job);
  8396. } elseif ($rule) {
  8397. if ($rule instanceof Rule) {
  8398. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8399. }
  8400. }
  8401. }
  8402. return "\n - ".implode("\n - ", $messages);
  8403. }
  8404. protected function addReason($id, $reason)
  8405. {
  8406. if (!isset($this->reasonSeen[$id])) {
  8407. $this->reasonSeen[$id] = true;
  8408. $this->reasons[$this->section][] = $reason;
  8409. }
  8410. }
  8411. public function nextSection()
  8412. {
  8413. $this->section++;
  8414. }
  8415. protected function jobToText($job)
  8416. {
  8417. switch ($job['cmd']) {
  8418. case 'install':
  8419. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8420. if (!$packages) {
  8421. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8422. }
  8423. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8424. case 'update':
  8425. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8426. case 'remove':
  8427. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8428. }
  8429. if (isset($job['constraint'])) {
  8430. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8431. } else {
  8432. $packages = array();
  8433. }
  8434. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8435. }
  8436. protected function getPackageList($packages)
  8437. {
  8438. $prepared = array();
  8439. foreach ($packages as $package) {
  8440. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8441. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8442. }
  8443. foreach ($prepared as $name => $package) {
  8444. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8445. }
  8446. return implode(', ', $prepared);
  8447. }
  8448. protected function constraintToText($constraint)
  8449. {
  8450. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8451. }
  8452. }
  8453. <?php
  8454. namespace Composer\DependencyResolver;
  8455. use Composer\Semver\Constraint\ConstraintInterface;
  8456. class Request
  8457. {
  8458. protected $jobs;
  8459. public function __construct()
  8460. {
  8461. $this->jobs = array();
  8462. }
  8463. public function install($packageName, ConstraintInterface $constraint = null)
  8464. {
  8465. $this->addJob($packageName, 'install', $constraint);
  8466. }
  8467. public function update($packageName, ConstraintInterface $constraint = null)
  8468. {
  8469. $this->addJob($packageName, 'update', $constraint);
  8470. }
  8471. public function remove($packageName, ConstraintInterface $constraint = null)
  8472. {
  8473. $this->addJob($packageName, 'remove', $constraint);
  8474. }
  8475. public function fix($packageName, ConstraintInterface $constraint = null)
  8476. {
  8477. $this->addJob($packageName, 'install', $constraint, true);
  8478. }
  8479. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8480. {
  8481. $packageName = strtolower($packageName);
  8482. $this->jobs[] = array(
  8483. 'cmd' => $cmd,
  8484. 'packageName' => $packageName,
  8485. 'constraint' => $constraint,
  8486. 'fixed' => $fixed,
  8487. );
  8488. }
  8489. public function updateAll()
  8490. {
  8491. $this->jobs[] = array('cmd' => 'update-all');
  8492. }
  8493. public function getJobs()
  8494. {
  8495. return $this->jobs;
  8496. }
  8497. }
  8498. <?php
  8499. namespace Composer\DependencyResolver;
  8500. use Composer\Package\CompletePackage;
  8501. use Composer\Package\Link;
  8502. use Composer\Package\PackageInterface;
  8503. abstract class Rule
  8504. {
  8505. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8506. const RULE_JOB_INSTALL = 2;
  8507. const RULE_JOB_REMOVE = 3;
  8508. const RULE_PACKAGE_CONFLICT = 6;
  8509. const RULE_PACKAGE_REQUIRES = 7;
  8510. const RULE_PACKAGE_OBSOLETES = 8;
  8511. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8512. const RULE_PACKAGE_SAME_NAME = 10;
  8513. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8514. const RULE_LEARNED = 12;
  8515. const RULE_PACKAGE_ALIAS = 13;
  8516. const BITFIELD_TYPE = 0;
  8517. const BITFIELD_REASON = 8;
  8518. const BITFIELD_DISABLED = 16;
  8519. protected $bitfield;
  8520. protected $job;
  8521. protected $reasonData;
  8522. public function __construct($reason, $reasonData, $job = null)
  8523. {
  8524. $this->reasonData = $reasonData;
  8525. if ($job) {
  8526. $this->job = $job;
  8527. }
  8528. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8529. ($reason << self::BITFIELD_REASON) |
  8530. (255 << self::BITFIELD_TYPE);
  8531. }
  8532. abstract public function getLiterals();
  8533. abstract public function getHash();
  8534. public function getJob()
  8535. {
  8536. return $this->job;
  8537. }
  8538. abstract public function equals(Rule $rule);
  8539. public function getReason()
  8540. {
  8541. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8542. }
  8543. public function getReasonData()
  8544. {
  8545. return $this->reasonData;
  8546. }
  8547. public function getRequiredPackage()
  8548. {
  8549. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8550. return $this->reasonData;
  8551. }
  8552. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8553. return $this->reasonData->getTarget();
  8554. }
  8555. }
  8556. public function setType($type)
  8557. {
  8558. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8559. }
  8560. public function getType()
  8561. {
  8562. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8563. }
  8564. public function disable()
  8565. {
  8566. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8567. }
  8568. public function enable()
  8569. {
  8570. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  8571. }
  8572. public function isDisabled()
  8573. {
  8574. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8575. }
  8576. public function isEnabled()
  8577. {
  8578. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8579. }
  8580. abstract public function isAssertion();
  8581. public function getPrettyString(Pool $pool, array $installedMap = array())
  8582. {
  8583. $literals = $this->getLiterals();
  8584. $ruleText = '';
  8585. foreach ($literals as $i => $literal) {
  8586. if ($i != 0) {
  8587. $ruleText .= '|';
  8588. }
  8589. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8590. }
  8591. switch ($this->getReason()) {
  8592. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8593. return $ruleText;
  8594. case self::RULE_JOB_INSTALL:
  8595. return "Install command rule ($ruleText)";
  8596. case self::RULE_JOB_REMOVE:
  8597. return "Remove command rule ($ruleText)";
  8598. case self::RULE_PACKAGE_CONFLICT:
  8599. $package1 = $pool->literalToPackage($literals[0]);
  8600. $package2 = $pool->literalToPackage($literals[1]);
  8601. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8602. case self::RULE_PACKAGE_REQUIRES:
  8603. $sourceLiteral = array_shift($literals);
  8604. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8605. $requires = array();
  8606. foreach ($literals as $literal) {
  8607. $requires[] = $pool->literalToPackage($literal);
  8608. }
  8609. $text = $this->reasonData->getPrettyString($sourcePackage);
  8610. if ($requires) {
  8611. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8612. } else {
  8613. $targetName = $this->reasonData->getTarget();
  8614. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8615. if (defined('HHVM_VERSION')) {
  8616. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8617. }
  8618. $packages = $pool->whatProvides($targetName);
  8619. $package = count($packages) ? current($packages) : phpversion();
  8620. if ($targetName === 'hhvm') {
  8621. if ($package instanceof CompletePackage) {
  8622. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8623. } else {
  8624. return $text . ' -> you are running this with PHP and not HHVM.';
  8625. }
  8626. }
  8627. if (!($package instanceof CompletePackage)) {
  8628. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8629. }
  8630. $extra = $package->getExtra();
  8631. if (!empty($extra['config.platform'])) {
  8632. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8633. } else {
  8634. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8635. }
  8636. return $text;
  8637. }
  8638. if (0 === strpos($targetName, 'ext-')) {
  8639. $ext = substr($targetName, 4);
  8640. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8641. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8642. }
  8643. if (0 === strpos($targetName, 'lib-')) {
  8644. $lib = substr($targetName, 4);
  8645. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  8646. }
  8647. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8648. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8649. }
  8650. return $text . ' -> no matching package found.';
  8651. }
  8652. return $text;
  8653. case self::RULE_PACKAGE_OBSOLETES:
  8654. return $ruleText;
  8655. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8656. return $ruleText;
  8657. case self::RULE_PACKAGE_SAME_NAME:
  8658. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8659. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8660. return $ruleText;
  8661. case self::RULE_LEARNED:
  8662. return 'Conclusion: '.$ruleText;
  8663. case self::RULE_PACKAGE_ALIAS:
  8664. return $ruleText;
  8665. default:
  8666. return '('.$ruleText.')';
  8667. }
  8668. }
  8669. protected function formatPackagesUnique($pool, array $packages)
  8670. {
  8671. $prepared = array();
  8672. foreach ($packages as $package) {
  8673. if (!is_object($package)) {
  8674. $package = $pool->literalToPackage($package);
  8675. }
  8676. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8677. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8678. }
  8679. foreach ($prepared as $name => $package) {
  8680. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8681. }
  8682. return implode(', ', $prepared);
  8683. }
  8684. }
  8685. <?php
  8686. namespace Composer\DependencyResolver;
  8687. use Composer\Package\PackageInterface;
  8688. use Composer\Package\Link;
  8689. class Rule2Literals extends Rule
  8690. {
  8691. protected $literal1;
  8692. protected $literal2;
  8693. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8694. {
  8695. parent::__construct($reason, $reasonData, $job);
  8696. if ($literal1 < $literal2) {
  8697. $this->literal1 = $literal1;
  8698. $this->literal2 = $literal2;
  8699. } else {
  8700. $this->literal1 = $literal2;
  8701. $this->literal2 = $literal1;
  8702. }
  8703. }
  8704. public function getLiterals()
  8705. {
  8706. return array($this->literal1, $this->literal2);
  8707. }
  8708. public function getHash()
  8709. {
  8710. return $this->literal1.','.$this->literal2;
  8711. }
  8712. public function equals(Rule $rule)
  8713. {
  8714. if ($rule instanceof self) {
  8715. if ($this->literal1 !== $rule->literal1) {
  8716. return false;
  8717. }
  8718. if ($this->literal2 !== $rule->literal2) {
  8719. return false;
  8720. }
  8721. return true;
  8722. }
  8723. $literals = $rule->getLiterals();
  8724. if (2 != count($literals)) {
  8725. return false;
  8726. }
  8727. if ($this->literal1 !== $literals[0]) {
  8728. return false;
  8729. }
  8730. if ($this->literal2 !== $literals[1]) {
  8731. return false;
  8732. }
  8733. return true;
  8734. }
  8735. public function isAssertion()
  8736. {
  8737. return false;
  8738. }
  8739. public function __toString()
  8740. {
  8741. $result = $this->isDisabled() ? 'disabled(' : '(';
  8742. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8743. return $result;
  8744. }
  8745. }
  8746. <?php
  8747. namespace Composer\DependencyResolver;
  8748. class RuleSet implements \IteratorAggregate, \Countable
  8749. {
  8750. const TYPE_PACKAGE = 0;
  8751. const TYPE_JOB = 1;
  8752. const TYPE_LEARNED = 4;
  8753. public $ruleById;
  8754. protected static $types = array(
  8755. 255 => 'UNKNOWN',
  8756. self::TYPE_PACKAGE => 'PACKAGE',
  8757. self::TYPE_JOB => 'JOB',
  8758. self::TYPE_LEARNED => 'LEARNED',
  8759. );
  8760. protected $rules;
  8761. protected $nextRuleId;
  8762. protected $rulesByHash;
  8763. public function __construct()
  8764. {
  8765. $this->nextRuleId = 0;
  8766. foreach ($this->getTypes() as $type) {
  8767. $this->rules[$type] = array();
  8768. }
  8769. $this->rulesByHash = array();
  8770. }
  8771. public function add(Rule $rule, $type)
  8772. {
  8773. if (!isset(self::$types[$type])) {
  8774. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8775. }
  8776. $hash = $rule->getHash();
  8777. if (isset($this->rulesByHash[$hash])) {
  8778. $potentialDuplicates = $this->rulesByHash[$hash];
  8779. if (is_array($potentialDuplicates)) {
  8780. foreach ($potentialDuplicates as $potentialDuplicate) {
  8781. if ($rule->equals($potentialDuplicate)) {
  8782. return;
  8783. }
  8784. }
  8785. } else {
  8786. if ($rule->equals($potentialDuplicates)) {
  8787. return;
  8788. }
  8789. }
  8790. }
  8791. if (!isset($this->rules[$type])) {
  8792. $this->rules[$type] = array();
  8793. }
  8794. $this->rules[$type][] = $rule;
  8795. $this->ruleById[$this->nextRuleId] = $rule;
  8796. $rule->setType($type);
  8797. $this->nextRuleId++;
  8798. if (!isset($this->rulesByHash[$hash])) {
  8799. $this->rulesByHash[$hash] = $rule;
  8800. } elseif (is_array($this->rulesByHash[$hash])) {
  8801. $this->rulesByHash[$hash][] = $rule;
  8802. } else {
  8803. $originalRule = $this->rulesByHash[$hash];
  8804. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8805. }
  8806. }
  8807. public function count()
  8808. {
  8809. return $this->nextRuleId;
  8810. }
  8811. public function ruleById($id)
  8812. {
  8813. return $this->ruleById[$id];
  8814. }
  8815. public function getRules()
  8816. {
  8817. return $this->rules;
  8818. }
  8819. public function getIterator()
  8820. {
  8821. return new RuleSetIterator($this->getRules());
  8822. }
  8823. public function getIteratorFor($types)
  8824. {
  8825. if (!is_array($types)) {
  8826. $types = array($types);
  8827. }
  8828. $allRules = $this->getRules();
  8829. $rules = array();
  8830. foreach ($types as $type) {
  8831. $rules[$type] = $allRules[$type];
  8832. }
  8833. return new RuleSetIterator($rules);
  8834. }
  8835. public function getIteratorWithout($types)
  8836. {
  8837. if (!is_array($types)) {
  8838. $types = array($types);
  8839. }
  8840. $rules = $this->getRules();
  8841. foreach ($types as $type) {
  8842. unset($rules[$type]);
  8843. }
  8844. return new RuleSetIterator($rules);
  8845. }
  8846. public function getTypes()
  8847. {
  8848. $types = self::$types;
  8849. unset($types[255]);
  8850. return array_keys($types);
  8851. }
  8852. public function getPrettyString(Pool $pool = null)
  8853. {
  8854. $string = "\n";
  8855. foreach ($this->rules as $type => $rules) {
  8856. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8857. foreach ($rules as $rule) {
  8858. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8859. }
  8860. $string .= "\n\n";
  8861. }
  8862. return $string;
  8863. }
  8864. public function __toString()
  8865. {
  8866. return $this->getPrettyString(null);
  8867. }
  8868. }
  8869. <?php
  8870. namespace Composer\DependencyResolver;
  8871. use Composer\Package\PackageInterface;
  8872. use Composer\Package\AliasPackage;
  8873. use Composer\Repository\PlatformRepository;
  8874. class RuleSetGenerator
  8875. {
  8876. protected $policy;
  8877. protected $pool;
  8878. protected $rules;
  8879. protected $jobs;
  8880. protected $installedMap;
  8881. protected $whitelistedMap;
  8882. protected $addedMap;
  8883. protected $conflictAddedMap;
  8884. protected $addedPackages;
  8885. protected $addedPackagesByNames;
  8886. public function __construct(PolicyInterface $policy, Pool $pool)
  8887. {
  8888. $this->policy = $policy;
  8889. $this->pool = $pool;
  8890. }
  8891. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8892. {
  8893. $literals = array(-$package->id);
  8894. foreach ($providers as $provider) {
  8895. if ($provider === $package) {
  8896. return null;
  8897. }
  8898. $literals[] = $provider->id;
  8899. }
  8900. return new GenericRule($literals, $reason, $reasonData);
  8901. }
  8902. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8903. {
  8904. $literals = array();
  8905. foreach ($packages as $package) {
  8906. $literals[] = $package->id;
  8907. }
  8908. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8909. }
  8910. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8911. {
  8912. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8913. }
  8914. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8915. {
  8916. if ($issuer === $provider) {
  8917. return null;
  8918. }
  8919. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8920. }
  8921. private function addRule($type, Rule $newRule = null)
  8922. {
  8923. if (!$newRule) {
  8924. return;
  8925. }
  8926. $this->rules->add($newRule, $type);
  8927. }
  8928. protected function whitelistFromPackage(PackageInterface $package)
  8929. {
  8930. $workQueue = new \SplQueue;
  8931. $workQueue->enqueue($package);
  8932. while (!$workQueue->isEmpty()) {
  8933. $package = $workQueue->dequeue();
  8934. if (isset($this->whitelistedMap[$package->id])) {
  8935. continue;
  8936. }
  8937. $this->whitelistedMap[$package->id] = true;
  8938. foreach ($package->getRequires() as $link) {
  8939. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8940. foreach ($possibleRequires as $require) {
  8941. $workQueue->enqueue($require);
  8942. }
  8943. }
  8944. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8945. foreach ($obsoleteProviders as $provider) {
  8946. if ($provider === $package) {
  8947. continue;
  8948. }
  8949. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8950. $workQueue->enqueue($provider);
  8951. }
  8952. }
  8953. }
  8954. }
  8955. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8956. {
  8957. $workQueue = new \SplQueue;
  8958. $workQueue->enqueue($package);
  8959. while (!$workQueue->isEmpty()) {
  8960. $package = $workQueue->dequeue();
  8961. if (isset($this->addedMap[$package->id])) {
  8962. continue;
  8963. }
  8964. $this->addedMap[$package->id] = true;
  8965. $this->addedPackages[] = $package;
  8966. foreach ($package->getNames() as $name) {
  8967. $this->addedPackagesByNames[$name][] = $package;
  8968. }
  8969. foreach ($package->getRequires() as $link) {
  8970. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8971. continue;
  8972. }
  8973. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8974. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8975. foreach ($possibleRequires as $require) {
  8976. $workQueue->enqueue($require);
  8977. }
  8978. }
  8979. $packageName = $package->getName();
  8980. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  8981. foreach ($obsoleteProviders as $provider) {
  8982. if ($provider === $package) {
  8983. continue;
  8984. }
  8985. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8986. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8987. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8988. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8989. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  8990. }
  8991. }
  8992. }
  8993. }
  8994. protected function addConflictRules()
  8995. {
  8996. foreach ($this->addedPackages as $package) {
  8997. foreach ($package->getConflicts() as $link) {
  8998. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  8999. continue;
  9000. }
  9001. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9002. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9003. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9004. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9005. }
  9006. }
  9007. }
  9008. $isInstalled = isset($this->installedMap[$package->id]);
  9009. foreach ($package->getReplaces() as $link) {
  9010. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9011. continue;
  9012. }
  9013. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9014. if ($provider === $package) {
  9015. continue;
  9016. }
  9017. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9018. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9019. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9020. }
  9021. }
  9022. }
  9023. }
  9024. }
  9025. protected function obsoleteImpossibleForAlias($package, $provider)
  9026. {
  9027. $packageIsAlias = $package instanceof AliasPackage;
  9028. $providerIsAlias = $provider instanceof AliasPackage;
  9029. $impossible = (
  9030. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9031. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9032. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9033. );
  9034. return $impossible;
  9035. }
  9036. protected function whitelistFromJobs()
  9037. {
  9038. foreach ($this->jobs as $job) {
  9039. switch ($job['cmd']) {
  9040. case 'install':
  9041. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9042. foreach ($packages as $package) {
  9043. $this->whitelistFromPackage($package);
  9044. }
  9045. break;
  9046. }
  9047. }
  9048. }
  9049. protected function addRulesForJobs($ignorePlatformReqs)
  9050. {
  9051. foreach ($this->jobs as $job) {
  9052. switch ($job['cmd']) {
  9053. case 'install':
  9054. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9055. break;
  9056. }
  9057. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9058. if ($packages) {
  9059. foreach ($packages as $package) {
  9060. if (!isset($this->installedMap[$package->id])) {
  9061. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9062. }
  9063. }
  9064. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9065. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9066. }
  9067. break;
  9068. case 'remove':
  9069. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9070. foreach ($packages as $package) {
  9071. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9072. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9073. }
  9074. break;
  9075. }
  9076. }
  9077. }
  9078. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9079. {
  9080. $this->jobs = $jobs;
  9081. $this->rules = new RuleSet;
  9082. $this->installedMap = $installedMap;
  9083. $this->whitelistedMap = array();
  9084. foreach ($this->installedMap as $package) {
  9085. $this->whitelistFromPackage($package);
  9086. }
  9087. $this->whitelistFromJobs();
  9088. $this->pool->setWhitelist($this->whitelistedMap);
  9089. $this->addedMap = array();
  9090. $this->conflictAddedMap = array();
  9091. $this->addedPackages = array();
  9092. $this->addedPackagesByNames = array();
  9093. foreach ($this->installedMap as $package) {
  9094. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9095. }
  9096. $this->addRulesForJobs($ignorePlatformReqs);
  9097. $this->addConflictRules();
  9098. $this->addedPackages = $this->addedPackagesByNames = null;
  9099. return $this->rules;
  9100. }
  9101. }
  9102. <?php
  9103. namespace Composer\DependencyResolver;
  9104. class RuleSetIterator implements \Iterator
  9105. {
  9106. protected $rules;
  9107. protected $types;
  9108. protected $currentOffset;
  9109. protected $currentType;
  9110. protected $currentTypeOffset;
  9111. public function __construct(array $rules)
  9112. {
  9113. $this->rules = $rules;
  9114. $this->types = array_keys($rules);
  9115. sort($this->types);
  9116. $this->rewind();
  9117. }
  9118. public function current()
  9119. {
  9120. return $this->rules[$this->currentType][$this->currentOffset];
  9121. }
  9122. public function key()
  9123. {
  9124. return $this->currentType;
  9125. }
  9126. public function next()
  9127. {
  9128. $this->currentOffset++;
  9129. if (!isset($this->rules[$this->currentType])) {
  9130. return;
  9131. }
  9132. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9133. $this->currentOffset = 0;
  9134. do {
  9135. $this->currentTypeOffset++;
  9136. if (!isset($this->types[$this->currentTypeOffset])) {
  9137. $this->currentType = -1;
  9138. break;
  9139. }
  9140. $this->currentType = $this->types[$this->currentTypeOffset];
  9141. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9142. }
  9143. }
  9144. public function rewind()
  9145. {
  9146. $this->currentOffset = 0;
  9147. $this->currentTypeOffset = -1;
  9148. $this->currentType = -1;
  9149. do {
  9150. $this->currentTypeOffset++;
  9151. if (!isset($this->types[$this->currentTypeOffset])) {
  9152. $this->currentType = -1;
  9153. break;
  9154. }
  9155. $this->currentType = $this->types[$this->currentTypeOffset];
  9156. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9157. }
  9158. public function valid()
  9159. {
  9160. return isset($this->rules[$this->currentType])
  9161. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9162. }
  9163. }
  9164. <?php
  9165. namespace Composer\DependencyResolver;
  9166. class RuleWatchChain extends \SplDoublyLinkedList
  9167. {
  9168. protected $offset = 0;
  9169. public function seek($offset)
  9170. {
  9171. $this->rewind();
  9172. for ($i = 0; $i < $offset; $i++, $this->next());
  9173. }
  9174. public function remove()
  9175. {
  9176. $offset = $this->key();
  9177. $this->offsetUnset($offset);
  9178. $this->seek($offset);
  9179. }
  9180. }
  9181. <?php
  9182. namespace Composer\DependencyResolver;
  9183. class RuleWatchGraph
  9184. {
  9185. protected $watchChains = array();
  9186. public function insert(RuleWatchNode $node)
  9187. {
  9188. if ($node->getRule()->isAssertion()) {
  9189. return;
  9190. }
  9191. foreach (array($node->watch1, $node->watch2) as $literal) {
  9192. if (!isset($this->watchChains[$literal])) {
  9193. $this->watchChains[$literal] = new RuleWatchChain;
  9194. }
  9195. $this->watchChains[$literal]->unshift($node);
  9196. }
  9197. }
  9198. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9199. {
  9200. $literal = -$decidedLiteral;
  9201. if (!isset($this->watchChains[$literal])) {
  9202. return null;
  9203. }
  9204. $chain = $this->watchChains[$literal];
  9205. $chain->rewind();
  9206. while ($chain->valid()) {
  9207. $node = $chain->current();
  9208. $otherWatch = $node->getOtherWatch($literal);
  9209. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9210. $ruleLiterals = $node->getRule()->getLiterals();
  9211. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9212. return $literal !== $ruleLiteral &&
  9213. $otherWatch !== $ruleLiteral &&
  9214. !$decisions->conflict($ruleLiteral);
  9215. });
  9216. if ($alternativeLiterals) {
  9217. reset($alternativeLiterals);
  9218. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9219. continue;
  9220. }
  9221. if ($decisions->conflict($otherWatch)) {
  9222. return $node->getRule();
  9223. }
  9224. $decisions->decide($otherWatch, $level, $node->getRule());
  9225. }
  9226. $chain->next();
  9227. }
  9228. return null;
  9229. }
  9230. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9231. {
  9232. if (!isset($this->watchChains[$toLiteral])) {
  9233. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9234. }
  9235. $node->moveWatch($fromLiteral, $toLiteral);
  9236. $this->watchChains[$fromLiteral]->remove();
  9237. $this->watchChains[$toLiteral]->unshift($node);
  9238. }
  9239. }
  9240. <?php
  9241. namespace Composer\DependencyResolver;
  9242. class RuleWatchNode
  9243. {
  9244. public $watch1;
  9245. public $watch2;
  9246. protected $rule;
  9247. public function __construct($rule)
  9248. {
  9249. $this->rule = $rule;
  9250. $literals = $rule->getLiterals();
  9251. $literalCount = count($literals);
  9252. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9253. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9254. }
  9255. public function watch2OnHighest(Decisions $decisions)
  9256. {
  9257. $literals = $this->rule->getLiterals();
  9258. if (count($literals) < 3) {
  9259. return;
  9260. }
  9261. $watchLevel = 0;
  9262. foreach ($literals as $literal) {
  9263. $level = $decisions->decisionLevel($literal);
  9264. if ($level > $watchLevel) {
  9265. $this->watch2 = $literal;
  9266. $watchLevel = $level;
  9267. }
  9268. }
  9269. }
  9270. public function getRule()
  9271. {
  9272. return $this->rule;
  9273. }
  9274. public function getOtherWatch($literal)
  9275. {
  9276. if ($this->watch1 == $literal) {
  9277. return $this->watch2;
  9278. }
  9279. return $this->watch1;
  9280. }
  9281. public function moveWatch($from, $to)
  9282. {
  9283. if ($this->watch1 == $from) {
  9284. $this->watch1 = $to;
  9285. } else {
  9286. $this->watch2 = $to;
  9287. }
  9288. }
  9289. }
  9290. <?php
  9291. namespace Composer\DependencyResolver;
  9292. use Composer\IO\IOInterface;
  9293. use Composer\Repository\RepositoryInterface;
  9294. use Composer\Repository\PlatformRepository;
  9295. class Solver
  9296. {
  9297. const BRANCH_LITERALS = 0;
  9298. const BRANCH_LEVEL = 1;
  9299. protected $policy;
  9300. protected $pool;
  9301. protected $installed;
  9302. protected $rules;
  9303. protected $ruleSetGenerator;
  9304. protected $jobs;
  9305. protected $updateMap = array();
  9306. protected $watchGraph;
  9307. protected $decisions;
  9308. protected $installedMap;
  9309. protected $propagateIndex;
  9310. protected $branches = array();
  9311. protected $problems = array();
  9312. protected $learnedPool = array();
  9313. protected $learnedWhy = array();
  9314. public $testFlagLearnedPositiveLiteral = false;
  9315. protected $io;
  9316. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9317. {
  9318. $this->io = $io;
  9319. $this->policy = $policy;
  9320. $this->pool = $pool;
  9321. $this->installed = $installed;
  9322. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9323. }
  9324. public function getRuleSetSize()
  9325. {
  9326. return count($this->rules);
  9327. }
  9328. private function makeAssertionRuleDecisions()
  9329. {
  9330. $decisionStart = count($this->decisions) - 1;
  9331. $rulesCount = count($this->rules);
  9332. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9333. $rule = $this->rules->ruleById[$ruleIndex];
  9334. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9335. continue;
  9336. }
  9337. $literals = $rule->getLiterals();
  9338. $literal = $literals[0];
  9339. if (!$this->decisions->decided($literal)) {
  9340. $this->decisions->decide($literal, 1, $rule);
  9341. continue;
  9342. }
  9343. if ($this->decisions->satisfy($literal)) {
  9344. continue;
  9345. }
  9346. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9347. $rule->disable();
  9348. continue;
  9349. }
  9350. $conflict = $this->decisions->decisionRule($literal);
  9351. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9352. $problem = new Problem($this->pool);
  9353. $problem->addRule($rule);
  9354. $problem->addRule($conflict);
  9355. $this->disableProblem($rule);
  9356. $this->problems[] = $problem;
  9357. continue;
  9358. }
  9359. $problem = new Problem($this->pool);
  9360. $problem->addRule($rule);
  9361. $problem->addRule($conflict);
  9362. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9363. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9364. continue;
  9365. }
  9366. $assertRuleLiterals = $assertRule->getLiterals();
  9367. $assertRuleLiteral = $assertRuleLiterals[0];
  9368. if (abs($literal) !== abs($assertRuleLiteral)) {
  9369. continue;
  9370. }
  9371. $problem->addRule($assertRule);
  9372. $this->disableProblem($assertRule);
  9373. }
  9374. $this->problems[] = $problem;
  9375. $this->decisions->resetToOffset($decisionStart);
  9376. $ruleIndex = -1;
  9377. }
  9378. }
  9379. protected function setupInstalledMap()
  9380. {
  9381. $this->installedMap = array();
  9382. foreach ($this->installed->getPackages() as $package) {
  9383. $this->installedMap[$package->id] = $package;
  9384. }
  9385. }
  9386. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9387. {
  9388. foreach ($this->jobs as $job) {
  9389. switch ($job['cmd']) {
  9390. case 'update':
  9391. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9392. foreach ($packages as $package) {
  9393. if (isset($this->installedMap[$package->id])) {
  9394. $this->updateMap[$package->id] = true;
  9395. }
  9396. }
  9397. break;
  9398. case 'update-all':
  9399. foreach ($this->installedMap as $package) {
  9400. $this->updateMap[$package->id] = true;
  9401. }
  9402. break;
  9403. case 'install':
  9404. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9405. break;
  9406. }
  9407. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9408. $problem = new Problem($this->pool);
  9409. $problem->addRule(new GenericRule(array(), null, null, $job));
  9410. $this->problems[] = $problem;
  9411. }
  9412. break;
  9413. }
  9414. }
  9415. }
  9416. public function solve(Request $request, $ignorePlatformReqs = false)
  9417. {
  9418. $this->jobs = $request->getJobs();
  9419. $this->setupInstalledMap();
  9420. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9421. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9422. $this->decisions = new Decisions($this->pool);
  9423. $this->watchGraph = new RuleWatchGraph;
  9424. foreach ($this->rules as $rule) {
  9425. $this->watchGraph->insert(new RuleWatchNode($rule));
  9426. }
  9427. $this->makeAssertionRuleDecisions();
  9428. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9429. $before = microtime(true);
  9430. $this->runSat(true);
  9431. $this->io->writeError('', true, IOInterface::DEBUG);
  9432. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9433. foreach ($this->installedMap as $packageId => $void) {
  9434. if ($this->decisions->undecided($packageId)) {
  9435. $this->decisions->decide(-$packageId, 1, null);
  9436. }
  9437. }
  9438. if ($this->problems) {
  9439. throw new SolverProblemsException($this->problems, $this->installedMap);
  9440. }
  9441. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9442. return $transaction->getOperations();
  9443. }
  9444. protected function propagate($level)
  9445. {
  9446. while ($this->decisions->validOffset($this->propagateIndex)) {
  9447. $decision = $this->decisions->atOffset($this->propagateIndex);
  9448. $conflict = $this->watchGraph->propagateLiteral(
  9449. $decision[Decisions::DECISION_LITERAL],
  9450. $level,
  9451. $this->decisions
  9452. );
  9453. $this->propagateIndex++;
  9454. if ($conflict) {
  9455. return $conflict;
  9456. }
  9457. }
  9458. return null;
  9459. }
  9460. private function revert($level)
  9461. {
  9462. while (!$this->decisions->isEmpty()) {
  9463. $literal = $this->decisions->lastLiteral();
  9464. if ($this->decisions->undecided($literal)) {
  9465. break;
  9466. }
  9467. $decisionLevel = $this->decisions->decisionLevel($literal);
  9468. if ($decisionLevel <= $level) {
  9469. break;
  9470. }
  9471. $this->decisions->revertLast();
  9472. $this->propagateIndex = count($this->decisions);
  9473. }
  9474. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9475. array_pop($this->branches);
  9476. }
  9477. }
  9478. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9479. {
  9480. $level++;
  9481. $this->decisions->decide($literal, $level, $rule);
  9482. while (true) {
  9483. $rule = $this->propagate($level);
  9484. if (!$rule) {
  9485. break;
  9486. }
  9487. if ($level == 1) {
  9488. return $this->analyzeUnsolvable($rule, $disableRules);
  9489. }
  9490. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9491. if ($newLevel <= 0 || $newLevel >= $level) {
  9492. throw new SolverBugException(
  9493. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9494. );
  9495. } elseif (!$newRule) {
  9496. throw new SolverBugException(
  9497. "No rule was learned from analyzing $rule at level $level."
  9498. );
  9499. }
  9500. $level = $newLevel;
  9501. $this->revert($level);
  9502. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9503. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9504. $ruleNode = new RuleWatchNode($newRule);
  9505. $ruleNode->watch2OnHighest($this->decisions);
  9506. $this->watchGraph->insert($ruleNode);
  9507. $this->decisions->decide($learnLiteral, $level, $newRule);
  9508. }
  9509. return $level;
  9510. }
  9511. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9512. {
  9513. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9514. $selectedLiteral = array_shift($literals);
  9515. if (count($literals)) {
  9516. $this->branches[] = array($literals, $level);
  9517. }
  9518. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9519. }
  9520. protected function analyze($level, Rule $rule)
  9521. {
  9522. $analyzedRule = $rule;
  9523. $ruleLevel = 1;
  9524. $num = 0;
  9525. $l1num = 0;
  9526. $seen = array();
  9527. $learnedLiterals = array(null);
  9528. $decisionId = count($this->decisions);
  9529. $this->learnedPool[] = array();
  9530. while (true) {
  9531. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9532. foreach ($rule->getLiterals() as $literal) {
  9533. if ($this->decisions->satisfy($literal)) {
  9534. continue;
  9535. }
  9536. if (isset($seen[abs($literal)])) {
  9537. continue;
  9538. }
  9539. $seen[abs($literal)] = true;
  9540. $l = $this->decisions->decisionLevel($literal);
  9541. if (1 === $l) {
  9542. $l1num++;
  9543. } elseif ($level === $l) {
  9544. $num++;
  9545. } else {
  9546. $learnedLiterals[] = $literal;
  9547. if ($l > $ruleLevel) {
  9548. $ruleLevel = $l;
  9549. }
  9550. }
  9551. }
  9552. $l1retry = true;
  9553. while ($l1retry) {
  9554. $l1retry = false;
  9555. if (!$num && !--$l1num) {
  9556. break 2;
  9557. }
  9558. while (true) {
  9559. if ($decisionId <= 0) {
  9560. throw new SolverBugException(
  9561. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9562. );
  9563. }
  9564. $decisionId--;
  9565. $decision = $this->decisions->atOffset($decisionId);
  9566. $literal = $decision[Decisions::DECISION_LITERAL];
  9567. if (isset($seen[abs($literal)])) {
  9568. break;
  9569. }
  9570. }
  9571. unset($seen[abs($literal)]);
  9572. if ($num && 0 === --$num) {
  9573. if ($literal < 0) {
  9574. $this->testFlagLearnedPositiveLiteral = true;
  9575. }
  9576. $learnedLiterals[0] = -$literal;
  9577. if (!$l1num) {
  9578. break 2;
  9579. }
  9580. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9581. if ($i !== 0) {
  9582. unset($seen[abs($learnedLiteral)]);
  9583. }
  9584. }
  9585. $l1num++;
  9586. $l1retry = true;
  9587. }
  9588. }
  9589. $decision = $this->decisions->atOffset($decisionId);
  9590. $rule = $decision[Decisions::DECISION_REASON];
  9591. }
  9592. $why = count($this->learnedPool) - 1;
  9593. if (!$learnedLiterals[0]) {
  9594. throw new SolverBugException(
  9595. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9596. );
  9597. }
  9598. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9599. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9600. }
  9601. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9602. {
  9603. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9604. $why = spl_object_hash($conflictRule);
  9605. $learnedWhy = $this->learnedWhy[$why];
  9606. $problemRules = $this->learnedPool[$learnedWhy];
  9607. foreach ($problemRules as $problemRule) {
  9608. $this->analyzeUnsolvableRule($problem, $problemRule);
  9609. }
  9610. return;
  9611. }
  9612. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9613. return;
  9614. }
  9615. $problem->nextSection();
  9616. $problem->addRule($conflictRule);
  9617. }
  9618. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9619. {
  9620. $problem = new Problem($this->pool);
  9621. $problem->addRule($conflictRule);
  9622. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9623. $this->problems[] = $problem;
  9624. $seen = array();
  9625. $literals = $conflictRule->getLiterals();
  9626. foreach ($literals as $literal) {
  9627. if ($this->decisions->satisfy($literal)) {
  9628. continue;
  9629. }
  9630. $seen[abs($literal)] = true;
  9631. }
  9632. foreach ($this->decisions as $decision) {
  9633. $literal = $decision[Decisions::DECISION_LITERAL];
  9634. if (!isset($seen[abs($literal)])) {
  9635. continue;
  9636. }
  9637. $why = $decision[Decisions::DECISION_REASON];
  9638. $problem->addRule($why);
  9639. $this->analyzeUnsolvableRule($problem, $why);
  9640. $literals = $why->getLiterals();
  9641. foreach ($literals as $literal) {
  9642. if ($this->decisions->satisfy($literal)) {
  9643. continue;
  9644. }
  9645. $seen[abs($literal)] = true;
  9646. }
  9647. }
  9648. if ($disableRules) {
  9649. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9650. $this->disableProblem($reason['rule']);
  9651. }
  9652. $this->resetSolver();
  9653. return 1;
  9654. }
  9655. return 0;
  9656. }
  9657. private function disableProblem(Rule $why)
  9658. {
  9659. $job = $why->getJob();
  9660. if (!$job) {
  9661. $why->disable();
  9662. return;
  9663. }
  9664. foreach ($this->rules as $rule) {
  9665. if ($job === $rule->getJob()) {
  9666. $rule->disable();
  9667. }
  9668. }
  9669. }
  9670. private function resetSolver()
  9671. {
  9672. $this->decisions->reset();
  9673. $this->propagateIndex = 0;
  9674. $this->branches = array();
  9675. $this->enableDisableLearnedRules();
  9676. $this->makeAssertionRuleDecisions();
  9677. }
  9678. private function enableDisableLearnedRules()
  9679. {
  9680. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9681. $why = $this->learnedWhy[spl_object_hash($rule)];
  9682. $problemRules = $this->learnedPool[$why];
  9683. $foundDisabled = false;
  9684. foreach ($problemRules as $problemRule) {
  9685. if ($problemRule->isDisabled()) {
  9686. $foundDisabled = true;
  9687. break;
  9688. }
  9689. }
  9690. if ($foundDisabled && $rule->isEnabled()) {
  9691. $rule->disable();
  9692. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9693. $rule->enable();
  9694. }
  9695. }
  9696. }
  9697. private function runSat($disableRules = true)
  9698. {
  9699. $this->propagateIndex = 0;
  9700. $decisionQueue = array();
  9701. $decisionSupplementQueue = array();
  9702. $disableRules = array();
  9703. $level = 1;
  9704. $systemLevel = $level + 1;
  9705. $installedPos = 0;
  9706. while (true) {
  9707. if (1 === $level) {
  9708. $conflictRule = $this->propagate($level);
  9709. if (null !== $conflictRule) {
  9710. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9711. continue;
  9712. }
  9713. return;
  9714. }
  9715. }
  9716. if ($level < $systemLevel) {
  9717. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9718. foreach ($iterator as $rule) {
  9719. if ($rule->isEnabled()) {
  9720. $decisionQueue = array();
  9721. $noneSatisfied = true;
  9722. foreach ($rule->getLiterals() as $literal) {
  9723. if ($this->decisions->satisfy($literal)) {
  9724. $noneSatisfied = false;
  9725. break;
  9726. }
  9727. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9728. $decisionQueue[] = $literal;
  9729. }
  9730. }
  9731. if ($noneSatisfied && count($decisionQueue)) {
  9732. if (count($this->installed) != count($this->updateMap)) {
  9733. $prunedQueue = array();
  9734. foreach ($decisionQueue as $literal) {
  9735. if (isset($this->installedMap[abs($literal)])) {
  9736. $prunedQueue[] = $literal;
  9737. if (isset($this->updateMap[abs($literal)])) {
  9738. $prunedQueue = $decisionQueue;
  9739. break;
  9740. }
  9741. }
  9742. }
  9743. $decisionQueue = $prunedQueue;
  9744. }
  9745. }
  9746. if ($noneSatisfied && count($decisionQueue)) {
  9747. $oLevel = $level;
  9748. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9749. if (0 === $level) {
  9750. return;
  9751. }
  9752. if ($level <= $oLevel) {
  9753. break;
  9754. }
  9755. }
  9756. }
  9757. }
  9758. $systemLevel = $level + 1;
  9759. $iterator->next();
  9760. if ($iterator->valid()) {
  9761. continue;
  9762. }
  9763. }
  9764. if ($level < $systemLevel) {
  9765. $systemLevel = $level;
  9766. }
  9767. $rulesCount = count($this->rules);
  9768. $pass = 1;
  9769. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9770. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9771. if ($i == $rulesCount) {
  9772. if (1 === $pass) {
  9773. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9774. } else {
  9775. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9776. }
  9777. $i = 0;
  9778. $pass++;
  9779. }
  9780. $rule = $this->rules->ruleById[$i];
  9781. $literals = $rule->getLiterals();
  9782. if ($rule->isDisabled()) {
  9783. continue;
  9784. }
  9785. $decisionQueue = array();
  9786. foreach ($literals as $literal) {
  9787. if ($literal <= 0) {
  9788. if (!$this->decisions->decidedInstall($literal)) {
  9789. continue 2;
  9790. }
  9791. } else {
  9792. if ($this->decisions->decidedInstall($literal)) {
  9793. continue 2;
  9794. }
  9795. if ($this->decisions->undecided($literal)) {
  9796. $decisionQueue[] = $literal;
  9797. }
  9798. }
  9799. }
  9800. if (count($decisionQueue) < 2) {
  9801. continue;
  9802. }
  9803. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9804. if (0 === $level) {
  9805. return;
  9806. }
  9807. $rulesCount = count($this->rules);
  9808. $n = -1;
  9809. }
  9810. if ($level < $systemLevel) {
  9811. continue;
  9812. }
  9813. if (count($this->branches)) {
  9814. $lastLiteral = null;
  9815. $lastLevel = null;
  9816. $lastBranchIndex = 0;
  9817. $lastBranchOffset = 0;
  9818. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9819. list($literals, $l) = $this->branches[$i];
  9820. foreach ($literals as $offset => $literal) {
  9821. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9822. $lastLiteral = $literal;
  9823. $lastBranchIndex = $i;
  9824. $lastBranchOffset = $offset;
  9825. $lastLevel = $l;
  9826. }
  9827. }
  9828. }
  9829. if ($lastLiteral) {
  9830. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9831. $level = $lastLevel;
  9832. $this->revert($level);
  9833. $why = $this->decisions->lastReason();
  9834. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9835. if ($level == 0) {
  9836. return;
  9837. }
  9838. continue;
  9839. }
  9840. }
  9841. break;
  9842. }
  9843. }
  9844. }
  9845. <?php
  9846. namespace Composer\DependencyResolver;
  9847. class SolverBugException extends \RuntimeException
  9848. {
  9849. public function __construct($message)
  9850. {
  9851. parent::__construct(
  9852. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9853. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  9854. );
  9855. }
  9856. }
  9857. <?php
  9858. namespace Composer\DependencyResolver;
  9859. use Composer\Util\IniHelper;
  9860. class SolverProblemsException extends \RuntimeException
  9861. {
  9862. protected $problems;
  9863. protected $installedMap;
  9864. public function __construct(array $problems, array $installedMap)
  9865. {
  9866. $this->problems = $problems;
  9867. $this->installedMap = $installedMap;
  9868. parent::__construct($this->createMessage(), 2);
  9869. }
  9870. protected function createMessage()
  9871. {
  9872. $text = "\n";
  9873. $hasExtensionProblems = false;
  9874. foreach ($this->problems as $i => $problem) {
  9875. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9876. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9877. $hasExtensionProblems = true;
  9878. }
  9879. }
  9880. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9881. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9882. }
  9883. if ($hasExtensionProblems) {
  9884. $text .= $this->createExtensionHint();
  9885. }
  9886. return $text;
  9887. }
  9888. public function getProblems()
  9889. {
  9890. return $this->problems;
  9891. }
  9892. private function createExtensionHint()
  9893. {
  9894. $paths = IniHelper::getAll();
  9895. if (count($paths) === 1 && empty($paths[0])) {
  9896. return '';
  9897. }
  9898. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9899. $text .= implode("\n - ", $paths);
  9900. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9901. return $text;
  9902. }
  9903. private function hasExtensionProblems(array $reasonSets)
  9904. {
  9905. foreach ($reasonSets as $reasonSet) {
  9906. foreach ($reasonSet as $reason) {
  9907. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9908. return true;
  9909. }
  9910. }
  9911. }
  9912. return false;
  9913. }
  9914. }
  9915. <?php
  9916. namespace Composer\DependencyResolver;
  9917. use Composer\Package\AliasPackage;
  9918. class Transaction
  9919. {
  9920. protected $policy;
  9921. protected $pool;
  9922. protected $installedMap;
  9923. protected $decisions;
  9924. protected $transaction;
  9925. public function __construct($policy, $pool, $installedMap, $decisions)
  9926. {
  9927. $this->policy = $policy;
  9928. $this->pool = $pool;
  9929. $this->installedMap = $installedMap;
  9930. $this->decisions = $decisions;
  9931. $this->transaction = array();
  9932. }
  9933. public function getOperations()
  9934. {
  9935. $installMeansUpdateMap = $this->findUpdates();
  9936. $updateMap = array();
  9937. $installMap = array();
  9938. $uninstallMap = array();
  9939. foreach ($this->decisions as $i => $decision) {
  9940. $literal = $decision[Decisions::DECISION_LITERAL];
  9941. $reason = $decision[Decisions::DECISION_REASON];
  9942. $package = $this->pool->literalToPackage($literal);
  9943. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  9944. continue;
  9945. }
  9946. if ($literal > 0) {
  9947. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9948. $source = $installMeansUpdateMap[abs($literal)];
  9949. $updateMap[$package->id] = array(
  9950. 'package' => $package,
  9951. 'source' => $source,
  9952. 'reason' => $reason,
  9953. );
  9954. unset($installMeansUpdateMap[abs($literal)]);
  9955. $ignoreRemove[$source->id] = true;
  9956. } else {
  9957. $installMap[$package->id] = array(
  9958. 'package' => $package,
  9959. 'reason' => $reason,
  9960. );
  9961. }
  9962. }
  9963. }
  9964. foreach ($this->decisions as $i => $decision) {
  9965. $literal = $decision[Decisions::DECISION_LITERAL];
  9966. $reason = $decision[Decisions::DECISION_REASON];
  9967. $package = $this->pool->literalToPackage($literal);
  9968. if ($literal <= 0 &&
  9969. isset($this->installedMap[$package->id]) &&
  9970. !isset($ignoreRemove[$package->id])) {
  9971. $uninstallMap[$package->id] = array(
  9972. 'package' => $package,
  9973. 'reason' => $reason,
  9974. );
  9975. }
  9976. }
  9977. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9978. return $this->transaction;
  9979. }
  9980. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9981. {
  9982. $queue = array_map(
  9983. function ($operation) {
  9984. return $operation['package'];
  9985. },
  9986. $this->findRootPackages($installMap, $updateMap)
  9987. );
  9988. $visited = array();
  9989. while (!empty($queue)) {
  9990. $package = array_pop($queue);
  9991. $packageId = $package->id;
  9992. if (!isset($visited[$packageId])) {
  9993. $queue[] = $package;
  9994. if ($package instanceof AliasPackage) {
  9995. $queue[] = $package->getAliasOf();
  9996. } else {
  9997. foreach ($package->getRequires() as $link) {
  9998. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9999. foreach ($possibleRequires as $require) {
  10000. $queue[] = $require;
  10001. }
  10002. }
  10003. }
  10004. $visited[$package->id] = true;
  10005. } else {
  10006. if (isset($installMap[$packageId])) {
  10007. $this->install(
  10008. $installMap[$packageId]['package'],
  10009. $installMap[$packageId]['reason']
  10010. );
  10011. unset($installMap[$packageId]);
  10012. }
  10013. if (isset($updateMap[$packageId])) {
  10014. $this->update(
  10015. $updateMap[$packageId]['source'],
  10016. $updateMap[$packageId]['package'],
  10017. $updateMap[$packageId]['reason']
  10018. );
  10019. unset($updateMap[$packageId]);
  10020. }
  10021. }
  10022. }
  10023. foreach ($uninstallMap as $uninstall) {
  10024. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10025. }
  10026. }
  10027. protected function findRootPackages($installMap, $updateMap)
  10028. {
  10029. $packages = $installMap + $updateMap;
  10030. $roots = $packages;
  10031. foreach ($packages as $packageId => $operation) {
  10032. $package = $operation['package'];
  10033. if (!isset($roots[$packageId])) {
  10034. continue;
  10035. }
  10036. foreach ($package->getRequires() as $link) {
  10037. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10038. foreach ($possibleRequires as $require) {
  10039. if ($require !== $package) {
  10040. unset($roots[$require->id]);
  10041. }
  10042. }
  10043. }
  10044. }
  10045. return $roots;
  10046. }
  10047. protected function findUpdates()
  10048. {
  10049. $installMeansUpdateMap = array();
  10050. foreach ($this->decisions as $i => $decision) {
  10051. $literal = $decision[Decisions::DECISION_LITERAL];
  10052. $package = $this->pool->literalToPackage($literal);
  10053. if ($package instanceof AliasPackage) {
  10054. continue;
  10055. }
  10056. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10057. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10058. $literals = array($package->id);
  10059. foreach ($updates as $update) {
  10060. $literals[] = $update->id;
  10061. }
  10062. foreach ($literals as $updateLiteral) {
  10063. if ($updateLiteral !== $literal) {
  10064. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10065. }
  10066. }
  10067. }
  10068. }
  10069. return $installMeansUpdateMap;
  10070. }
  10071. protected function install($package, $reason)
  10072. {
  10073. if ($package instanceof AliasPackage) {
  10074. return $this->markAliasInstalled($package, $reason);
  10075. }
  10076. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10077. }
  10078. protected function update($from, $to, $reason)
  10079. {
  10080. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10081. }
  10082. protected function uninstall($package, $reason)
  10083. {
  10084. if ($package instanceof AliasPackage) {
  10085. return $this->markAliasUninstalled($package, $reason);
  10086. }
  10087. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10088. }
  10089. protected function markAliasInstalled($package, $reason)
  10090. {
  10091. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10092. }
  10093. protected function markAliasUninstalled($package, $reason)
  10094. {
  10095. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10096. }
  10097. }
  10098. <?php
  10099. namespace Composer\Downloader;
  10100. use Composer\Package\PackageInterface;
  10101. use Symfony\Component\Finder\Finder;
  10102. use Composer\IO\IOInterface;
  10103. abstract class ArchiveDownloader extends FileDownloader
  10104. {
  10105. public function download(PackageInterface $package, $path, $output = true)
  10106. {
  10107. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10108. $retries = 3;
  10109. while ($retries--) {
  10110. $fileName = parent::download($package, $path, $output);
  10111. if ($output) {
  10112. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10113. }
  10114. try {
  10115. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10116. try {
  10117. $this->extract($fileName, $temporaryDir);
  10118. } catch (\Exception $e) {
  10119. parent::clearLastCacheWrite($package);
  10120. throw $e;
  10121. }
  10122. $this->filesystem->unlink($fileName);
  10123. $contentDir = $this->getFolderContent($temporaryDir);
  10124. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10125. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10126. }
  10127. foreach ($contentDir as $file) {
  10128. $file = (string) $file;
  10129. $this->filesystem->rename($file, $path . '/' . basename($file));
  10130. }
  10131. $this->filesystem->removeDirectory($temporaryDir);
  10132. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10133. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10134. }
  10135. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10136. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10137. }
  10138. } catch (\Exception $e) {
  10139. $this->filesystem->removeDirectory($path);
  10140. $this->filesystem->removeDirectory($temporaryDir);
  10141. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10142. $this->io->writeError('');
  10143. if ($this->io->isDebug()) {
  10144. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10145. } else {
  10146. $this->io->writeError(' Invalid zip file, retrying...');
  10147. }
  10148. usleep(500000);
  10149. continue;
  10150. }
  10151. throw $e;
  10152. }
  10153. break;
  10154. }
  10155. }
  10156. protected function getFileName(PackageInterface $package, $path)
  10157. {
  10158. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10159. }
  10160. abstract protected function extract($file, $path);
  10161. private function getFolderContent($dir)
  10162. {
  10163. $finder = Finder::create()
  10164. ->ignoreVCS(false)
  10165. ->ignoreDotFiles(false)
  10166. ->notName('.DS_Store')
  10167. ->depth(0)
  10168. ->in($dir);
  10169. return iterator_to_array($finder);
  10170. }
  10171. }
  10172. <?php
  10173. namespace Composer\Downloader;
  10174. use Composer\Package\PackageInterface;
  10175. interface ChangeReportInterface
  10176. {
  10177. public function getLocalChanges(PackageInterface $package, $path);
  10178. }
  10179. <?php
  10180. namespace Composer\Downloader;
  10181. use Composer\Package\PackageInterface;
  10182. use Composer\IO\IOInterface;
  10183. use Composer\Util\Filesystem;
  10184. class DownloadManager
  10185. {
  10186. private $io;
  10187. private $preferDist = false;
  10188. private $preferSource = false;
  10189. private $packagePreferences = array();
  10190. private $filesystem;
  10191. private $downloaders = array();
  10192. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10193. {
  10194. $this->io = $io;
  10195. $this->preferSource = $preferSource;
  10196. $this->filesystem = $filesystem ?: new Filesystem();
  10197. }
  10198. public function setPreferSource($preferSource)
  10199. {
  10200. $this->preferSource = $preferSource;
  10201. return $this;
  10202. }
  10203. public function setPreferDist($preferDist)
  10204. {
  10205. $this->preferDist = $preferDist;
  10206. return $this;
  10207. }
  10208. public function setPreferences(array $preferences)
  10209. {
  10210. $this->packagePreferences = $preferences;
  10211. return $this;
  10212. }
  10213. public function setOutputProgress($outputProgress)
  10214. {
  10215. foreach ($this->downloaders as $downloader) {
  10216. $downloader->setOutputProgress($outputProgress);
  10217. }
  10218. return $this;
  10219. }
  10220. public function setDownloader($type, DownloaderInterface $downloader)
  10221. {
  10222. $type = strtolower($type);
  10223. $this->downloaders[$type] = $downloader;
  10224. return $this;
  10225. }
  10226. public function getDownloader($type)
  10227. {
  10228. $type = strtolower($type);
  10229. if (!isset($this->downloaders[$type])) {
  10230. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10231. }
  10232. return $this->downloaders[$type];
  10233. }
  10234. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10235. {
  10236. $installationSource = $package->getInstallationSource();
  10237. if ('metapackage' === $package->getType()) {
  10238. return;
  10239. }
  10240. if ('dist' === $installationSource) {
  10241. $downloader = $this->getDownloader($package->getDistType());
  10242. } elseif ('source' === $installationSource) {
  10243. $downloader = $this->getDownloader($package->getSourceType());
  10244. } else {
  10245. throw new \InvalidArgumentException(
  10246. 'Package '.$package.' seems not been installed properly'
  10247. );
  10248. }
  10249. if ($installationSource !== $downloader->getInstallationSource()) {
  10250. throw new \LogicException(sprintf(
  10251. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10252. get_class($downloader),
  10253. $downloader->getInstallationSource(),
  10254. $installationSource,
  10255. $package
  10256. ));
  10257. }
  10258. return $downloader;
  10259. }
  10260. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10261. {
  10262. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10263. $sourceType = $package->getSourceType();
  10264. $distType = $package->getDistType();
  10265. $sources = array();
  10266. if ($sourceType) {
  10267. $sources[] = 'source';
  10268. }
  10269. if ($distType) {
  10270. $sources[] = 'dist';
  10271. }
  10272. if (empty($sources)) {
  10273. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10274. }
  10275. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10276. $sources = array_reverse($sources);
  10277. }
  10278. $this->filesystem->ensureDirectoryExists($targetDir);
  10279. foreach ($sources as $i => $source) {
  10280. if (isset($e)) {
  10281. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10282. }
  10283. $package->setInstallationSource($source);
  10284. try {
  10285. $downloader = $this->getDownloaderForInstalledPackage($package);
  10286. if ($downloader) {
  10287. $downloader->download($package, $targetDir);
  10288. }
  10289. break;
  10290. } catch (\RuntimeException $e) {
  10291. if ($i === count($sources) - 1) {
  10292. throw $e;
  10293. }
  10294. $this->io->writeError(
  10295. ' <warning>Failed to download '.
  10296. $package->getPrettyName().
  10297. ' from ' . $source . ': '.
  10298. $e->getMessage().'</warning>'
  10299. );
  10300. }
  10301. }
  10302. }
  10303. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10304. {
  10305. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10306. if (!$downloader) {
  10307. return;
  10308. }
  10309. $installationSource = $initial->getInstallationSource();
  10310. if ('dist' === $installationSource) {
  10311. $initialType = $initial->getDistType();
  10312. $targetType = $target->getDistType();
  10313. } else {
  10314. $initialType = $initial->getSourceType();
  10315. $targetType = $target->getSourceType();
  10316. }
  10317. if ($target->isDev() && 'dist' === $installationSource) {
  10318. $downloader->remove($initial, $targetDir);
  10319. $this->download($target, $targetDir);
  10320. return;
  10321. }
  10322. if ($initialType === $targetType) {
  10323. $target->setInstallationSource($installationSource);
  10324. try {
  10325. $downloader->update($initial, $target, $targetDir);
  10326. return;
  10327. } catch (\RuntimeException $e) {
  10328. if (!$this->io->isInteractive()) {
  10329. throw $e;
  10330. }
  10331. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10332. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10333. throw $e;
  10334. }
  10335. }
  10336. }
  10337. $downloader->remove($initial, $targetDir);
  10338. $this->download($target, $targetDir, 'source' === $installationSource);
  10339. }
  10340. public function remove(PackageInterface $package, $targetDir)
  10341. {
  10342. $downloader = $this->getDownloaderForInstalledPackage($package);
  10343. if ($downloader) {
  10344. $downloader->remove($package, $targetDir);
  10345. }
  10346. }
  10347. protected function resolvePackageInstallPreference(PackageInterface $package)
  10348. {
  10349. foreach ($this->packagePreferences as $pattern => $preference) {
  10350. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10351. if (preg_match($pattern, $package->getName())) {
  10352. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10353. return 'dist';
  10354. }
  10355. return 'source';
  10356. }
  10357. }
  10358. return $package->isDev() ? 'source' : 'dist';
  10359. }
  10360. }
  10361. <?php
  10362. namespace Composer\Downloader;
  10363. use Composer\Package\PackageInterface;
  10364. interface DownloaderInterface
  10365. {
  10366. public function getInstallationSource();
  10367. public function download(PackageInterface $package, $path);
  10368. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10369. public function remove(PackageInterface $package, $path);
  10370. public function setOutputProgress($outputProgress);
  10371. }
  10372. <?php
  10373. namespace Composer\Downloader;
  10374. use Composer\Package\PackageInterface;
  10375. interface DvcsDownloaderInterface
  10376. {
  10377. public function getUnpushedChanges(PackageInterface $package, $path);
  10378. }
  10379. <?php
  10380. namespace Composer\Downloader;
  10381. use Composer\Config;
  10382. use Composer\Cache;
  10383. use Composer\Factory;
  10384. use Composer\IO\IOInterface;
  10385. use Composer\IO\NullIO;
  10386. use Composer\Package\Comparer\Comparer;
  10387. use Composer\Package\PackageInterface;
  10388. use Composer\Package\Version\VersionParser;
  10389. use Composer\Plugin\PluginEvents;
  10390. use Composer\Plugin\PreFileDownloadEvent;
  10391. use Composer\EventDispatcher\EventDispatcher;
  10392. use Composer\Util\Filesystem;
  10393. use Composer\Util\RemoteFilesystem;
  10394. use Composer\Util\Url as UrlUtil;
  10395. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10396. {
  10397. protected $io;
  10398. protected $config;
  10399. protected $rfs;
  10400. protected $filesystem;
  10401. protected $cache;
  10402. protected $outputProgress = true;
  10403. private $lastCacheWrites = array();
  10404. private $eventDispatcher;
  10405. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10406. {
  10407. $this->io = $io;
  10408. $this->config = $config;
  10409. $this->eventDispatcher = $eventDispatcher;
  10410. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10411. $this->filesystem = $filesystem ?: new Filesystem();
  10412. $this->cache = $cache;
  10413. if ($this->cache && $this->cache->gcIsNecessary()) {
  10414. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10415. }
  10416. }
  10417. public function getInstallationSource()
  10418. {
  10419. return 'dist';
  10420. }
  10421. public function download(PackageInterface $package, $path, $output = true)
  10422. {
  10423. if (!$package->getDistUrl()) {
  10424. throw new \InvalidArgumentException('The given package is missing url information');
  10425. }
  10426. if ($output) {
  10427. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10428. }
  10429. $urls = $package->getDistUrls();
  10430. while ($url = array_shift($urls)) {
  10431. try {
  10432. $fileName = $this->doDownload($package, $path, $url);
  10433. break;
  10434. } catch (\Exception $e) {
  10435. if ($this->io->isDebug()) {
  10436. $this->io->writeError('');
  10437. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10438. } elseif (count($urls)) {
  10439. $this->io->writeError('');
  10440. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10441. }
  10442. if (!count($urls)) {
  10443. throw $e;
  10444. }
  10445. }
  10446. }
  10447. if ($output) {
  10448. $this->io->writeError('');
  10449. }
  10450. return $fileName;
  10451. }
  10452. protected function doDownload(PackageInterface $package, $path, $url)
  10453. {
  10454. $this->filesystem->emptyDirectory($path);
  10455. $fileName = $this->getFileName($package, $path);
  10456. $processedUrl = $this->processUrl($package, $url);
  10457. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10458. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10459. if ($this->eventDispatcher) {
  10460. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10461. }
  10462. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10463. try {
  10464. $checksum = $package->getDistSha1Checksum();
  10465. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10466. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10467. $this->io->writeError('Loading from cache', false);
  10468. } else {
  10469. if (!$this->outputProgress) {
  10470. $this->io->writeError('Downloading', false);
  10471. }
  10472. $retries = 3;
  10473. while ($retries--) {
  10474. try {
  10475. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10476. break;
  10477. } catch (TransportException $e) {
  10478. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10479. throw $e;
  10480. }
  10481. $this->io->writeError('');
  10482. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10483. usleep(500000);
  10484. }
  10485. }
  10486. if (!$this->outputProgress) {
  10487. $this->io->writeError(' (<comment>100%</comment>)', false);
  10488. }
  10489. if ($this->cache) {
  10490. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10491. $this->cache->copyFrom($cacheKey, $fileName);
  10492. }
  10493. }
  10494. if (!file_exists($fileName)) {
  10495. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10496. .' directory is writable and you have internet connectivity');
  10497. }
  10498. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10499. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10500. }
  10501. } catch (\Exception $e) {
  10502. $this->filesystem->removeDirectory($path);
  10503. $this->clearLastCacheWrite($package);
  10504. throw $e;
  10505. }
  10506. return $fileName;
  10507. }
  10508. public function setOutputProgress($outputProgress)
  10509. {
  10510. $this->outputProgress = $outputProgress;
  10511. return $this;
  10512. }
  10513. protected function clearLastCacheWrite(PackageInterface $package)
  10514. {
  10515. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10516. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10517. unset($this->lastCacheWrites[$package->getName()]);
  10518. }
  10519. }
  10520. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10521. {
  10522. $name = $target->getName();
  10523. $from = $initial->getFullPrettyVersion();
  10524. $to = $target->getFullPrettyVersion();
  10525. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10526. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10527. $this->remove($initial, $path, false);
  10528. $this->download($target, $path, false);
  10529. $this->io->writeError('');
  10530. }
  10531. public function remove(PackageInterface $package, $path, $output = true)
  10532. {
  10533. if ($output) {
  10534. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10535. }
  10536. if (!$this->filesystem->removeDirectory($path)) {
  10537. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10538. }
  10539. }
  10540. protected function getFileName(PackageInterface $package, $path)
  10541. {
  10542. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10543. }
  10544. protected function processUrl(PackageInterface $package, $url)
  10545. {
  10546. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10547. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10548. }
  10549. if ($package->getDistReference()) {
  10550. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10551. }
  10552. return $url;
  10553. }
  10554. private function getCacheKey(PackageInterface $package, $processedUrl)
  10555. {
  10556. $cacheKey = sha1($processedUrl);
  10557. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10558. }
  10559. public function getLocalChanges(PackageInterface $package, $targetDir)
  10560. {
  10561. $prevIO = $this->io;
  10562. $prevProgress = $this->outputProgress;
  10563. $this->io = new NullIO;
  10564. $this->io->loadConfiguration($this->config);
  10565. $this->outputProgress = false;
  10566. $e = null;
  10567. try {
  10568. $this->download($package, $targetDir.'_compare', false);
  10569. $comparer = new Comparer();
  10570. $comparer->setSource($targetDir.'_compare');
  10571. $comparer->setUpdate($targetDir);
  10572. $comparer->doCompare();
  10573. $output = $comparer->getChanged(true, true);
  10574. $this->filesystem->removeDirectory($targetDir.'_compare');
  10575. } catch (\Exception $e) {
  10576. }
  10577. $this->io = $prevIO;
  10578. $this->outputProgress = $prevProgress;
  10579. if ($e) {
  10580. throw $e;
  10581. }
  10582. return trim($output);
  10583. }
  10584. }
  10585. <?php
  10586. namespace Composer\Downloader;
  10587. class FilesystemException extends \Exception
  10588. {
  10589. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10590. {
  10591. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10592. }
  10593. }
  10594. <?php
  10595. namespace Composer\Downloader;
  10596. use Composer\Package\PackageInterface;
  10597. use Composer\Util\ProcessExecutor;
  10598. class FossilDownloader extends VcsDownloader
  10599. {
  10600. public function doDownload(PackageInterface $package, $path, $url)
  10601. {
  10602. $this->config->prohibitUrlByConfig($url, $this->io);
  10603. $url = ProcessExecutor::escape($url);
  10604. $ref = ProcessExecutor::escape($package->getSourceReference());
  10605. $repoFile = $path . '.fossil';
  10606. $this->io->writeError("Cloning ".$package->getSourceReference());
  10607. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10608. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10609. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10610. }
  10611. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10612. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10613. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10614. }
  10615. $command = sprintf('fossil update %s', $ref);
  10616. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10617. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10618. }
  10619. }
  10620. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10621. {
  10622. $this->config->prohibitUrlByConfig($url, $this->io);
  10623. $url = ProcessExecutor::escape($url);
  10624. $ref = ProcessExecutor::escape($target->getSourceReference());
  10625. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10626. if (!$this->hasMetadataRepository($path)) {
  10627. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10628. }
  10629. $command = sprintf('fossil pull && fossil up %s', $ref);
  10630. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10631. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10632. }
  10633. }
  10634. public function getLocalChanges(PackageInterface $package, $path)
  10635. {
  10636. if (!$this->hasMetadataRepository($path)) {
  10637. return null;
  10638. }
  10639. $this->process->execute('fossil changes', $output, realpath($path));
  10640. return trim($output) ?: null;
  10641. }
  10642. protected function getCommitLogs($fromReference, $toReference, $path)
  10643. {
  10644. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10645. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10646. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10647. }
  10648. $log = '';
  10649. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10650. foreach ($this->process->splitLines($output) as $line) {
  10651. if (preg_match($match, $line)) {
  10652. break;
  10653. }
  10654. $log .= $line;
  10655. }
  10656. return $log;
  10657. }
  10658. protected function hasMetadataRepository($path)
  10659. {
  10660. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10661. }
  10662. }
  10663. <?php
  10664. namespace Composer\Downloader;
  10665. use Composer\Config;
  10666. use Composer\IO\IOInterface;
  10667. use Composer\Package\PackageInterface;
  10668. use Composer\Util\Filesystem;
  10669. use Composer\Util\Git as GitUtil;
  10670. use Composer\Util\Platform;
  10671. use Composer\Util\ProcessExecutor;
  10672. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10673. {
  10674. private $hasStashedChanges = false;
  10675. private $hasDiscardedChanges = false;
  10676. private $gitUtil;
  10677. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10678. {
  10679. parent::__construct($io, $config, $process, $fs);
  10680. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10681. }
  10682. public function doDownload(PackageInterface $package, $path, $url)
  10683. {
  10684. GitUtil::cleanEnv();
  10685. $path = $this->normalizePath($path);
  10686. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10687. $ref = $package->getSourceReference();
  10688. $flag = Platform::isWindows() ? '/D ' : '';
  10689. $gitVersion = $this->gitUtil->getVersion();
  10690. $msg = "Cloning ".$this->getShortHash($ref);
  10691. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10692. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10693. $this->io->writeError('', true, IOInterface::DEBUG);
  10694. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10695. try {
  10696. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10697. if (is_dir($cachePath)) {
  10698. $command =
  10699. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10700. . '&& cd '.$flag.'%path% '
  10701. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10702. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10703. }
  10704. } catch (\RuntimeException $e) {
  10705. }
  10706. }
  10707. $this->io->writeError($msg);
  10708. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10709. return str_replace(
  10710. array('%url%', '%path%', '%cachePath%'),
  10711. array(
  10712. ProcessExecutor::escape($url),
  10713. ProcessExecutor::escape($path),
  10714. ProcessExecutor::escape($cachePath),
  10715. ),
  10716. $command
  10717. );
  10718. };
  10719. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10720. if ($url !== $package->getSourceUrl()) {
  10721. $this->updateOriginUrl($path, $package->getSourceUrl());
  10722. } else {
  10723. $this->setPushUrl($path, $url);
  10724. }
  10725. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10726. if ($package->getDistReference() === $package->getSourceReference()) {
  10727. $package->setDistReference($newRef);
  10728. }
  10729. $package->setSourceReference($newRef);
  10730. }
  10731. }
  10732. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10733. {
  10734. GitUtil::cleanEnv();
  10735. if (!$this->hasMetadataRepository($path)) {
  10736. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10737. }
  10738. $updateOriginUrl = false;
  10739. if (
  10740. 0 === $this->process->execute('git remote -v', $output, $path)
  10741. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10742. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10743. ) {
  10744. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10745. $updateOriginUrl = true;
  10746. }
  10747. }
  10748. $ref = $target->getSourceReference();
  10749. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10750. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10751. $commandCallable = function ($url) use ($command, $ref) {
  10752. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10753. };
  10754. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10755. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10756. if ($target->getDistReference() === $target->getSourceReference()) {
  10757. $target->setDistReference($newRef);
  10758. }
  10759. $target->setSourceReference($newRef);
  10760. }
  10761. if ($updateOriginUrl) {
  10762. $this->updateOriginUrl($path, $target->getSourceUrl());
  10763. }
  10764. }
  10765. public function getLocalChanges(PackageInterface $package, $path)
  10766. {
  10767. GitUtil::cleanEnv();
  10768. if (!$this->hasMetadataRepository($path)) {
  10769. return;
  10770. }
  10771. $command = 'git status --porcelain --untracked-files=no';
  10772. if (0 !== $this->process->execute($command, $output, $path)) {
  10773. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10774. }
  10775. return trim($output) ?: null;
  10776. }
  10777. public function getUnpushedChanges(PackageInterface $package, $path)
  10778. {
  10779. GitUtil::cleanEnv();
  10780. $path = $this->normalizePath($path);
  10781. if (!$this->hasMetadataRepository($path)) {
  10782. return;
  10783. }
  10784. $command = 'git show-ref --head -d';
  10785. if (0 !== $this->process->execute($command, $output, $path)) {
  10786. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10787. }
  10788. $refs = trim($output);
  10789. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10790. return;
  10791. }
  10792. $headRef = $match[1];
  10793. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10794. return;
  10795. }
  10796. $branch = $matches[1][0];
  10797. $unpushedChanges = null;
  10798. for ($i = 0; $i <= 1; $i++) {
  10799. foreach ($matches[1] as $candidate) {
  10800. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10801. $branch = $candidate;
  10802. $remoteBranch = $match[1];
  10803. break;
  10804. }
  10805. }
  10806. if (!isset($remoteBranch)) {
  10807. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10808. } else {
  10809. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10810. if (0 !== $this->process->execute($command, $output, $path)) {
  10811. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10812. }
  10813. $unpushedChanges = trim($output) ?: null;
  10814. }
  10815. if ($unpushedChanges && $i === 0) {
  10816. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10817. }
  10818. if (!$unpushedChanges) {
  10819. break;
  10820. }
  10821. }
  10822. return $unpushedChanges;
  10823. }
  10824. protected function cleanChanges(PackageInterface $package, $path, $update)
  10825. {
  10826. GitUtil::cleanEnv();
  10827. $path = $this->normalizePath($path);
  10828. $unpushed = $this->getUnpushedChanges($package, $path);
  10829. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10830. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10831. }
  10832. if (!$changes = $this->getLocalChanges($package, $path)) {
  10833. return;
  10834. }
  10835. if (!$this->io->isInteractive()) {
  10836. $discardChanges = $this->config->get('discard-changes');
  10837. if (true === $discardChanges) {
  10838. return $this->discardChanges($path);
  10839. }
  10840. if ('stash' === $discardChanges) {
  10841. if (!$update) {
  10842. return parent::cleanChanges($package, $path, $update);
  10843. }
  10844. return $this->stashChanges($path);
  10845. }
  10846. return parent::cleanChanges($package, $path, $update);
  10847. }
  10848. $changes = array_map(function ($elem) {
  10849. return ' '.$elem;
  10850. }, preg_split('{\s*\r?\n\s*}', $changes));
  10851. $this->io->writeError(' <error>The package has modified files:</error>');
  10852. $this->io->writeError(array_slice($changes, 0, 10));
  10853. if (count($changes) > 10) {
  10854. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10855. }
  10856. while (true) {
  10857. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10858. case 'y':
  10859. $this->discardChanges($path);
  10860. break 2;
  10861. case 's':
  10862. if (!$update) {
  10863. goto help;
  10864. }
  10865. $this->stashChanges($path);
  10866. break 2;
  10867. case 'n':
  10868. throw new \RuntimeException('Update aborted');
  10869. case 'v':
  10870. $this->io->writeError($changes);
  10871. break;
  10872. case 'd':
  10873. $this->viewDiff($path);
  10874. break;
  10875. case '?':
  10876. default:
  10877. help:
  10878. $this->io->writeError(array(
  10879. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10880. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10881. ' v - view modified files',
  10882. ' d - view local modifications (diff)',
  10883. ));
  10884. if ($update) {
  10885. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10886. }
  10887. $this->io->writeError(' ? - print help');
  10888. break;
  10889. }
  10890. }
  10891. }
  10892. protected function reapplyChanges($path)
  10893. {
  10894. $path = $this->normalizePath($path);
  10895. if ($this->hasStashedChanges) {
  10896. $this->hasStashedChanges = false;
  10897. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10898. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10899. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10900. }
  10901. }
  10902. $this->hasDiscardedChanges = false;
  10903. }
  10904. protected function updateToCommit($path, $reference, $branch, $date)
  10905. {
  10906. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10907. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10908. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10909. $branches = null;
  10910. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10911. $branches = $output;
  10912. }
  10913. $gitRef = $reference;
  10914. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10915. && $branches
  10916. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10917. ) {
  10918. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10919. if (0 === $this->process->execute($command, $output, $path)) {
  10920. return;
  10921. }
  10922. }
  10923. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10924. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10925. $branch = 'v' . $branch;
  10926. }
  10927. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10928. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10929. if (0 === $this->process->execute($command, $output, $path)
  10930. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10931. ) {
  10932. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10933. if (0 === $this->process->execute($command, $output, $path)) {
  10934. return;
  10935. }
  10936. }
  10937. }
  10938. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10939. if (0 === $this->process->execute($command, $output, $path)) {
  10940. return;
  10941. }
  10942. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10943. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10944. }
  10945. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10946. }
  10947. protected function updateOriginUrl($path, $url)
  10948. {
  10949. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10950. $this->setPushUrl($path, $url);
  10951. }
  10952. protected function setPushUrl($path, $url)
  10953. {
  10954. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10955. $protocols = $this->config->get('github-protocols');
  10956. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10957. if (!in_array('ssh', $protocols, true)) {
  10958. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10959. }
  10960. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10961. $this->process->execute($cmd, $ignoredOutput, $path);
  10962. }
  10963. }
  10964. protected function getCommitLogs($fromReference, $toReference, $path)
  10965. {
  10966. $path = $this->normalizePath($path);
  10967. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10968. if (0 !== $this->process->execute($command, $output, $path)) {
  10969. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10970. }
  10971. return $output;
  10972. }
  10973. protected function discardChanges($path)
  10974. {
  10975. $path = $this->normalizePath($path);
  10976. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10977. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10978. }
  10979. $this->hasDiscardedChanges = true;
  10980. }
  10981. protected function stashChanges($path)
  10982. {
  10983. $path = $this->normalizePath($path);
  10984. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10985. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10986. }
  10987. $this->hasStashedChanges = true;
  10988. }
  10989. protected function viewDiff($path)
  10990. {
  10991. $path = $this->normalizePath($path);
  10992. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10993. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10994. }
  10995. $this->io->writeError($output);
  10996. }
  10997. protected function normalizePath($path)
  10998. {
  10999. if (Platform::isWindows() && strlen($path) > 0) {
  11000. $basePath = $path;
  11001. $removed = array();
  11002. while (!is_dir($basePath) && $basePath !== '\\') {
  11003. array_unshift($removed, basename($basePath));
  11004. $basePath = dirname($basePath);
  11005. }
  11006. if ($basePath === '\\') {
  11007. return $path;
  11008. }
  11009. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11010. }
  11011. return $path;
  11012. }
  11013. protected function hasMetadataRepository($path)
  11014. {
  11015. $path = $this->normalizePath($path);
  11016. return is_dir($path.'/.git');
  11017. }
  11018. protected function getShortHash($reference)
  11019. {
  11020. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11021. return substr($reference, 0, 10);
  11022. }
  11023. return $reference;
  11024. }
  11025. }
  11026. <?php
  11027. namespace Composer\Downloader;
  11028. use Composer\Config;
  11029. use Composer\Cache;
  11030. use Composer\EventDispatcher\EventDispatcher;
  11031. use Composer\Package\PackageInterface;
  11032. use Composer\Util\Platform;
  11033. use Composer\Util\ProcessExecutor;
  11034. use Composer\Util\RemoteFilesystem;
  11035. use Composer\IO\IOInterface;
  11036. class GzipDownloader extends ArchiveDownloader
  11037. {
  11038. protected $process;
  11039. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11040. {
  11041. $this->process = $process ?: new ProcessExecutor($io);
  11042. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11043. }
  11044. protected function extract($file, $path)
  11045. {
  11046. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11047. if (!Platform::isWindows()) {
  11048. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11049. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11050. return;
  11051. }
  11052. if (extension_loaded('zlib')) {
  11053. $this->extractUsingExt($file, $targetFilepath);
  11054. return;
  11055. }
  11056. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11057. throw new \RuntimeException($processError);
  11058. }
  11059. $this->extractUsingExt($file, $targetFilepath);
  11060. }
  11061. protected function getFileName(PackageInterface $package, $path)
  11062. {
  11063. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11064. }
  11065. private function extractUsingExt($file, $targetFilepath)
  11066. {
  11067. $archiveFile = gzopen($file, 'rb');
  11068. $targetFile = fopen($targetFilepath, 'wb');
  11069. while ($string = gzread($archiveFile, 4096)) {
  11070. fwrite($targetFile, $string, Platform::strlen($string));
  11071. }
  11072. gzclose($archiveFile);
  11073. fclose($targetFile);
  11074. }
  11075. }
  11076. <?php
  11077. namespace Composer\Downloader;
  11078. use Composer\Package\PackageInterface;
  11079. use Composer\Util\ProcessExecutor;
  11080. use Composer\Util\Hg as HgUtils;
  11081. class HgDownloader extends VcsDownloader
  11082. {
  11083. public function doDownload(PackageInterface $package, $path, $url)
  11084. {
  11085. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11086. $cloneCommand = function ($url) use ($path) {
  11087. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11088. };
  11089. $hgUtils->runCommand($cloneCommand, $url, $path);
  11090. $ref = ProcessExecutor::escape($package->getSourceReference());
  11091. $command = sprintf('hg up %s', $ref);
  11092. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11093. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11094. }
  11095. }
  11096. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11097. {
  11098. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11099. $ref = $target->getSourceReference();
  11100. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11101. if (!$this->hasMetadataRepository($path)) {
  11102. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11103. }
  11104. $command = function ($url) use ($ref) {
  11105. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11106. };
  11107. $hgUtils->runCommand($command, $url, $path);
  11108. }
  11109. public function getLocalChanges(PackageInterface $package, $path)
  11110. {
  11111. if (!is_dir($path.'/.hg')) {
  11112. return null;
  11113. }
  11114. $this->process->execute('hg st', $output, realpath($path));
  11115. return trim($output) ?: null;
  11116. }
  11117. protected function getCommitLogs($fromReference, $toReference, $path)
  11118. {
  11119. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11120. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11121. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11122. }
  11123. return $output;
  11124. }
  11125. protected function hasMetadataRepository($path)
  11126. {
  11127. return is_dir($path . '/.hg');
  11128. }
  11129. }
  11130. <?php
  11131. namespace Composer\Downloader;
  11132. use Composer\Package\Archiver\ArchivableFilesFinder;
  11133. use Composer\Package\Dumper\ArrayDumper;
  11134. use Composer\Package\PackageInterface;
  11135. use Composer\Package\Version\VersionGuesser;
  11136. use Composer\Package\Version\VersionParser;
  11137. use Composer\Util\Platform;
  11138. use Composer\Util\ProcessExecutor;
  11139. use Composer\Util\Filesystem as ComposerFilesystem;
  11140. use Symfony\Component\Filesystem\Exception\IOException;
  11141. use Symfony\Component\Filesystem\Filesystem;
  11142. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11143. {
  11144. const STRATEGY_SYMLINK = 10;
  11145. const STRATEGY_MIRROR = 20;
  11146. public function download(PackageInterface $package, $path, $output = true)
  11147. {
  11148. $url = $package->getDistUrl();
  11149. $realUrl = realpath($url);
  11150. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11151. throw new \RuntimeException(sprintf(
  11152. 'Source path "%s" is not found for package %s',
  11153. $url,
  11154. $package->getName()
  11155. ));
  11156. }
  11157. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11158. throw new \RuntimeException(sprintf(
  11159. 'Package %s cannot install to "%s" inside its source at "%s"',
  11160. $package->getName(),
  11161. realpath($path),
  11162. $realUrl
  11163. ));
  11164. }
  11165. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11166. $currentStrategy = self::STRATEGY_SYMLINK;
  11167. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11168. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11169. if ($mirrorPathRepos) {
  11170. $currentStrategy = self::STRATEGY_MIRROR;
  11171. }
  11172. if (true === $transportOptions['symlink']) {
  11173. $currentStrategy = self::STRATEGY_SYMLINK;
  11174. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11175. } elseif (false === $transportOptions['symlink']) {
  11176. $currentStrategy = self::STRATEGY_MIRROR;
  11177. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11178. }
  11179. $fileSystem = new Filesystem();
  11180. $this->filesystem->removeDirectory($path);
  11181. if ($output) {
  11182. $this->io->writeError(sprintf(
  11183. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11184. $package->getName(),
  11185. $package->getFullPrettyVersion()
  11186. ), false);
  11187. }
  11188. $isFallback = false;
  11189. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11190. try {
  11191. if (Platform::isWindows()) {
  11192. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11193. $this->filesystem->junction($realUrl, $path);
  11194. } else {
  11195. $absolutePath = $path;
  11196. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11197. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11198. }
  11199. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11200. $path = rtrim($path, "/");
  11201. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11202. $fileSystem->symlink($shortestPath, $path);
  11203. }
  11204. } catch (IOException $e) {
  11205. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11206. $this->io->writeError('');
  11207. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11208. $currentStrategy = self::STRATEGY_MIRROR;
  11209. $isFallback = true;
  11210. } else {
  11211. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11212. }
  11213. }
  11214. }
  11215. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11216. $fs = new ComposerFilesystem();
  11217. $realUrl = $fs->normalizePath($realUrl);
  11218. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11219. $iterator = new ArchivableFilesFinder($realUrl, array());
  11220. $fileSystem->mirror($realUrl, $path, $iterator);
  11221. }
  11222. $this->io->writeError('');
  11223. }
  11224. public function remove(PackageInterface $package, $path, $output = true)
  11225. {
  11226. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11227. if ($output) {
  11228. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11229. }
  11230. if (!$this->filesystem->removeJunction($path)) {
  11231. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11232. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11233. }
  11234. } else {
  11235. parent::remove($package, $path, $output);
  11236. }
  11237. }
  11238. public function getVcsReference(PackageInterface $package, $path)
  11239. {
  11240. $parser = new VersionParser;
  11241. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11242. $dumper = new ArrayDumper;
  11243. $packageConfig = $dumper->dump($package);
  11244. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11245. return $packageVersion['commit'];
  11246. }
  11247. }
  11248. }
  11249. <?php
  11250. namespace Composer\Downloader;
  11251. use Composer\Util\Filesystem;
  11252. class PearPackageExtractor
  11253. {
  11254. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11255. private $filesystem;
  11256. private $file;
  11257. public function __construct($file)
  11258. {
  11259. if (!is_file($file)) {
  11260. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11261. }
  11262. $this->filesystem = new Filesystem();
  11263. $this->file = $file;
  11264. }
  11265. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11266. {
  11267. $extractionPath = $target.'/tarball';
  11268. try {
  11269. $archive = new \PharData($this->file);
  11270. $archive->extractTo($extractionPath, null, true);
  11271. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11272. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11273. }
  11274. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11275. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11276. $this->filesystem->removeDirectory($extractionPath);
  11277. } catch (\Exception $exception) {
  11278. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11279. }
  11280. }
  11281. private function copyFiles($files, $source, $target, $roles, $vars)
  11282. {
  11283. foreach ($files as $file) {
  11284. $from = $this->combine($source, $file['from']);
  11285. $to = $this->combine($target, $roles[$file['role']]);
  11286. $to = $this->combine($to, $file['to']);
  11287. $tasks = $file['tasks'];
  11288. $this->copyFile($from, $to, $tasks, $vars);
  11289. }
  11290. }
  11291. private function copyFile($from, $to, $tasks, $vars)
  11292. {
  11293. if (!is_file($from)) {
  11294. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11295. }
  11296. $this->filesystem->ensureDirectoryExists(dirname($to));
  11297. if (0 == count($tasks)) {
  11298. $copied = copy($from, $to);
  11299. } else {
  11300. $content = file_get_contents($from);
  11301. $replacements = array();
  11302. foreach ($tasks as $task) {
  11303. $pattern = $task['from'];
  11304. $varName = $task['to'];
  11305. if (isset($vars[$varName])) {
  11306. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11307. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11308. } else {
  11309. $replacements[$pattern] = $vars[$varName];
  11310. }
  11311. }
  11312. }
  11313. $content = strtr($content, $replacements);
  11314. $copied = file_put_contents($to, $content);
  11315. }
  11316. if (false === $copied) {
  11317. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11318. }
  11319. }
  11320. private function buildCopyActions($source, array $roles, $vars)
  11321. {
  11322. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11323. if (false === $package) {
  11324. throw new \RuntimeException('Package definition file is not valid.');
  11325. }
  11326. $packageSchemaVersion = $package['version'];
  11327. if ('1.0' == $packageSchemaVersion) {
  11328. $children = $package->release->filelist->children();
  11329. $packageName = (string) $package->name;
  11330. $packageVersion = (string) $package->release->version;
  11331. $sourceDir = $packageName . '-' . $packageVersion;
  11332. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11333. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11334. $children = $package->contents->children();
  11335. $packageName = (string) $package->name;
  11336. $packageVersion = (string) $package->version->release;
  11337. $sourceDir = $packageName . '-' . $packageVersion;
  11338. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11339. $namespaces = $package->getNamespaces();
  11340. $package->registerXPathNamespace('ns', $namespaces['']);
  11341. $releaseNodes = $package->xpath('ns:phprelease');
  11342. $this->applyRelease($result, $releaseNodes, $vars);
  11343. } else {
  11344. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11345. }
  11346. return $result;
  11347. }
  11348. private function applyRelease(&$actions, $releaseNodes, $vars)
  11349. {
  11350. foreach ($releaseNodes as $releaseNode) {
  11351. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11352. if ($requiredOs && $vars['os'] != $requiredOs) {
  11353. continue;
  11354. }
  11355. if ($releaseNode->filelist) {
  11356. foreach ($releaseNode->filelist->children() as $action) {
  11357. if ('install' == $action->getName()) {
  11358. $name = (string) $action['name'];
  11359. $as = (string) $action['as'];
  11360. if (isset($actions[$name])) {
  11361. $actions[$name]['to'] = $as;
  11362. }
  11363. } elseif ('ignore' == $action->getName()) {
  11364. $name = (string) $action['name'];
  11365. unset($actions[$name]);
  11366. } else {
  11367. }
  11368. }
  11369. }
  11370. break;
  11371. }
  11372. }
  11373. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11374. {
  11375. $result = array();
  11376. foreach ($children as $child) {
  11377. if ($child->getName() == 'dir') {
  11378. $dirSource = $this->combine($source, (string) $child['name']);
  11379. $dirTarget = $child['baseinstalldir'] ?: $target;
  11380. $dirRole = $child['role'] ?: $role;
  11381. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11382. $result = array_merge($result, $dirFiles);
  11383. } elseif ($child->getName() == 'file') {
  11384. $fileRole = (string) $child['role'] ?: $role;
  11385. if (isset($targetRoles[$fileRole])) {
  11386. $fileName = (string) ($child['name'] ?: $child[0]);
  11387. $fileSource = $this->combine($source, $fileName);
  11388. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11389. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11390. $fileTarget = $packageName . '/' . $fileTarget;
  11391. }
  11392. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11393. }
  11394. }
  11395. }
  11396. return $result;
  11397. }
  11398. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11399. {
  11400. $result = array();
  11401. foreach ($children as $child) {
  11402. if ('dir' == $child->getName()) {
  11403. $dirSource = $this->combine($source, $child['name']);
  11404. $dirTarget = $child['baseinstalldir'] ?: $target;
  11405. $dirRole = $child['role'] ?: $role;
  11406. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11407. $result = array_merge($result, $dirFiles);
  11408. } elseif ('file' == $child->getName()) {
  11409. $fileRole = (string) $child['role'] ?: $role;
  11410. if (isset($targetRoles[$fileRole])) {
  11411. $fileSource = $this->combine($source, (string) $child['name']);
  11412. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11413. $fileTasks = array();
  11414. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11415. if ('replace' == $taskNode->getName()) {
  11416. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11417. }
  11418. }
  11419. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11420. $fileTarget = $packageName . '/' . $fileTarget;
  11421. }
  11422. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11423. }
  11424. }
  11425. }
  11426. return $result;
  11427. }
  11428. private function combine($left, $right)
  11429. {
  11430. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11431. }
  11432. }
  11433. <?php
  11434. namespace Composer\Downloader;
  11435. use Composer\Package\PackageInterface;
  11436. use Composer\Repository\VcsRepository;
  11437. use Composer\Util\Perforce;
  11438. class PerforceDownloader extends VcsDownloader
  11439. {
  11440. protected $perforce;
  11441. public function doDownload(PackageInterface $package, $path, $url)
  11442. {
  11443. $ref = $package->getSourceReference();
  11444. $label = $this->getLabelFromSourceReference($ref);
  11445. $this->io->writeError('Cloning ' . $ref);
  11446. $this->initPerforce($package, $path, $url);
  11447. $this->perforce->setStream($ref);
  11448. $this->perforce->p4Login();
  11449. $this->perforce->writeP4ClientSpec();
  11450. $this->perforce->connectClient();
  11451. $this->perforce->syncCodeBase($label);
  11452. $this->perforce->cleanupClientSpec();
  11453. }
  11454. private function getLabelFromSourceReference($ref)
  11455. {
  11456. $pos = strpos($ref, '@');
  11457. if (false !== $pos) {
  11458. return substr($ref, $pos + 1);
  11459. }
  11460. return null;
  11461. }
  11462. public function initPerforce(PackageInterface $package, $path, $url)
  11463. {
  11464. if (!empty($this->perforce)) {
  11465. $this->perforce->initializePath($path);
  11466. return;
  11467. }
  11468. $repository = $package->getRepository();
  11469. $repoConfig = null;
  11470. if ($repository instanceof VcsRepository) {
  11471. $repoConfig = $this->getRepoConfig($repository);
  11472. }
  11473. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11474. }
  11475. private function getRepoConfig(VcsRepository $repository)
  11476. {
  11477. return $repository->getRepoConfig();
  11478. }
  11479. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11480. {
  11481. $this->doDownload($target, $path, $url);
  11482. }
  11483. public function getLocalChanges(PackageInterface $package, $path)
  11484. {
  11485. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11486. return;
  11487. }
  11488. protected function getCommitLogs($fromReference, $toReference, $path)
  11489. {
  11490. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11491. }
  11492. public function setPerforce($perforce)
  11493. {
  11494. $this->perforce = $perforce;
  11495. }
  11496. protected function hasMetadataRepository($path)
  11497. {
  11498. return true;
  11499. }
  11500. }
  11501. <?php
  11502. namespace Composer\Downloader;
  11503. class PharDownloader extends ArchiveDownloader
  11504. {
  11505. protected function extract($file, $path)
  11506. {
  11507. $archive = new \Phar($file);
  11508. $archive->extractTo($path, null, true);
  11509. }
  11510. }
  11511. <?php
  11512. namespace Composer\Downloader;
  11513. use Composer\Config;
  11514. use Composer\Cache;
  11515. use Composer\EventDispatcher\EventDispatcher;
  11516. use Composer\Util\IniHelper;
  11517. use Composer\Util\Platform;
  11518. use Composer\Util\ProcessExecutor;
  11519. use Composer\Util\RemoteFilesystem;
  11520. use Composer\IO\IOInterface;
  11521. use RarArchive;
  11522. class RarDownloader extends ArchiveDownloader
  11523. {
  11524. protected $process;
  11525. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11526. {
  11527. $this->process = $process ?: new ProcessExecutor($io);
  11528. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11529. }
  11530. protected function extract($file, $path)
  11531. {
  11532. $processError = null;
  11533. if (!Platform::isWindows()) {
  11534. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11535. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11536. return;
  11537. }
  11538. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11539. }
  11540. if (!class_exists('RarArchive')) {
  11541. $iniMessage = IniHelper::getMessage();
  11542. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11543. . $iniMessage . "\n" . $processError;
  11544. if (!Platform::isWindows()) {
  11545. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11546. }
  11547. throw new \RuntimeException($error);
  11548. }
  11549. $rarArchive = RarArchive::open($file);
  11550. if (false === $rarArchive) {
  11551. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11552. }
  11553. $entries = $rarArchive->getEntries();
  11554. if (false === $entries) {
  11555. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11556. }
  11557. foreach ($entries as $entry) {
  11558. if (false === $entry->extract($path)) {
  11559. throw new \RuntimeException('Could not extract entry');
  11560. }
  11561. }
  11562. $rarArchive->close();
  11563. }
  11564. }
  11565. <?php
  11566. namespace Composer\Downloader;
  11567. use Composer\Package\PackageInterface;
  11568. use Composer\Util\Svn as SvnUtil;
  11569. use Composer\Repository\VcsRepository;
  11570. use Composer\Util\ProcessExecutor;
  11571. class SvnDownloader extends VcsDownloader
  11572. {
  11573. protected $cacheCredentials = true;
  11574. public function doDownload(PackageInterface $package, $path, $url)
  11575. {
  11576. SvnUtil::cleanEnv();
  11577. $ref = $package->getSourceReference();
  11578. $repo = $package->getRepository();
  11579. if ($repo instanceof VcsRepository) {
  11580. $repoConfig = $repo->getRepoConfig();
  11581. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11582. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11583. }
  11584. }
  11585. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11586. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11587. }
  11588. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11589. {
  11590. SvnUtil::cleanEnv();
  11591. $ref = $target->getSourceReference();
  11592. if (!$this->hasMetadataRepository($path)) {
  11593. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11594. }
  11595. $util = new SvnUtil($url, $this->io, $this->config);
  11596. $flags = "";
  11597. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11598. $flags .= ' --ignore-ancestry';
  11599. }
  11600. $this->io->writeError(" Checking out " . $ref);
  11601. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11602. }
  11603. public function getLocalChanges(PackageInterface $package, $path)
  11604. {
  11605. if (!$this->hasMetadataRepository($path)) {
  11606. return null;
  11607. }
  11608. $this->process->execute('svn status --ignore-externals', $output, $path);
  11609. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11610. }
  11611. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11612. {
  11613. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11614. $util->setCacheCredentials($this->cacheCredentials);
  11615. try {
  11616. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11617. } catch (\RuntimeException $e) {
  11618. throw new \RuntimeException(
  11619. 'Package could not be downloaded, '.$e->getMessage()
  11620. );
  11621. }
  11622. }
  11623. protected function cleanChanges(PackageInterface $package, $path, $update)
  11624. {
  11625. if (!$changes = $this->getLocalChanges($package, $path)) {
  11626. return;
  11627. }
  11628. if (!$this->io->isInteractive()) {
  11629. if (true === $this->config->get('discard-changes')) {
  11630. return $this->discardChanges($path);
  11631. }
  11632. return parent::cleanChanges($package, $path, $update);
  11633. }
  11634. $changes = array_map(function ($elem) {
  11635. return ' '.$elem;
  11636. }, preg_split('{\s*\r?\n\s*}', $changes));
  11637. $countChanges = count($changes);
  11638. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11639. $this->io->writeError(array_slice($changes, 0, 10));
  11640. if ($countChanges > 10) {
  11641. $remaingChanges = $countChanges - 10;
  11642. $this->io->writeError(
  11643. sprintf(
  11644. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11645. $remaingChanges === 1 ? '' : 's'
  11646. )
  11647. );
  11648. }
  11649. while (true) {
  11650. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11651. case 'y':
  11652. $this->discardChanges($path);
  11653. break 2;
  11654. case 'n':
  11655. throw new \RuntimeException('Update aborted');
  11656. case 'v':
  11657. $this->io->writeError($changes);
  11658. break;
  11659. case '?':
  11660. default:
  11661. $this->io->writeError(array(
  11662. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11663. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11664. ' v - view modified files',
  11665. ' ? - print help',
  11666. ));
  11667. break;
  11668. }
  11669. }
  11670. }
  11671. protected function getCommitLogs($fromReference, $toReference, $path)
  11672. {
  11673. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11674. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11675. if (0 !== $this->process->execute($command, $output, $path)) {
  11676. throw new \RuntimeException(
  11677. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11678. );
  11679. }
  11680. $urlPattern = '#<url>(.*)</url>#';
  11681. if (preg_match($urlPattern, $output, $matches)) {
  11682. $baseUrl = $matches[1];
  11683. } else {
  11684. throw new \RuntimeException(
  11685. 'Unable to determine svn url for path '. $path
  11686. );
  11687. }
  11688. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11689. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11690. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11691. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11692. $util->setCacheCredentials($this->cacheCredentials);
  11693. try {
  11694. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11695. } catch (\RuntimeException $e) {
  11696. throw new \RuntimeException(
  11697. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11698. );
  11699. }
  11700. }
  11701. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11702. }
  11703. protected function discardChanges($path)
  11704. {
  11705. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11706. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11707. }
  11708. }
  11709. protected function hasMetadataRepository($path)
  11710. {
  11711. return is_dir($path.'/.svn');
  11712. }
  11713. }
  11714. <?php
  11715. namespace Composer\Downloader;
  11716. class TarDownloader extends ArchiveDownloader
  11717. {
  11718. protected function extract($file, $path)
  11719. {
  11720. $archive = new \PharData($file);
  11721. $archive->extractTo($path, null, true);
  11722. }
  11723. }
  11724. <?php
  11725. namespace Composer\Downloader;
  11726. class TransportException extends \RuntimeException
  11727. {
  11728. protected $headers;
  11729. protected $response;
  11730. protected $statusCode;
  11731. public function setHeaders($headers)
  11732. {
  11733. $this->headers = $headers;
  11734. }
  11735. public function getHeaders()
  11736. {
  11737. return $this->headers;
  11738. }
  11739. public function setResponse($response)
  11740. {
  11741. $this->response = $response;
  11742. }
  11743. public function getResponse()
  11744. {
  11745. return $this->response;
  11746. }
  11747. public function setStatusCode($statusCode)
  11748. {
  11749. $this->statusCode = $statusCode;
  11750. }
  11751. public function getStatusCode()
  11752. {
  11753. return $this->statusCode;
  11754. }
  11755. }
  11756. <?php
  11757. namespace Composer\Downloader;
  11758. use Composer\Package\PackageInterface;
  11759. interface VcsCapableDownloaderInterface
  11760. {
  11761. public function getVcsReference(PackageInterface $package, $path);
  11762. }
  11763. <?php
  11764. namespace Composer\Downloader;
  11765. use Composer\Config;
  11766. use Composer\Package\Dumper\ArrayDumper;
  11767. use Composer\Package\PackageInterface;
  11768. use Composer\Package\Version\VersionGuesser;
  11769. use Composer\Package\Version\VersionParser;
  11770. use Composer\Util\ProcessExecutor;
  11771. use Composer\IO\IOInterface;
  11772. use Composer\Util\Filesystem;
  11773. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11774. {
  11775. protected $io;
  11776. protected $config;
  11777. protected $process;
  11778. protected $filesystem;
  11779. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11780. {
  11781. $this->io = $io;
  11782. $this->config = $config;
  11783. $this->process = $process ?: new ProcessExecutor($io);
  11784. $this->filesystem = $fs ?: new Filesystem($this->process);
  11785. }
  11786. public function getInstallationSource()
  11787. {
  11788. return 'source';
  11789. }
  11790. public function download(PackageInterface $package, $path)
  11791. {
  11792. if (!$package->getSourceReference()) {
  11793. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11794. }
  11795. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11796. $this->filesystem->emptyDirectory($path);
  11797. $urls = $package->getSourceUrls();
  11798. while ($url = array_shift($urls)) {
  11799. try {
  11800. if (Filesystem::isLocalPath($url)) {
  11801. $needle = 'file://';
  11802. $isFileProtocol = false;
  11803. if (0 === strpos($url, $needle)) {
  11804. $url = substr($url, strlen($needle));
  11805. $isFileProtocol = true;
  11806. }
  11807. if (false !== strpos($url, '%')) {
  11808. $url = rawurldecode($url);
  11809. }
  11810. $url = realpath($url);
  11811. if ($isFileProtocol) {
  11812. $url = $needle . $url;
  11813. }
  11814. }
  11815. $this->doDownload($package, $path, $url);
  11816. break;
  11817. } catch (\Exception $e) {
  11818. if ($e instanceof \PHPUnit_Framework_Exception) {
  11819. throw $e;
  11820. }
  11821. if ($this->io->isDebug()) {
  11822. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11823. } elseif (count($urls)) {
  11824. $this->io->writeError(' Failed, trying the next URL');
  11825. }
  11826. if (!count($urls)) {
  11827. throw $e;
  11828. }
  11829. }
  11830. }
  11831. }
  11832. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11833. {
  11834. if (!$target->getSourceReference()) {
  11835. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11836. }
  11837. $name = $target->getName();
  11838. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11839. if ($target->getSourceType() === 'svn') {
  11840. $from = $initial->getSourceReference();
  11841. $to = $target->getSourceReference();
  11842. } else {
  11843. $from = substr($initial->getSourceReference(), 0, 7);
  11844. $to = substr($target->getSourceReference(), 0, 7);
  11845. }
  11846. $name .= ' '.$initial->getPrettyVersion();
  11847. } else {
  11848. $from = $initial->getFullPrettyVersion();
  11849. $to = $target->getFullPrettyVersion();
  11850. }
  11851. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11852. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11853. $this->cleanChanges($initial, $path, true);
  11854. $urls = $target->getSourceUrls();
  11855. $exception = null;
  11856. while ($url = array_shift($urls)) {
  11857. try {
  11858. if (Filesystem::isLocalPath($url)) {
  11859. $url = realpath($url);
  11860. }
  11861. $this->doUpdate($initial, $target, $path, $url);
  11862. $exception = null;
  11863. break;
  11864. } catch (\Exception $exception) {
  11865. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11866. throw $exception;
  11867. }
  11868. if ($this->io->isDebug()) {
  11869. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11870. } elseif (count($urls)) {
  11871. $this->io->writeError(' Failed, trying the next URL');
  11872. }
  11873. }
  11874. }
  11875. $this->reapplyChanges($path);
  11876. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11877. $message = 'Pulling in changes:';
  11878. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11879. if (!trim($logs)) {
  11880. $message = 'Rolling back changes:';
  11881. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11882. }
  11883. if (trim($logs)) {
  11884. $logs = implode("\n", array_map(function ($line) {
  11885. return ' ' . $line;
  11886. }, explode("\n", $logs)));
  11887. $logs = str_replace('<', '\<', $logs);
  11888. $this->io->writeError(' '.$message);
  11889. $this->io->writeError($logs);
  11890. }
  11891. }
  11892. if (!$urls && $exception) {
  11893. throw $exception;
  11894. }
  11895. }
  11896. public function remove(PackageInterface $package, $path)
  11897. {
  11898. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11899. $this->cleanChanges($package, $path, false);
  11900. if (!$this->filesystem->removeDirectory($path)) {
  11901. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11902. }
  11903. }
  11904. public function setOutputProgress($outputProgress)
  11905. {
  11906. return $this;
  11907. }
  11908. public function getVcsReference(PackageInterface $package, $path)
  11909. {
  11910. $parser = new VersionParser;
  11911. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11912. $dumper = new ArrayDumper;
  11913. $packageConfig = $dumper->dump($package);
  11914. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11915. return $packageVersion['commit'];
  11916. }
  11917. }
  11918. protected function cleanChanges(PackageInterface $package, $path, $update)
  11919. {
  11920. if (null !== $this->getLocalChanges($package, $path)) {
  11921. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11922. }
  11923. }
  11924. protected function reapplyChanges($path)
  11925. {
  11926. }
  11927. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11928. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11929. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11930. abstract protected function hasMetadataRepository($path);
  11931. }
  11932. <?php
  11933. namespace Composer\Downloader;
  11934. use Composer\Config;
  11935. use Composer\Cache;
  11936. use Composer\EventDispatcher\EventDispatcher;
  11937. use Composer\Package\PackageInterface;
  11938. use Composer\Util\ProcessExecutor;
  11939. use Composer\Util\RemoteFilesystem;
  11940. use Composer\IO\IOInterface;
  11941. class XzDownloader extends ArchiveDownloader
  11942. {
  11943. protected $process;
  11944. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11945. {
  11946. $this->process = $process ?: new ProcessExecutor($io);
  11947. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11948. }
  11949. protected function extract($file, $path)
  11950. {
  11951. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11952. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11953. return;
  11954. }
  11955. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11956. throw new \RuntimeException($processError);
  11957. }
  11958. protected function getFileName(PackageInterface $package, $path)
  11959. {
  11960. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11961. }
  11962. }
  11963. <?php
  11964. namespace Composer\Downloader;
  11965. use Composer\Config;
  11966. use Composer\Cache;
  11967. use Composer\EventDispatcher\EventDispatcher;
  11968. use Composer\Package\PackageInterface;
  11969. use Composer\Util\IniHelper;
  11970. use Composer\Util\Platform;
  11971. use Composer\Util\ProcessExecutor;
  11972. use Composer\Util\RemoteFilesystem;
  11973. use Composer\IO\IOInterface;
  11974. use Symfony\Component\Process\ExecutableFinder;
  11975. use ZipArchive;
  11976. class ZipDownloader extends ArchiveDownloader
  11977. {
  11978. protected static $hasSystemUnzip;
  11979. private static $hasZipArchive;
  11980. private static $isWindows;
  11981. protected $process;
  11982. private $zipArchiveObject;
  11983. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11984. {
  11985. $this->process = $process ?: new ProcessExecutor($io);
  11986. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11987. }
  11988. public function download(PackageInterface $package, $path, $output = true)
  11989. {
  11990. if (null === self::$hasSystemUnzip) {
  11991. $finder = new ExecutableFinder;
  11992. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11993. }
  11994. if (null === self::$hasZipArchive) {
  11995. self::$hasZipArchive = class_exists('ZipArchive');
  11996. }
  11997. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11998. $iniMessage = IniHelper::getMessage();
  11999. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12000. throw new \RuntimeException($error);
  12001. }
  12002. if (null === self::$isWindows) {
  12003. self::$isWindows = Platform::isWindows();
  12004. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12005. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12006. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  12007. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12008. }
  12009. }
  12010. return parent::download($package, $path, $output);
  12011. }
  12012. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12013. {
  12014. if (!self::$hasZipArchive) {
  12015. $isLastChance = true;
  12016. }
  12017. if (!self::$hasSystemUnzip && !$isLastChance) {
  12018. return $this->extractWithZipArchive($file, $path, true);
  12019. }
  12020. $processError = null;
  12021. $overwrite = $isLastChance ? '-o' : '';
  12022. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12023. try {
  12024. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12025. return true;
  12026. }
  12027. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  12028. } catch (\Exception $e) {
  12029. $processError = $e;
  12030. }
  12031. if ($isLastChance) {
  12032. throw $processError;
  12033. }
  12034. $this->io->writeError(' '.$processError->getMessage());
  12035. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12036. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12037. return $this->extractWithZipArchive($file, $path, true);
  12038. }
  12039. protected function extractWithZipArchive($file, $path, $isLastChance)
  12040. {
  12041. if (!self::$hasSystemUnzip) {
  12042. $isLastChance = true;
  12043. }
  12044. if (!self::$hasZipArchive && !$isLastChance) {
  12045. return $this->extractWithSystemUnzip($file, $path, true);
  12046. }
  12047. $processError = null;
  12048. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12049. try {
  12050. if (true === ($retval = $zipArchive->open($file))) {
  12051. $extractResult = $zipArchive->extractTo($path);
  12052. if (true === $extractResult) {
  12053. $zipArchive->close();
  12054. return true;
  12055. }
  12056. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12057. } else {
  12058. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12059. }
  12060. } catch (\ErrorException $e) {
  12061. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12062. } catch (\Exception $e) {
  12063. $processError = $e;
  12064. }
  12065. if ($isLastChance) {
  12066. throw $processError;
  12067. }
  12068. $this->io->writeError(' '.$processError->getMessage());
  12069. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12070. return $this->extractWithSystemUnzip($file, $path, true);
  12071. }
  12072. public function extract($file, $path)
  12073. {
  12074. if (self::$isWindows) {
  12075. $this->extractWithZipArchive($file, $path, false);
  12076. } else {
  12077. $this->extractWithSystemUnzip($file, $path, false);
  12078. }
  12079. }
  12080. protected function getErrorMessage($retval, $file)
  12081. {
  12082. switch ($retval) {
  12083. case ZipArchive::ER_EXISTS:
  12084. return sprintf("File '%s' already exists.", $file);
  12085. case ZipArchive::ER_INCONS:
  12086. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12087. case ZipArchive::ER_INVAL:
  12088. return sprintf("Invalid argument (%s)", $file);
  12089. case ZipArchive::ER_MEMORY:
  12090. return sprintf("Malloc failure (%s)", $file);
  12091. case ZipArchive::ER_NOENT:
  12092. return sprintf("No such zip file: '%s'", $file);
  12093. case ZipArchive::ER_NOZIP:
  12094. return sprintf("'%s' is not a zip archive.", $file);
  12095. case ZipArchive::ER_OPEN:
  12096. return sprintf("Can't open zip file: %s", $file);
  12097. case ZipArchive::ER_READ:
  12098. return sprintf("Zip read error (%s)", $file);
  12099. case ZipArchive::ER_SEEK:
  12100. return sprintf("Zip seek error (%s)", $file);
  12101. default:
  12102. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12103. }
  12104. }
  12105. }
  12106. <?php
  12107. namespace Composer\EventDispatcher;
  12108. class Event
  12109. {
  12110. protected $name;
  12111. protected $args;
  12112. protected $flags;
  12113. private $propagationStopped = false;
  12114. public function __construct($name, array $args = array(), array $flags = array())
  12115. {
  12116. $this->name = $name;
  12117. $this->args = $args;
  12118. $this->flags = $flags;
  12119. }
  12120. public function getName()
  12121. {
  12122. return $this->name;
  12123. }
  12124. public function getArguments()
  12125. {
  12126. return $this->args;
  12127. }
  12128. public function getFlags()
  12129. {
  12130. return $this->flags;
  12131. }
  12132. public function isPropagationStopped()
  12133. {
  12134. return $this->propagationStopped;
  12135. }
  12136. public function stopPropagation()
  12137. {
  12138. $this->propagationStopped = true;
  12139. }
  12140. }
  12141. <?php
  12142. namespace Composer\EventDispatcher;
  12143. use Composer\DependencyResolver\PolicyInterface;
  12144. use Composer\DependencyResolver\Pool;
  12145. use Composer\DependencyResolver\Request;
  12146. use Composer\Installer\InstallerEvent;
  12147. use Composer\IO\IOInterface;
  12148. use Composer\Composer;
  12149. use Composer\DependencyResolver\Operation\OperationInterface;
  12150. use Composer\Repository\CompositeRepository;
  12151. use Composer\Script;
  12152. use Composer\Installer\PackageEvent;
  12153. use Composer\Installer\BinaryInstaller;
  12154. use Composer\Util\ProcessExecutor;
  12155. use Composer\Script\Event as ScriptEvent;
  12156. use Symfony\Component\Process\PhpExecutableFinder;
  12157. class EventDispatcher
  12158. {
  12159. protected $composer;
  12160. protected $io;
  12161. protected $loader;
  12162. protected $process;
  12163. protected $listeners;
  12164. private $eventStack;
  12165. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12166. {
  12167. $this->composer = $composer;
  12168. $this->io = $io;
  12169. $this->process = $process ?: new ProcessExecutor($io);
  12170. $this->eventStack = array();
  12171. }
  12172. public function dispatch($eventName, Event $event = null)
  12173. {
  12174. if (null === $event) {
  12175. $event = new Event($eventName);
  12176. }
  12177. return $this->doDispatch($event);
  12178. }
  12179. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12180. {
  12181. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12182. }
  12183. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12184. {
  12185. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12186. }
  12187. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12188. {
  12189. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12190. }
  12191. protected function doDispatch(Event $event)
  12192. {
  12193. $pathStr = 'PATH';
  12194. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12195. $pathStr = 'Path';
  12196. }
  12197. $binDir = $this->composer->getConfig()->get('bin-dir');
  12198. if (is_dir($binDir)) {
  12199. $binDir = realpath($binDir);
  12200. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12201. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12202. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12203. }
  12204. }
  12205. $listeners = $this->getListeners($event);
  12206. $this->pushEvent($event);
  12207. $return = 0;
  12208. foreach ($listeners as $callable) {
  12209. if (!is_string($callable)) {
  12210. if (!is_callable($callable)) {
  12211. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12212. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12213. }
  12214. $event = $this->checkListenerExpectedEvent($callable, $event);
  12215. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12216. } elseif ($this->isComposerScript($callable)) {
  12217. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12218. $script = explode(' ', substr($callable, 1));
  12219. $scriptName = $script[0];
  12220. unset($script[0]);
  12221. $args = array_merge($script, $event->getArguments());
  12222. $flags = $event->getFlags();
  12223. if (substr($callable, 0, 10) === '@composer ') {
  12224. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12225. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12226. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12227. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12228. }
  12229. } else {
  12230. if (!$this->getListeners(new Event($scriptName))) {
  12231. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12232. }
  12233. try {
  12234. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  12235. } catch (ScriptExecutionException $e) {
  12236. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12237. throw $e;
  12238. }
  12239. }
  12240. } elseif ($this->isPhpScript($callable)) {
  12241. $className = substr($callable, 0, strpos($callable, '::'));
  12242. $methodName = substr($callable, strpos($callable, '::') + 2);
  12243. if (!class_exists($className)) {
  12244. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12245. continue;
  12246. }
  12247. if (!is_callable($callable)) {
  12248. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12249. continue;
  12250. }
  12251. try {
  12252. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12253. } catch (\Exception $e) {
  12254. $message = "Script %s handling the %s event terminated with an exception";
  12255. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12256. throw $e;
  12257. }
  12258. } else {
  12259. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12260. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12261. if ($this->io->isVerbose()) {
  12262. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12263. } else {
  12264. $this->io->writeError(sprintf('> %s', $exec));
  12265. }
  12266. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12267. if ($possibleLocalBinaries) {
  12268. foreach ($possibleLocalBinaries as $localExec) {
  12269. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12270. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12271. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12272. break;
  12273. }
  12274. }
  12275. }
  12276. if (substr($exec, 0, 5) === '@php ') {
  12277. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12278. }
  12279. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12280. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12281. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12282. }
  12283. }
  12284. if ($event->isPropagationStopped()) {
  12285. break;
  12286. }
  12287. }
  12288. $this->popEvent();
  12289. return $return;
  12290. }
  12291. protected function getPhpExecCommand()
  12292. {
  12293. $finder = new PhpExecutableFinder();
  12294. $phpPath = $finder->find(false);
  12295. if (!$phpPath) {
  12296. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  12297. }
  12298. $phpArgs = $finder->findArguments();
  12299. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  12300. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12301. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12302. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12303. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12304. }
  12305. protected function executeEventPhpScript($className, $methodName, Event $event)
  12306. {
  12307. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12308. if ($this->io->isVerbose()) {
  12309. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12310. } else {
  12311. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12312. }
  12313. return $className::$methodName($event);
  12314. }
  12315. protected function checkListenerExpectedEvent($target, Event $event)
  12316. {
  12317. if (in_array($event->getName(), array(
  12318. 'init',
  12319. 'command',
  12320. 'pre-file-download',
  12321. ), true)) {
  12322. return $event;
  12323. }
  12324. try {
  12325. $reflected = new \ReflectionParameter($target, 0);
  12326. } catch (\Exception $e) {
  12327. return $event;
  12328. }
  12329. $typehint = $reflected->getClass();
  12330. if (!$typehint instanceof \ReflectionClass) {
  12331. return $event;
  12332. }
  12333. $expected = $typehint->getName();
  12334. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12335. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12336. $event = new \Composer\Script\CommandEvent(
  12337. $event->getName(),
  12338. $event->getComposer(),
  12339. $event->getIO(),
  12340. $event->isDevMode(),
  12341. $event->getArguments()
  12342. );
  12343. }
  12344. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12345. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12346. $event = new \Composer\Script\PackageEvent(
  12347. $event->getName(),
  12348. $event->getComposer(),
  12349. $event->getIO(),
  12350. $event->isDevMode(),
  12351. $event->getPolicy(),
  12352. $event->getPool(),
  12353. $event->getInstalledRepo(),
  12354. $event->getRequest(),
  12355. $event->getOperations(),
  12356. $event->getOperation()
  12357. );
  12358. }
  12359. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12360. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12361. $event = new \Composer\Script\Event(
  12362. $event->getName(),
  12363. $event->getComposer(),
  12364. $event->getIO(),
  12365. $event->isDevMode(),
  12366. $event->getArguments(),
  12367. $event->getFlags()
  12368. );
  12369. }
  12370. return $event;
  12371. }
  12372. private function serializeCallback($cb)
  12373. {
  12374. if (is_array($cb) && count($cb) === 2) {
  12375. if (is_object($cb[0])) {
  12376. $cb[0] = get_class($cb[0]);
  12377. }
  12378. if (is_string($cb[0]) && is_string($cb[1])) {
  12379. $cb = implode('::', $cb);
  12380. }
  12381. }
  12382. if (is_string($cb)) {
  12383. return $cb;
  12384. }
  12385. return var_export($cb, true);
  12386. }
  12387. public function addListener($eventName, $listener, $priority = 0)
  12388. {
  12389. $this->listeners[$eventName][$priority][] = $listener;
  12390. }
  12391. public function addSubscriber(EventSubscriberInterface $subscriber)
  12392. {
  12393. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12394. if (is_string($params)) {
  12395. $this->addListener($eventName, array($subscriber, $params));
  12396. } elseif (is_string($params[0])) {
  12397. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12398. } else {
  12399. foreach ($params as $listener) {
  12400. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12401. }
  12402. }
  12403. }
  12404. }
  12405. protected function getListeners(Event $event)
  12406. {
  12407. $scriptListeners = $this->getScriptListeners($event);
  12408. if (!isset($this->listeners[$event->getName()][0])) {
  12409. $this->listeners[$event->getName()][0] = array();
  12410. }
  12411. krsort($this->listeners[$event->getName()]);
  12412. $listeners = $this->listeners;
  12413. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12414. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12415. }
  12416. public function hasEventListeners(Event $event)
  12417. {
  12418. $listeners = $this->getListeners($event);
  12419. return count($listeners) > 0;
  12420. }
  12421. protected function getScriptListeners(Event $event)
  12422. {
  12423. $package = $this->composer->getPackage();
  12424. $scripts = $package->getScripts();
  12425. if (empty($scripts[$event->getName()])) {
  12426. return array();
  12427. }
  12428. if ($this->loader) {
  12429. $this->loader->unregister();
  12430. }
  12431. $generator = $this->composer->getAutoloadGenerator();
  12432. if ($event instanceof ScriptEvent) {
  12433. $generator->setDevMode($event->isDevMode());
  12434. }
  12435. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12436. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12437. $map = $generator->parseAutoloads($packageMap, $package);
  12438. $this->loader = $generator->createLoader($map);
  12439. $this->loader->register();
  12440. return $scripts[$event->getName()];
  12441. }
  12442. protected function isPhpScript($callable)
  12443. {
  12444. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12445. }
  12446. protected function isComposerScript($callable)
  12447. {
  12448. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12449. }
  12450. protected function pushEvent(Event $event)
  12451. {
  12452. $eventName = $event->getName();
  12453. if (in_array($eventName, $this->eventStack)) {
  12454. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12455. }
  12456. return array_push($this->eventStack, $eventName);
  12457. }
  12458. protected function popEvent()
  12459. {
  12460. return array_pop($this->eventStack);
  12461. }
  12462. }
  12463. <?php
  12464. namespace Composer\EventDispatcher;
  12465. interface EventSubscriberInterface
  12466. {
  12467. public static function getSubscribedEvents();
  12468. }
  12469. <?php
  12470. namespace Composer\EventDispatcher;
  12471. class ScriptExecutionException extends \RuntimeException
  12472. {
  12473. }
  12474. <?php
  12475. namespace Composer\Exception;
  12476. class NoSslException extends \RuntimeException
  12477. {
  12478. }
  12479. <?php
  12480. namespace Composer;
  12481. use Composer\Config\JsonConfigSource;
  12482. use Composer\Json\JsonFile;
  12483. use Composer\IO\IOInterface;
  12484. use Composer\Package\Archiver;
  12485. use Composer\Package\Version\VersionGuesser;
  12486. use Composer\Repository\RepositoryManager;
  12487. use Composer\Repository\RepositoryFactory;
  12488. use Composer\Repository\WritableRepositoryInterface;
  12489. use Composer\Util\Filesystem;
  12490. use Composer\Util\Platform;
  12491. use Composer\Util\ProcessExecutor;
  12492. use Composer\Util\RemoteFilesystem;
  12493. use Composer\Util\Silencer;
  12494. use Composer\Plugin\PluginEvents;
  12495. use Composer\EventDispatcher\Event;
  12496. use Seld\JsonLint\DuplicateKeyException;
  12497. use Symfony\Component\Console\Formatter\OutputFormatter;
  12498. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12499. use Symfony\Component\Console\Output\ConsoleOutput;
  12500. use Composer\EventDispatcher\EventDispatcher;
  12501. use Composer\Autoload\AutoloadGenerator;
  12502. use Composer\Package\Version\VersionParser;
  12503. use Composer\Downloader\TransportException;
  12504. use Seld\JsonLint\JsonParser;
  12505. class Factory
  12506. {
  12507. protected static function getHomeDir()
  12508. {
  12509. $home = getenv('COMPOSER_HOME');
  12510. if ($home) {
  12511. return $home;
  12512. }
  12513. if (Platform::isWindows()) {
  12514. if (!getenv('APPDATA')) {
  12515. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12516. }
  12517. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12518. }
  12519. $userDir = self::getUserDir();
  12520. if (is_dir($userDir . '/.composer')) {
  12521. return $userDir . '/.composer';
  12522. }
  12523. if (self::useXdg()) {
  12524. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12525. return $xdgConfig . '/composer';
  12526. }
  12527. return $userDir . '/.composer';
  12528. }
  12529. protected static function getCacheDir($home)
  12530. {
  12531. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12532. if ($cacheDir) {
  12533. return $cacheDir;
  12534. }
  12535. $homeEnv = getenv('COMPOSER_HOME');
  12536. if ($homeEnv) {
  12537. return $homeEnv . '/cache';
  12538. }
  12539. if (Platform::isWindows()) {
  12540. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12541. $cacheDir .= '/Composer';
  12542. } else {
  12543. $cacheDir = $home . '/cache';
  12544. }
  12545. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12546. }
  12547. $userDir = self::getUserDir();
  12548. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12549. return $home . '/cache';
  12550. }
  12551. if (self::useXdg()) {
  12552. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12553. return $xdgCache . '/composer';
  12554. }
  12555. return $home . '/cache';
  12556. }
  12557. protected static function getDataDir($home)
  12558. {
  12559. $homeEnv = getenv('COMPOSER_HOME');
  12560. if ($homeEnv) {
  12561. return $homeEnv;
  12562. }
  12563. if (Platform::isWindows()) {
  12564. return strtr($home, '\\', '/');
  12565. }
  12566. $userDir = self::getUserDir();
  12567. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12568. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12569. return $xdgData . '/composer';
  12570. }
  12571. return $home;
  12572. }
  12573. public static function createConfig(IOInterface $io = null, $cwd = null)
  12574. {
  12575. $cwd = $cwd ?: getcwd();
  12576. $config = new Config(true, $cwd);
  12577. $home = self::getHomeDir();
  12578. $config->merge(array('config' => array(
  12579. 'home' => $home,
  12580. 'cache-dir' => self::getCacheDir($home),
  12581. 'data-dir' => self::getDataDir($home),
  12582. )));
  12583. $file = new JsonFile($config->get('home').'/config.json');
  12584. if ($file->exists()) {
  12585. if ($io && $io->isDebug()) {
  12586. $io->writeError('Loading config file ' . $file->getPath());
  12587. }
  12588. $config->merge($file->read());
  12589. }
  12590. $config->setConfigSource(new JsonConfigSource($file));
  12591. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12592. if ($htaccessProtect) {
  12593. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12594. foreach ($dirs as $dir) {
  12595. if (!file_exists($dir . '/.htaccess')) {
  12596. if (!is_dir($dir)) {
  12597. Silencer::call('mkdir', $dir, 0777, true);
  12598. }
  12599. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12600. }
  12601. }
  12602. }
  12603. $file = new JsonFile($config->get('home').'/auth.json');
  12604. if ($file->exists()) {
  12605. if ($io && $io->isDebug()) {
  12606. $io->writeError('Loading config file ' . $file->getPath());
  12607. }
  12608. $config->merge(array('config' => $file->read()));
  12609. }
  12610. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12611. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12612. $authData = json_decode($composerAuthEnv, true);
  12613. if (null === $authData) {
  12614. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12615. }
  12616. if ($io && $io->isDebug()) {
  12617. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12618. }
  12619. $config->merge(array('config' => $authData));
  12620. }
  12621. return $config;
  12622. }
  12623. public static function getComposerFile()
  12624. {
  12625. return trim(getenv('COMPOSER')) ?: './composer.json';
  12626. }
  12627. public static function createAdditionalStyles()
  12628. {
  12629. return array(
  12630. 'highlight' => new OutputFormatterStyle('red'),
  12631. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12632. );
  12633. }
  12634. public static function createOutput()
  12635. {
  12636. $styles = self::createAdditionalStyles();
  12637. $formatter = new OutputFormatter(false, $styles);
  12638. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12639. }
  12640. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12641. {
  12642. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12643. }
  12644. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12645. {
  12646. $cwd = $cwd ?: getcwd();
  12647. if (null === $localConfig) {
  12648. $localConfig = static::getComposerFile();
  12649. }
  12650. if (is_string($localConfig)) {
  12651. $composerFile = $localConfig;
  12652. $file = new JsonFile($localConfig, null, $io);
  12653. if (!$file->exists()) {
  12654. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12655. $message = 'Composer could not find a composer.json file in '.$cwd;
  12656. } else {
  12657. $message = 'Composer could not find the config file: '.$localConfig;
  12658. }
  12659. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12660. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12661. }
  12662. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12663. $jsonParser = new JsonParser;
  12664. try {
  12665. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12666. } catch (DuplicateKeyException $e) {
  12667. $details = $e->getDetails();
  12668. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12669. }
  12670. $localConfig = $file->read();
  12671. }
  12672. $config = static::createConfig($io, $cwd);
  12673. $config->merge($localConfig);
  12674. if (isset($composerFile)) {
  12675. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12676. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12677. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12678. if ($localAuthFile->exists()) {
  12679. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12680. $config->merge(array('config' => $localAuthFile->read()));
  12681. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12682. }
  12683. }
  12684. $vendorDir = $config->get('vendor-dir');
  12685. $composer = new Composer();
  12686. $composer->setConfig($config);
  12687. if ($fullLoad) {
  12688. $io->loadConfiguration($config);
  12689. }
  12690. $rfs = self::createRemoteFilesystem($io, $config);
  12691. $dispatcher = new EventDispatcher($composer, $io);
  12692. $composer->setEventDispatcher($dispatcher);
  12693. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12694. $composer->setRepositoryManager($rm);
  12695. $this->addLocalRepository($io, $rm, $vendorDir);
  12696. if (!$fullLoad && !isset($localConfig['version'])) {
  12697. $localConfig['version'] = '1.0.0';
  12698. }
  12699. $parser = new VersionParser;
  12700. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12701. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  12702. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12703. $composer->setPackage($package);
  12704. $im = $this->createInstallationManager();
  12705. $composer->setInstallationManager($im);
  12706. if ($fullLoad) {
  12707. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12708. $composer->setDownloadManager($dm);
  12709. $generator = new AutoloadGenerator($dispatcher, $io);
  12710. $composer->setAutoloadGenerator($generator);
  12711. $am = $this->createArchiveManager($config, $dm);
  12712. $composer->setArchiveManager($am);
  12713. }
  12714. $this->createDefaultInstallers($im, $composer, $io);
  12715. if ($fullLoad) {
  12716. $globalComposer = null;
  12717. if (realpath($config->get('home')) !== $cwd) {
  12718. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12719. }
  12720. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12721. $composer->setPluginManager($pm);
  12722. $pm->loadInstalledPlugins();
  12723. }
  12724. if ($fullLoad && isset($composerFile)) {
  12725. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12726. ? substr($composerFile, 0, -4).'lock'
  12727. : $composerFile . '.lock';
  12728. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12729. $composer->setLocker($locker);
  12730. }
  12731. if ($fullLoad) {
  12732. $initEvent = new Event(PluginEvents::INIT);
  12733. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12734. if ($rm->getLocalRepository()) {
  12735. $this->purgePackages($rm->getLocalRepository(), $im);
  12736. }
  12737. }
  12738. return $composer;
  12739. }
  12740. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12741. {
  12742. $factory = new static();
  12743. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12744. }
  12745. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12746. {
  12747. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12748. }
  12749. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12750. {
  12751. $composer = null;
  12752. try {
  12753. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12754. } catch (\Exception $e) {
  12755. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12756. }
  12757. return $composer;
  12758. }
  12759. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12760. {
  12761. $cache = null;
  12762. if ($config->get('cache-files-ttl') > 0) {
  12763. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12764. }
  12765. $dm = new Downloader\DownloadManager($io);
  12766. switch ($preferred = $config->get('preferred-install')) {
  12767. case 'dist':
  12768. $dm->setPreferDist(true);
  12769. break;
  12770. case 'source':
  12771. $dm->setPreferSource(true);
  12772. break;
  12773. case 'auto':
  12774. default:
  12775. break;
  12776. }
  12777. if (is_array($preferred)) {
  12778. $dm->setPreferences($preferred);
  12779. }
  12780. $executor = new ProcessExecutor($io);
  12781. $fs = new Filesystem($executor);
  12782. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12783. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12784. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12785. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12786. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12787. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12788. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12789. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12790. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12791. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12792. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12793. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12794. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12795. return $dm;
  12796. }
  12797. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12798. {
  12799. if (null === $dm) {
  12800. $io = new IO\NullIO();
  12801. $io->loadConfiguration($config);
  12802. $dm = $this->createDownloadManager($io, $config);
  12803. }
  12804. $am = new Archiver\ArchiveManager($dm);
  12805. $am->addArchiver(new Archiver\ZipArchiver);
  12806. $am->addArchiver(new Archiver\PharArchiver);
  12807. return $am;
  12808. }
  12809. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12810. {
  12811. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12812. }
  12813. protected function createInstallationManager()
  12814. {
  12815. return new Installer\InstallationManager();
  12816. }
  12817. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12818. {
  12819. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12820. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12821. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12822. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12823. }
  12824. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12825. {
  12826. foreach ($repo->getPackages() as $package) {
  12827. if (!$im->isPackageInstalled($repo, $package)) {
  12828. $repo->removePackage($package);
  12829. }
  12830. }
  12831. }
  12832. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12833. {
  12834. $factory = new static();
  12835. return $factory->createComposer($io, $config, $disablePlugins);
  12836. }
  12837. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12838. {
  12839. static $warned = false;
  12840. $disableTls = false;
  12841. if ($config && $config->get('disable-tls') === true) {
  12842. if (!$warned) {
  12843. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12844. }
  12845. $warned = true;
  12846. $disableTls = true;
  12847. } elseif (!extension_loaded('openssl')) {
  12848. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12849. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  12850. }
  12851. $remoteFilesystemOptions = array();
  12852. if ($disableTls === false) {
  12853. if ($config && $config->get('cafile')) {
  12854. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12855. }
  12856. if ($config && $config->get('capath')) {
  12857. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12858. }
  12859. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12860. }
  12861. try {
  12862. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12863. } catch (TransportException $e) {
  12864. if (false !== strpos($e->getMessage(), 'cafile')) {
  12865. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12866. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12867. if (PHP_VERSION_ID < 50600) {
  12868. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12869. }
  12870. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12871. }
  12872. throw $e;
  12873. }
  12874. return $remoteFilesystem;
  12875. }
  12876. private static function useXdg()
  12877. {
  12878. foreach (array_keys($_SERVER) as $key) {
  12879. if (substr($key, 0, 4) === 'XDG_') {
  12880. return true;
  12881. }
  12882. }
  12883. return false;
  12884. }
  12885. private static function getUserDir()
  12886. {
  12887. $home = getenv('HOME');
  12888. if (!$home) {
  12889. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12890. }
  12891. return rtrim(strtr($home, '\\', '/'), '/');
  12892. }
  12893. }
  12894. <?php
  12895. namespace Composer\IO;
  12896. use Composer\Config;
  12897. use Composer\Util\ProcessExecutor;
  12898. use Psr\Log\LoggerInterface;
  12899. use Psr\Log\LogLevel;
  12900. abstract class BaseIO implements IOInterface, LoggerInterface
  12901. {
  12902. protected $authentications = array();
  12903. public function getAuthentications()
  12904. {
  12905. return $this->authentications;
  12906. }
  12907. public function hasAuthentication($repositoryName)
  12908. {
  12909. return isset($this->authentications[$repositoryName]);
  12910. }
  12911. public function getAuthentication($repositoryName)
  12912. {
  12913. if (isset($this->authentications[$repositoryName])) {
  12914. return $this->authentications[$repositoryName];
  12915. }
  12916. return array('username' => null, 'password' => null);
  12917. }
  12918. public function setAuthentication($repositoryName, $username, $password = null)
  12919. {
  12920. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12921. }
  12922. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12923. {
  12924. if ($this->hasAuthentication($repositoryName)) {
  12925. $auth = $this->getAuthentication($repositoryName);
  12926. if ($auth['username'] === $username && $auth['password'] === $password) {
  12927. return;
  12928. }
  12929. $this->writeError(
  12930. sprintf(
  12931. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12932. $repositoryName
  12933. )
  12934. );
  12935. }
  12936. $this->setAuthentication($repositoryName, $username, $password);
  12937. }
  12938. public function loadConfiguration(Config $config)
  12939. {
  12940. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12941. $githubOauth = $config->get('github-oauth') ?: array();
  12942. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12943. $gitlabToken = $config->get('gitlab-token') ?: array();
  12944. $httpBasic = $config->get('http-basic') ?: array();
  12945. foreach ($bitbucketOauth as $domain => $cred) {
  12946. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12947. }
  12948. foreach ($githubOauth as $domain => $token) {
  12949. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12950. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12951. }
  12952. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12953. }
  12954. foreach ($gitlabOauth as $domain => $token) {
  12955. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12956. }
  12957. foreach ($gitlabToken as $domain => $token) {
  12958. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12959. }
  12960. foreach ($httpBasic as $domain => $cred) {
  12961. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12962. }
  12963. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12964. }
  12965. public function emergency($message, array $context = array())
  12966. {
  12967. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12968. }
  12969. public function alert($message, array $context = array())
  12970. {
  12971. return $this->log(LogLevel::ALERT, $message, $context);
  12972. }
  12973. public function critical($message, array $context = array())
  12974. {
  12975. return $this->log(LogLevel::CRITICAL, $message, $context);
  12976. }
  12977. public function error($message, array $context = array())
  12978. {
  12979. return $this->log(LogLevel::ERROR, $message, $context);
  12980. }
  12981. public function warning($message, array $context = array())
  12982. {
  12983. return $this->log(LogLevel::WARNING, $message, $context);
  12984. }
  12985. public function notice($message, array $context = array())
  12986. {
  12987. return $this->log(LogLevel::NOTICE, $message, $context);
  12988. }
  12989. public function info($message, array $context = array())
  12990. {
  12991. return $this->log(LogLevel::INFO, $message, $context);
  12992. }
  12993. public function debug($message, array $context = array())
  12994. {
  12995. return $this->log(LogLevel::DEBUG, $message, $context);
  12996. }
  12997. public function log($level, $message, array $context = array())
  12998. {
  12999. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13000. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13001. } elseif ($level === LogLevel::WARNING) {
  13002. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13003. } elseif ($level === LogLevel::NOTICE) {
  13004. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13005. } elseif ($level === LogLevel::INFO) {
  13006. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13007. } else {
  13008. $this->writeError($message, true, self::DEBUG);
  13009. }
  13010. }
  13011. }
  13012. <?php
  13013. namespace Composer\IO;
  13014. use Symfony\Component\Console\Output\StreamOutput;
  13015. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13016. use Symfony\Component\Console\Input\StringInput;
  13017. use Symfony\Component\Console\Helper\HelperSet;
  13018. class BufferIO extends ConsoleIO
  13019. {
  13020. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13021. {
  13022. $input = new StringInput($input);
  13023. $input->setInteractive(false);
  13024. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13025. parent::__construct($input, $output, new HelperSet(array()));
  13026. }
  13027. public function getOutput()
  13028. {
  13029. fseek($this->output->getStream(), 0);
  13030. $output = stream_get_contents($this->output->getStream());
  13031. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13032. $pre = strip_tags($matches[1]);
  13033. if (strlen($pre) === strlen($matches[2])) {
  13034. return '';
  13035. }
  13036. return rtrim($matches[1])."\n";
  13037. }, $output);
  13038. return $output;
  13039. }
  13040. }
  13041. <?php
  13042. namespace Composer\IO;
  13043. use Composer\Question\StrictConfirmationQuestion;
  13044. use Symfony\Component\Console\Helper\HelperSet;
  13045. use Symfony\Component\Console\Input\InputInterface;
  13046. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13047. use Symfony\Component\Console\Output\OutputInterface;
  13048. use Symfony\Component\Console\Question\ChoiceQuestion;
  13049. use Symfony\Component\Console\Question\Question;
  13050. class ConsoleIO extends BaseIO
  13051. {
  13052. protected $input;
  13053. protected $output;
  13054. protected $helperSet;
  13055. protected $lastMessage;
  13056. protected $lastMessageErr;
  13057. private $startTime;
  13058. private $verbosityMap;
  13059. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13060. {
  13061. $this->input = $input;
  13062. $this->output = $output;
  13063. $this->helperSet = $helperSet;
  13064. $this->verbosityMap = array(
  13065. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13066. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13067. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13068. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13069. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13070. );
  13071. }
  13072. public function enableDebugging($startTime)
  13073. {
  13074. $this->startTime = $startTime;
  13075. }
  13076. public function isInteractive()
  13077. {
  13078. return $this->input->isInteractive();
  13079. }
  13080. public function isDecorated()
  13081. {
  13082. return $this->output->isDecorated();
  13083. }
  13084. public function isVerbose()
  13085. {
  13086. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13087. }
  13088. public function isVeryVerbose()
  13089. {
  13090. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13091. }
  13092. public function isDebug()
  13093. {
  13094. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13095. }
  13096. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13097. {
  13098. $this->doWrite($messages, $newline, false, $verbosity);
  13099. }
  13100. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13101. {
  13102. $this->doWrite($messages, $newline, true, $verbosity);
  13103. }
  13104. private function doWrite($messages, $newline, $stderr, $verbosity)
  13105. {
  13106. $sfVerbosity = $this->verbosityMap[$verbosity];
  13107. if ($sfVerbosity > $this->output->getVerbosity()) {
  13108. return;
  13109. }
  13110. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13111. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13112. }
  13113. if (null !== $this->startTime) {
  13114. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13115. $timeSpent = microtime(true) - $this->startTime;
  13116. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13117. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13118. }, (array) $messages);
  13119. }
  13120. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13121. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13122. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13123. return;
  13124. }
  13125. $this->output->write($messages, $newline, $sfVerbosity);
  13126. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13127. }
  13128. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13129. {
  13130. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13131. }
  13132. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13133. {
  13134. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13135. }
  13136. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13137. {
  13138. $messages = implode($newline ? "\n" : '', (array) $messages);
  13139. if (!isset($size)) {
  13140. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13141. }
  13142. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13143. $this->doWrite($messages, false, $stderr, $verbosity);
  13144. $fill = $size - strlen(strip_tags($messages));
  13145. if ($fill > 0) {
  13146. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13147. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13148. }
  13149. if ($newline) {
  13150. $this->doWrite('', true, $stderr, $verbosity);
  13151. }
  13152. if ($stderr) {
  13153. $this->lastMessageErr = $messages;
  13154. } else {
  13155. $this->lastMessage = $messages;
  13156. }
  13157. }
  13158. public function ask($question, $default = null)
  13159. {
  13160. $helper = $this->helperSet->get('question');
  13161. $question = new Question($question, $default);
  13162. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13163. }
  13164. public function askConfirmation($question, $default = true)
  13165. {
  13166. $helper = $this->helperSet->get('question');
  13167. $question = new StrictConfirmationQuestion($question, $default);
  13168. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13169. }
  13170. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13171. {
  13172. $helper = $this->helperSet->get('question');
  13173. $question = new Question($question, $default);
  13174. $question->setValidator($validator);
  13175. $question->setMaxAttempts($attempts);
  13176. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13177. }
  13178. public function askAndHideAnswer($question)
  13179. {
  13180. $helper = $this->helperSet->get('question');
  13181. $question = new Question($question);
  13182. $question->setHidden(true);
  13183. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13184. }
  13185. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13186. {
  13187. $helper = $this->helperSet->get('question');
  13188. $question = new ChoiceQuestion($question, $choices, $default);
  13189. $question->setMaxAttempts($attempts ?: null);
  13190. $question->setErrorMessage($errorMessage);
  13191. $question->setMultiselect($multiselect);
  13192. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13193. if (!is_array($result)) {
  13194. return (string) array_search($result, $choices, true);
  13195. }
  13196. $results = array();
  13197. foreach ($choices as $index => $choice) {
  13198. if (in_array($choice, $result, true)) {
  13199. $results[] = (string) $index;
  13200. }
  13201. }
  13202. return $results;
  13203. }
  13204. private function getErrorOutput()
  13205. {
  13206. if ($this->output instanceof ConsoleOutputInterface) {
  13207. return $this->output->getErrorOutput();
  13208. }
  13209. return $this->output;
  13210. }
  13211. }
  13212. <?php
  13213. namespace Composer\IO;
  13214. use Composer\Config;
  13215. interface IOInterface
  13216. {
  13217. const QUIET = 1;
  13218. const NORMAL = 2;
  13219. const VERBOSE = 4;
  13220. const VERY_VERBOSE = 8;
  13221. const DEBUG = 16;
  13222. public function isInteractive();
  13223. public function isVerbose();
  13224. public function isVeryVerbose();
  13225. public function isDebug();
  13226. public function isDecorated();
  13227. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13228. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13229. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13230. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13231. public function ask($question, $default = null);
  13232. public function askConfirmation($question, $default = true);
  13233. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13234. public function askAndHideAnswer($question);
  13235. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13236. public function getAuthentications();
  13237. public function hasAuthentication($repositoryName);
  13238. public function getAuthentication($repositoryName);
  13239. public function setAuthentication($repositoryName, $username, $password = null);
  13240. public function loadConfiguration(Config $config);
  13241. }
  13242. <?php
  13243. namespace Composer\IO;
  13244. class NullIO extends BaseIO
  13245. {
  13246. public function isInteractive()
  13247. {
  13248. return false;
  13249. }
  13250. public function isVerbose()
  13251. {
  13252. return false;
  13253. }
  13254. public function isVeryVerbose()
  13255. {
  13256. return false;
  13257. }
  13258. public function isDebug()
  13259. {
  13260. return false;
  13261. }
  13262. public function isDecorated()
  13263. {
  13264. return false;
  13265. }
  13266. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13267. {
  13268. }
  13269. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13270. {
  13271. }
  13272. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13273. {
  13274. }
  13275. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13276. {
  13277. }
  13278. public function ask($question, $default = null)
  13279. {
  13280. return $default;
  13281. }
  13282. public function askConfirmation($question, $default = true)
  13283. {
  13284. return $default;
  13285. }
  13286. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13287. {
  13288. return $default;
  13289. }
  13290. public function askAndHideAnswer($question)
  13291. {
  13292. return null;
  13293. }
  13294. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13295. {
  13296. return $default;
  13297. }
  13298. }
  13299. <?php
  13300. namespace Composer;
  13301. use Composer\Autoload\AutoloadGenerator;
  13302. use Composer\DependencyResolver\DefaultPolicy;
  13303. use Composer\DependencyResolver\Operation\UpdateOperation;
  13304. use Composer\DependencyResolver\Operation\InstallOperation;
  13305. use Composer\DependencyResolver\Operation\UninstallOperation;
  13306. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13307. use Composer\DependencyResolver\Operation\OperationInterface;
  13308. use Composer\DependencyResolver\PolicyInterface;
  13309. use Composer\DependencyResolver\Pool;
  13310. use Composer\DependencyResolver\Request;
  13311. use Composer\DependencyResolver\Rule;
  13312. use Composer\DependencyResolver\Solver;
  13313. use Composer\DependencyResolver\SolverProblemsException;
  13314. use Composer\Downloader\DownloadManager;
  13315. use Composer\EventDispatcher\EventDispatcher;
  13316. use Composer\Installer\InstallationManager;
  13317. use Composer\Installer\InstallerEvents;
  13318. use Composer\Installer\NoopInstaller;
  13319. use Composer\Installer\SuggestedPackagesReporter;
  13320. use Composer\IO\IOInterface;
  13321. use Composer\Package\AliasPackage;
  13322. use Composer\Package\BasePackage;
  13323. use Composer\Package\CompletePackage;
  13324. use Composer\Package\Link;
  13325. use Composer\Package\Loader\ArrayLoader;
  13326. use Composer\Package\Dumper\ArrayDumper;
  13327. use Composer\Semver\Constraint\Constraint;
  13328. use Composer\Package\Locker;
  13329. use Composer\Package\PackageInterface;
  13330. use Composer\Package\RootPackageInterface;
  13331. use Composer\Repository\CompositeRepository;
  13332. use Composer\Repository\InstalledArrayRepository;
  13333. use Composer\Repository\PlatformRepository;
  13334. use Composer\Repository\RepositoryInterface;
  13335. use Composer\Repository\RepositoryManager;
  13336. use Composer\Repository\WritableRepositoryInterface;
  13337. use Composer\Script\ScriptEvents;
  13338. class Installer
  13339. {
  13340. protected $io;
  13341. protected $config;
  13342. protected $package;
  13343. protected $downloadManager;
  13344. protected $repositoryManager;
  13345. protected $locker;
  13346. protected $installationManager;
  13347. protected $eventDispatcher;
  13348. protected $autoloadGenerator;
  13349. protected $preferSource = false;
  13350. protected $preferDist = false;
  13351. protected $optimizeAutoloader = false;
  13352. protected $classMapAuthoritative = false;
  13353. protected $apcuAutoloader = false;
  13354. protected $devMode = false;
  13355. protected $dryRun = false;
  13356. protected $verbose = false;
  13357. protected $update = false;
  13358. protected $dumpAutoloader = true;
  13359. protected $runScripts = true;
  13360. protected $ignorePlatformReqs = false;
  13361. protected $preferStable = false;
  13362. protected $preferLowest = false;
  13363. protected $skipSuggest = false;
  13364. protected $writeLock = true;
  13365. protected $executeOperations = true;
  13366. protected $updateWhitelist = null;
  13367. protected $whitelistDependencies = false;
  13368. protected $whitelistAllDependencies = false;
  13369. protected $suggestedPackagesReporter;
  13370. protected $additionalInstalledRepository;
  13371. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13372. {
  13373. $this->io = $io;
  13374. $this->config = $config;
  13375. $this->package = $package;
  13376. $this->downloadManager = $downloadManager;
  13377. $this->repositoryManager = $repositoryManager;
  13378. $this->locker = $locker;
  13379. $this->installationManager = $installationManager;
  13380. $this->eventDispatcher = $eventDispatcher;
  13381. $this->autoloadGenerator = $autoloadGenerator;
  13382. }
  13383. public function run()
  13384. {
  13385. gc_collect_cycles();
  13386. gc_disable();
  13387. if (!$this->update && !$this->locker->isLocked()) {
  13388. $this->update = true;
  13389. }
  13390. if ($this->dryRun) {
  13391. $this->verbose = true;
  13392. $this->runScripts = false;
  13393. $this->executeOperations = false;
  13394. $this->writeLock = false;
  13395. $this->dumpAutoloader = false;
  13396. $this->installationManager->addInstaller(new NoopInstaller);
  13397. $this->mockLocalRepositories($this->repositoryManager);
  13398. }
  13399. if ($this->runScripts) {
  13400. $devMode = (int) $this->devMode;
  13401. putenv("COMPOSER_DEV_MODE=$devMode");
  13402. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13403. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13404. }
  13405. $this->downloadManager->setPreferSource($this->preferSource);
  13406. $this->downloadManager->setPreferDist($this->preferDist);
  13407. $localRepo = $this->repositoryManager->getLocalRepository();
  13408. if ($this->update) {
  13409. $platformOverrides = $this->config->get('platform') ?: array();
  13410. } else {
  13411. $platformOverrides = $this->locker->getPlatformOverrides();
  13412. }
  13413. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13414. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13415. $aliases = $this->getRootAliases();
  13416. $this->aliasPlatformPackages($platformRepo, $aliases);
  13417. if (!$this->suggestedPackagesReporter) {
  13418. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13419. }
  13420. try {
  13421. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13422. if ($res !== 0) {
  13423. return $res;
  13424. }
  13425. } catch (\Exception $e) {
  13426. if ($this->executeOperations) {
  13427. $this->installationManager->notifyInstalls($this->io);
  13428. }
  13429. throw $e;
  13430. }
  13431. if ($this->executeOperations) {
  13432. $this->installationManager->notifyInstalls($this->io);
  13433. }
  13434. if ($this->devMode && !$this->skipSuggest) {
  13435. $this->suggestedPackagesReporter->output($installedRepo);
  13436. }
  13437. foreach ($localRepo->getPackages() as $package) {
  13438. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13439. continue;
  13440. }
  13441. $replacement = is_string($package->getReplacementPackage())
  13442. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13443. : 'No replacement was suggested';
  13444. $this->io->writeError(
  13445. sprintf(
  13446. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13447. $package->getPrettyName(),
  13448. $replacement
  13449. )
  13450. );
  13451. }
  13452. if ($this->update && $this->writeLock) {
  13453. $localRepo->reload();
  13454. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13455. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13456. $updatedLock = $this->locker->setLockData(
  13457. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13458. $devPackages,
  13459. $platformReqs,
  13460. $platformDevReqs,
  13461. $aliases,
  13462. $this->package->getMinimumStability(),
  13463. $this->package->getStabilityFlags(),
  13464. $this->preferStable || $this->package->getPreferStable(),
  13465. $this->preferLowest,
  13466. $this->config->get('platform') ?: array()
  13467. );
  13468. if ($updatedLock) {
  13469. $this->io->writeError('<info>Writing lock file</info>');
  13470. }
  13471. }
  13472. if ($this->dumpAutoloader) {
  13473. if ($this->optimizeAutoloader) {
  13474. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13475. } else {
  13476. $this->io->writeError('<info>Generating autoload files</info>');
  13477. }
  13478. $this->autoloadGenerator->setDevMode($this->devMode);
  13479. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13480. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13481. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13482. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13483. }
  13484. if ($this->executeOperations) {
  13485. foreach ($localRepo->getPackages() as $package) {
  13486. $this->installationManager->ensureBinariesPresence($package);
  13487. }
  13488. $vendorDir = $this->config->get('vendor-dir');
  13489. if (is_dir($vendorDir)) {
  13490. @touch($vendorDir);
  13491. }
  13492. }
  13493. if ($this->runScripts) {
  13494. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13495. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13496. }
  13497. if (!defined('HHVM_VERSION')) {
  13498. gc_enable();
  13499. }
  13500. return 0;
  13501. }
  13502. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13503. {
  13504. $lockedRepository = null;
  13505. $repositories = null;
  13506. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13507. try {
  13508. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13509. } catch (\RuntimeException $e) {
  13510. if ($this->package->getDevRequires()) {
  13511. throw $e;
  13512. }
  13513. $lockedRepository = $this->locker->getLockedRepository();
  13514. }
  13515. }
  13516. $this->whitelistUpdateDependencies(
  13517. $lockedRepository ?: $localRepo,
  13518. $this->package->getRequires(),
  13519. $this->package->getDevRequires()
  13520. );
  13521. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13522. $policy = $this->createPolicy();
  13523. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13524. $pool->addRepository($installedRepo, $aliases);
  13525. if ($this->update) {
  13526. $repositories = $this->repositoryManager->getRepositories();
  13527. foreach ($repositories as $repository) {
  13528. $pool->addRepository($repository, $aliases);
  13529. }
  13530. }
  13531. if ($lockedRepository) {
  13532. $pool->addRepository($lockedRepository, $aliases);
  13533. }
  13534. $request = $this->createRequest($this->package, $platformRepo);
  13535. if ($this->update) {
  13536. $removedUnstablePackages = array();
  13537. foreach ($localRepo->getPackages() as $package) {
  13538. if (
  13539. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13540. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13541. ) {
  13542. $removedUnstablePackages[$package->getName()] = true;
  13543. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13544. }
  13545. }
  13546. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13547. $request->updateAll();
  13548. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13549. foreach ($links as $link) {
  13550. $request->install($link->getTarget(), $link->getConstraint());
  13551. }
  13552. if ($this->updateWhitelist) {
  13553. $currentPackages = $this->getCurrentPackages($installedRepo);
  13554. $candidates = array();
  13555. foreach ($links as $link) {
  13556. $candidates[$link->getTarget()] = true;
  13557. $rootRequires[$link->getTarget()] = $link;
  13558. }
  13559. foreach ($currentPackages as $package) {
  13560. $candidates[$package->getName()] = true;
  13561. }
  13562. foreach ($candidates as $candidate => $dummy) {
  13563. foreach ($currentPackages as $curPackage) {
  13564. if ($curPackage->getName() === $candidate) {
  13565. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13566. $constraint = new Constraint('=', $curPackage->getVersion());
  13567. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13568. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13569. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13570. $request->install($curPackage->getName(), $constraint);
  13571. }
  13572. break;
  13573. }
  13574. }
  13575. }
  13576. }
  13577. } else {
  13578. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13579. if (!$this->locker->isFresh()) {
  13580. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  13581. }
  13582. foreach ($lockedRepository->getPackages() as $package) {
  13583. $version = $package->getVersion();
  13584. if (isset($aliases[$package->getName()][$version])) {
  13585. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13586. }
  13587. $constraint = new Constraint('=', $version);
  13588. $constraint->setPrettyString($package->getPrettyVersion());
  13589. $request->install($package->getName(), $constraint);
  13590. }
  13591. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13592. $request->install($link->getTarget(), $link->getConstraint());
  13593. }
  13594. }
  13595. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13596. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13597. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13598. try {
  13599. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13600. } catch (SolverProblemsException $e) {
  13601. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13602. $this->io->writeError($e->getMessage());
  13603. if ($this->update && !$this->devMode) {
  13604. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13605. }
  13606. return array(max(1, $e->getCode()), array());
  13607. }
  13608. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13609. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13610. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13611. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13612. if (!$operations) {
  13613. $this->io->writeError('Nothing to install or update');
  13614. }
  13615. $operations = $this->movePluginsToFront($operations);
  13616. $operations = $this->moveUninstallsToFront($operations);
  13617. if ($this->update) {
  13618. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13619. if (!$this->devMode) {
  13620. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13621. }
  13622. } else {
  13623. $devPackages = null;
  13624. }
  13625. if ($operations) {
  13626. $installs = $updates = $uninstalls = array();
  13627. foreach ($operations as $operation) {
  13628. if ($operation instanceof InstallOperation) {
  13629. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13630. } elseif ($operation instanceof UpdateOperation) {
  13631. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13632. } elseif ($operation instanceof UninstallOperation) {
  13633. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13634. }
  13635. }
  13636. $this->io->writeError(sprintf(
  13637. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13638. count($installs),
  13639. 1 === count($installs) ? '' : 's',
  13640. count($updates),
  13641. 1 === count($updates) ? '' : 's',
  13642. count($uninstalls),
  13643. 1 === count($uninstalls) ? '' : 's'
  13644. ));
  13645. if ($installs) {
  13646. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13647. }
  13648. if ($updates) {
  13649. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13650. }
  13651. if ($uninstalls) {
  13652. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13653. }
  13654. }
  13655. foreach ($operations as $operation) {
  13656. $jobType = $operation->getJobType();
  13657. if ('install' === $jobType) {
  13658. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13659. }
  13660. if ($this->update) {
  13661. $package = null;
  13662. if ('update' === $jobType) {
  13663. $package = $operation->getTargetPackage();
  13664. } elseif ('install' === $jobType) {
  13665. $package = $operation->getPackage();
  13666. }
  13667. if ($package && $package->isDev()) {
  13668. $references = $this->package->getReferences();
  13669. if (isset($references[$package->getName()])) {
  13670. $this->updateInstallReferences($package, $references[$package->getName()]);
  13671. }
  13672. }
  13673. if ('update' === $jobType) {
  13674. $targetPackage = $operation->getTargetPackage();
  13675. if ($targetPackage->isDev()) {
  13676. $initialPackage = $operation->getInitialPackage();
  13677. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13678. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13679. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13680. ) {
  13681. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13682. $this->io->writeError('', true, IOInterface::DEBUG);
  13683. continue;
  13684. }
  13685. }
  13686. }
  13687. }
  13688. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13689. if (defined($event) && $this->runScripts) {
  13690. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13691. }
  13692. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13693. $this->io->writeError(' - ' . $operation);
  13694. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13695. $this->io->writeError(' - ' . $operation);
  13696. }
  13697. $this->installationManager->execute($localRepo, $operation);
  13698. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13699. $reason = $operation->getReason();
  13700. if ($reason instanceof Rule) {
  13701. switch ($reason->getReason()) {
  13702. case Rule::RULE_JOB_INSTALL:
  13703. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13704. $this->io->writeError('');
  13705. break;
  13706. case Rule::RULE_PACKAGE_REQUIRES:
  13707. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13708. $this->io->writeError('');
  13709. break;
  13710. }
  13711. }
  13712. }
  13713. if ($this->executeOperations || $this->writeLock) {
  13714. $localRepo->write();
  13715. }
  13716. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13717. if (defined($event) && $this->runScripts) {
  13718. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13719. }
  13720. }
  13721. if ($this->executeOperations) {
  13722. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13723. $localRepo->write();
  13724. }
  13725. return array(0, $devPackages);
  13726. }
  13727. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13728. {
  13729. if (!$this->package->getDevRequires()) {
  13730. return array();
  13731. }
  13732. $tempLocalRepo = clone $localRepo;
  13733. foreach ($operations as $operation) {
  13734. switch ($operation->getJobType()) {
  13735. case 'install':
  13736. case 'markAliasInstalled':
  13737. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13738. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13739. }
  13740. break;
  13741. case 'uninstall':
  13742. case 'markAliasUninstalled':
  13743. $tempLocalRepo->removePackage($operation->getPackage());
  13744. break;
  13745. case 'update':
  13746. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13747. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13748. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13749. }
  13750. break;
  13751. default:
  13752. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13753. }
  13754. }
  13755. $localRepo = new InstalledArrayRepository(array());
  13756. $loader = new ArrayLoader(null, true);
  13757. $dumper = new ArrayDumper();
  13758. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13759. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13760. }
  13761. unset($tempLocalRepo, $loader, $dumper);
  13762. $policy = $this->createPolicy();
  13763. $pool = $this->createPool();
  13764. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13765. $pool->addRepository($installedRepo, $aliases);
  13766. $request = $this->createRequest($this->package, $platformRepo);
  13767. $request->updateAll();
  13768. foreach ($this->package->getRequires() as $link) {
  13769. $request->install($link->getTarget(), $link->getConstraint());
  13770. }
  13771. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13772. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13773. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13774. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13775. $devPackages = array();
  13776. foreach ($ops as $op) {
  13777. if ($op->getJobType() === 'uninstall') {
  13778. $devPackages[] = $op->getPackage();
  13779. }
  13780. }
  13781. return $devPackages;
  13782. }
  13783. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13784. {
  13785. $finalOps = array();
  13786. $packagesToSkip = array();
  13787. foreach ($devPackages as $pkg) {
  13788. $packagesToSkip[$pkg->getName()] = true;
  13789. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13790. if ($installedDevPkg instanceof AliasPackage) {
  13791. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13792. $installedDevPkg = $installedDevPkg->getAliasOf();
  13793. }
  13794. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13795. }
  13796. }
  13797. foreach ($operations as $op) {
  13798. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13799. if (isset($packagesToSkip[$package->getName()])) {
  13800. continue;
  13801. }
  13802. $finalOps[] = $op;
  13803. }
  13804. return $finalOps;
  13805. }
  13806. private function movePluginsToFront(array $operations)
  13807. {
  13808. $pluginsNoDeps = array();
  13809. $pluginsWithDeps = array();
  13810. $pluginRequires = array();
  13811. foreach (array_reverse($operations, true) as $idx => $op) {
  13812. if ($op instanceof InstallOperation) {
  13813. $package = $op->getPackage();
  13814. } elseif ($op instanceof UpdateOperation) {
  13815. $package = $op->getTargetPackage();
  13816. } else {
  13817. continue;
  13818. }
  13819. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13820. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13821. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13822. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13823. });
  13824. if ($isPlugin && !count($requires)) {
  13825. array_unshift($pluginsNoDeps, $op);
  13826. } else {
  13827. $pluginRequires = array_merge($pluginRequires, $requires);
  13828. array_unshift($pluginsWithDeps, $op);
  13829. }
  13830. unset($operations[$idx]);
  13831. }
  13832. }
  13833. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13834. }
  13835. private function moveUninstallsToFront(array $operations)
  13836. {
  13837. $uninstOps = array();
  13838. foreach ($operations as $idx => $op) {
  13839. if ($op instanceof UninstallOperation) {
  13840. $uninstOps[] = $op;
  13841. unset($operations[$idx]);
  13842. }
  13843. }
  13844. return array_merge($uninstOps, $operations);
  13845. }
  13846. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13847. {
  13848. $installedRootPackage = clone $this->package;
  13849. $installedRootPackage->setRequires(array());
  13850. $installedRootPackage->setDevRequires(array());
  13851. $repos = array(
  13852. $localRepo,
  13853. new InstalledArrayRepository(array($installedRootPackage)),
  13854. $platformRepo,
  13855. );
  13856. $installedRepo = new CompositeRepository($repos);
  13857. if ($this->additionalInstalledRepository) {
  13858. $installedRepo->addRepository($this->additionalInstalledRepository);
  13859. }
  13860. return $installedRepo;
  13861. }
  13862. private function createPool(RepositoryInterface $lockedRepository = null)
  13863. {
  13864. if ($this->update) {
  13865. $minimumStability = $this->package->getMinimumStability();
  13866. $stabilityFlags = $this->package->getStabilityFlags();
  13867. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13868. } else {
  13869. $minimumStability = $this->locker->getMinimumStability();
  13870. $stabilityFlags = $this->locker->getStabilityFlags();
  13871. $requires = array();
  13872. foreach ($lockedRepository->getPackages() as $package) {
  13873. $constraint = new Constraint('=', $package->getVersion());
  13874. $constraint->setPrettyString($package->getPrettyVersion());
  13875. $requires[$package->getName()] = $constraint;
  13876. }
  13877. }
  13878. $rootConstraints = array();
  13879. foreach ($requires as $req => $constraint) {
  13880. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13881. continue;
  13882. }
  13883. if ($constraint instanceof Link) {
  13884. $rootConstraints[$req] = $constraint->getConstraint();
  13885. } else {
  13886. $rootConstraints[$req] = $constraint;
  13887. }
  13888. }
  13889. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13890. }
  13891. private function createPolicy()
  13892. {
  13893. $preferStable = null;
  13894. $preferLowest = null;
  13895. if (!$this->update) {
  13896. $preferStable = $this->locker->getPreferStable();
  13897. $preferLowest = $this->locker->getPreferLowest();
  13898. }
  13899. if (null === $preferStable) {
  13900. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13901. }
  13902. if (null === $preferLowest) {
  13903. $preferLowest = $this->preferLowest;
  13904. }
  13905. return new DefaultPolicy($preferStable, $preferLowest);
  13906. }
  13907. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13908. {
  13909. $request = new Request();
  13910. $constraint = new Constraint('=', $rootPackage->getVersion());
  13911. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13912. $request->install($rootPackage->getName(), $constraint);
  13913. $fixedPackages = $platformRepo->getPackages();
  13914. if ($this->additionalInstalledRepository) {
  13915. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13916. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13917. }
  13918. $provided = $rootPackage->getProvides();
  13919. foreach ($fixedPackages as $package) {
  13920. $constraint = new Constraint('=', $package->getVersion());
  13921. $constraint->setPrettyString($package->getPrettyVersion());
  13922. if ($package->getRepository() !== $platformRepo
  13923. || !isset($provided[$package->getName()])
  13924. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13925. ) {
  13926. $request->fix($package->getName(), $constraint);
  13927. }
  13928. }
  13929. return $request;
  13930. }
  13931. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13932. {
  13933. if ($task === 'force-updates' && null === $operations) {
  13934. throw new \InvalidArgumentException('Missing operations argument');
  13935. }
  13936. if ($task === 'force-links') {
  13937. $operations = array();
  13938. }
  13939. if ($this->update && $this->updateWhitelist) {
  13940. $currentPackages = $this->getCurrentPackages($installedRepo);
  13941. }
  13942. foreach ($localRepo->getCanonicalPackages() as $package) {
  13943. if (!$package->isDev()) {
  13944. continue;
  13945. }
  13946. foreach ($operations as $operation) {
  13947. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13948. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13949. ) {
  13950. continue 2;
  13951. }
  13952. }
  13953. if ($this->update) {
  13954. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13955. foreach ($currentPackages as $curPackage) {
  13956. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13957. if ($task === 'force-links') {
  13958. $package->setRequires($curPackage->getRequires());
  13959. $package->setConflicts($curPackage->getConflicts());
  13960. $package->setProvides($curPackage->getProvides());
  13961. $package->setReplaces($curPackage->getReplaces());
  13962. } elseif ($task === 'force-updates') {
  13963. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13964. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13965. ) {
  13966. $operations[] = new UpdateOperation($package, $curPackage);
  13967. }
  13968. }
  13969. break;
  13970. }
  13971. }
  13972. continue;
  13973. }
  13974. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13975. foreach ($matches as $index => $match) {
  13976. if (!in_array($match->getRepository(), $repositories, true)) {
  13977. unset($matches[$index]);
  13978. continue;
  13979. }
  13980. if ($match->getName() !== $package->getName()) {
  13981. unset($matches[$index]);
  13982. continue;
  13983. }
  13984. $matches[$index] = $match->getId();
  13985. }
  13986. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13987. $newPackage = $pool->literalToPackage($matches[0]);
  13988. if ($task === 'force-links' && $newPackage) {
  13989. $package->setRequires($newPackage->getRequires());
  13990. $package->setConflicts($newPackage->getConflicts());
  13991. $package->setProvides($newPackage->getProvides());
  13992. $package->setReplaces($newPackage->getReplaces());
  13993. }
  13994. if (
  13995. $task === 'force-updates'
  13996. && $newPackage
  13997. && (
  13998. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13999. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14000. )
  14001. ) {
  14002. $operations[] = new UpdateOperation($package, $newPackage);
  14003. continue;
  14004. }
  14005. }
  14006. if ($task === 'force-updates') {
  14007. $references = $this->package->getReferences();
  14008. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14009. $operations[] = new UpdateOperation($package, clone $package);
  14010. }
  14011. }
  14012. } else {
  14013. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14014. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14015. if ($task === 'force-links') {
  14016. $package->setRequires($lockedPackage->getRequires());
  14017. $package->setConflicts($lockedPackage->getConflicts());
  14018. $package->setProvides($lockedPackage->getProvides());
  14019. $package->setReplaces($lockedPackage->getReplaces());
  14020. } elseif ($task === 'force-updates') {
  14021. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14022. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14023. ) {
  14024. $operations[] = new UpdateOperation($package, $lockedPackage);
  14025. }
  14026. }
  14027. break;
  14028. }
  14029. }
  14030. }
  14031. }
  14032. return $operations;
  14033. }
  14034. private function getCurrentPackages($installedRepo)
  14035. {
  14036. if ($this->locker->isLocked()) {
  14037. try {
  14038. return $this->locker->getLockedRepository(true)->getPackages();
  14039. } catch (\RuntimeException $e) {
  14040. return $this->locker->getLockedRepository()->getPackages();
  14041. }
  14042. }
  14043. return $installedRepo->getPackages();
  14044. }
  14045. private function getRootAliases()
  14046. {
  14047. if ($this->update) {
  14048. $aliases = $this->package->getAliases();
  14049. } else {
  14050. $aliases = $this->locker->getAliases();
  14051. }
  14052. $normalizedAliases = array();
  14053. foreach ($aliases as $alias) {
  14054. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14055. 'alias' => $alias['alias'],
  14056. 'alias_normalized' => $alias['alias_normalized'],
  14057. );
  14058. }
  14059. return $normalizedAliases;
  14060. }
  14061. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14062. {
  14063. if (!$this->update) {
  14064. return;
  14065. }
  14066. $rootRefs = $this->package->getReferences();
  14067. foreach ($localRepo->getCanonicalPackages() as $package) {
  14068. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14069. foreach ($matches as $index => $match) {
  14070. if (!in_array($match->getRepository(), $repositories, true)) {
  14071. unset($matches[$index]);
  14072. continue;
  14073. }
  14074. if ($match->getName() !== $package->getName()) {
  14075. unset($matches[$index]);
  14076. continue;
  14077. }
  14078. $matches[$index] = $match->getId();
  14079. }
  14080. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14081. $newPackage = $pool->literalToPackage($matches[0]);
  14082. $sourceUrl = $package->getSourceUrl();
  14083. $newSourceUrl = $newPackage->getSourceUrl();
  14084. $newReference = $newPackage->getSourceReference();
  14085. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14086. $newReference = $rootRefs[$package->getName()];
  14087. }
  14088. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  14089. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14090. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14091. }
  14092. $package->setDistMirrors($newPackage->getDistMirrors());
  14093. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14094. }
  14095. }
  14096. }
  14097. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  14098. {
  14099. $oldSourceRef = $package->getSourceReference();
  14100. if ($package->getSourceUrl() !== $sourceUrl) {
  14101. $package->setSourceType($sourceType);
  14102. $package->setSourceUrl($sourceUrl);
  14103. $package->setSourceReference($sourceReference);
  14104. }
  14105. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14106. $package->setDistUrl($distUrl);
  14107. $this->updateInstallReferences($package, $sourceReference);
  14108. }
  14109. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14110. $this->updateInstallReferences($package, $oldSourceRef);
  14111. }
  14112. }
  14113. private function updateInstallReferences(PackageInterface $package, $reference)
  14114. {
  14115. if (!$reference) {
  14116. return;
  14117. }
  14118. $package->setSourceReference($reference);
  14119. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14120. $package->setDistReference($reference);
  14121. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14122. } elseif ($package->getDistReference()) {
  14123. $package->setDistReference($reference);
  14124. }
  14125. }
  14126. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14127. {
  14128. foreach ($aliases as $package => $versions) {
  14129. foreach ($versions as $version => $alias) {
  14130. $packages = $platformRepo->findPackages($package, $version);
  14131. foreach ($packages as $package) {
  14132. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14133. $aliasPackage->setRootPackageAlias(true);
  14134. $platformRepo->addPackage($aliasPackage);
  14135. }
  14136. }
  14137. }
  14138. }
  14139. private function isUpdateable(PackageInterface $package)
  14140. {
  14141. if (!$this->updateWhitelist) {
  14142. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  14143. }
  14144. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  14145. $patternRegexp = BasePackage::packageNameToRegexp($whiteListedPattern);
  14146. if (preg_match($patternRegexp, $package->getName())) {
  14147. return true;
  14148. }
  14149. }
  14150. return false;
  14151. }
  14152. private function extractPlatformRequirements($links)
  14153. {
  14154. $platformReqs = array();
  14155. foreach ($links as $link) {
  14156. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14157. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14158. }
  14159. }
  14160. return $platformReqs;
  14161. }
  14162. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14163. {
  14164. if (!$this->updateWhitelist) {
  14165. return;
  14166. }
  14167. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14168. $skipPackages = array();
  14169. if (!$this->whitelistAllDependencies) {
  14170. foreach ($rootRequires as $require) {
  14171. $skipPackages[$require->getTarget()] = true;
  14172. }
  14173. }
  14174. $pool = new Pool('dev');
  14175. $pool->addRepository($localOrLockRepo);
  14176. $seen = array();
  14177. $rootRequiredPackageNames = array_keys($rootRequires);
  14178. foreach ($this->updateWhitelist as $packageName => $void) {
  14179. $packageQueue = new \SplQueue;
  14180. $nameMatchesRequiredPackage = false;
  14181. $depPackages = $pool->whatProvides($packageName);
  14182. $matchesByPattern = array();
  14183. if (empty($depPackages)) {
  14184. $whitelistPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  14185. foreach ($localOrLockRepo->search($whitelistPatternSearchRegexp) as $installedPackage) {
  14186. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  14187. }
  14188. $whitelistPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  14189. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14190. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14191. $nameMatchesRequiredPackage = true;
  14192. break;
  14193. }
  14194. }
  14195. }
  14196. if (!empty($matchesByPattern)) {
  14197. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  14198. }
  14199. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14200. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14201. }
  14202. foreach ($depPackages as $depPackage) {
  14203. $packageQueue->enqueue($depPackage);
  14204. }
  14205. while (!$packageQueue->isEmpty()) {
  14206. $package = $packageQueue->dequeue();
  14207. if (isset($seen[$package->getId()])) {
  14208. continue;
  14209. }
  14210. $seen[$package->getId()] = true;
  14211. $this->updateWhitelist[$package->getName()] = true;
  14212. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14213. continue;
  14214. }
  14215. $requires = $package->getRequires();
  14216. foreach ($requires as $require) {
  14217. $requirePackages = $pool->whatProvides($require->getTarget());
  14218. foreach ($requirePackages as $requirePackage) {
  14219. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14220. continue;
  14221. }
  14222. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  14223. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14224. continue;
  14225. }
  14226. $packageQueue->enqueue($requirePackage);
  14227. }
  14228. }
  14229. }
  14230. }
  14231. }
  14232. private function mockLocalRepositories(RepositoryManager $rm)
  14233. {
  14234. $packages = array();
  14235. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14236. $packages[(string) $package] = clone $package;
  14237. }
  14238. foreach ($packages as $key => $package) {
  14239. if ($package instanceof AliasPackage) {
  14240. $alias = (string) $package->getAliasOf();
  14241. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14242. }
  14243. }
  14244. $rm->setLocalRepository(
  14245. new InstalledArrayRepository($packages)
  14246. );
  14247. }
  14248. public static function create(IOInterface $io, Composer $composer)
  14249. {
  14250. return new static(
  14251. $io,
  14252. $composer->getConfig(),
  14253. $composer->getPackage(),
  14254. $composer->getDownloadManager(),
  14255. $composer->getRepositoryManager(),
  14256. $composer->getLocker(),
  14257. $composer->getInstallationManager(),
  14258. $composer->getEventDispatcher(),
  14259. $composer->getAutoloadGenerator()
  14260. );
  14261. }
  14262. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14263. {
  14264. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14265. return $this;
  14266. }
  14267. public function setDryRun($dryRun = true)
  14268. {
  14269. $this->dryRun = (bool) $dryRun;
  14270. return $this;
  14271. }
  14272. public function isDryRun()
  14273. {
  14274. return $this->dryRun;
  14275. }
  14276. public function setPreferSource($preferSource = true)
  14277. {
  14278. $this->preferSource = (bool) $preferSource;
  14279. return $this;
  14280. }
  14281. public function setPreferDist($preferDist = true)
  14282. {
  14283. $this->preferDist = (bool) $preferDist;
  14284. return $this;
  14285. }
  14286. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14287. {
  14288. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14289. if (!$this->optimizeAutoloader) {
  14290. $this->setClassMapAuthoritative(false);
  14291. }
  14292. return $this;
  14293. }
  14294. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14295. {
  14296. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14297. if ($this->classMapAuthoritative) {
  14298. $this->setOptimizeAutoloader(true);
  14299. }
  14300. return $this;
  14301. }
  14302. public function setApcuAutoloader($apcuAutoloader = false)
  14303. {
  14304. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14305. return $this;
  14306. }
  14307. public function setUpdate($update = true)
  14308. {
  14309. $this->update = (bool) $update;
  14310. return $this;
  14311. }
  14312. public function setDevMode($devMode = true)
  14313. {
  14314. $this->devMode = (bool) $devMode;
  14315. return $this;
  14316. }
  14317. public function setDumpAutoloader($dumpAutoloader = true)
  14318. {
  14319. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14320. return $this;
  14321. }
  14322. public function setRunScripts($runScripts = true)
  14323. {
  14324. $this->runScripts = (bool) $runScripts;
  14325. return $this;
  14326. }
  14327. public function setConfig(Config $config)
  14328. {
  14329. $this->config = $config;
  14330. return $this;
  14331. }
  14332. public function setVerbose($verbose = true)
  14333. {
  14334. $this->verbose = (bool) $verbose;
  14335. return $this;
  14336. }
  14337. public function isVerbose()
  14338. {
  14339. return $this->verbose;
  14340. }
  14341. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14342. {
  14343. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14344. return $this;
  14345. }
  14346. public function setUpdateWhitelist(array $packages)
  14347. {
  14348. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14349. return $this;
  14350. }
  14351. public function setWhitelistDependencies($updateDependencies = true)
  14352. {
  14353. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14354. }
  14355. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14356. {
  14357. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14358. return $this;
  14359. }
  14360. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14361. {
  14362. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14363. return $this;
  14364. }
  14365. public function setPreferStable($preferStable = true)
  14366. {
  14367. $this->preferStable = (bool) $preferStable;
  14368. return $this;
  14369. }
  14370. public function setPreferLowest($preferLowest = true)
  14371. {
  14372. $this->preferLowest = (bool) $preferLowest;
  14373. return $this;
  14374. }
  14375. public function setWriteLock($writeLock = true)
  14376. {
  14377. $this->writeLock = (bool) $writeLock;
  14378. return $this;
  14379. }
  14380. public function setExecuteOperations($executeOperations = true)
  14381. {
  14382. $this->executeOperations = (bool) $executeOperations;
  14383. return $this;
  14384. }
  14385. public function setSkipSuggest($skipSuggest = true)
  14386. {
  14387. $this->skipSuggest = (bool) $skipSuggest;
  14388. return $this;
  14389. }
  14390. public function disablePlugins()
  14391. {
  14392. $this->installationManager->disablePlugins();
  14393. return $this;
  14394. }
  14395. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14396. {
  14397. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14398. return $this;
  14399. }
  14400. }
  14401. <?php
  14402. namespace Composer\Installer;
  14403. use Composer\IO\IOInterface;
  14404. use Composer\Package\PackageInterface;
  14405. use Composer\Util\Filesystem;
  14406. use Composer\Util\Platform;
  14407. use Composer\Util\ProcessExecutor;
  14408. use Composer\Util\Silencer;
  14409. class BinaryInstaller
  14410. {
  14411. protected $binDir;
  14412. protected $binCompat;
  14413. protected $io;
  14414. protected $filesystem;
  14415. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14416. {
  14417. $this->binDir = $binDir;
  14418. $this->binCompat = $binCompat;
  14419. $this->io = $io;
  14420. $this->filesystem = $filesystem ?: new Filesystem();
  14421. }
  14422. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14423. {
  14424. $binaries = $this->getBinaries($package);
  14425. if (!$binaries) {
  14426. return;
  14427. }
  14428. foreach ($binaries as $bin) {
  14429. $binPath = $installPath.'/'.$bin;
  14430. if (!file_exists($binPath)) {
  14431. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14432. continue;
  14433. }
  14434. $binPath = realpath($binPath);
  14435. $this->initializeBinDir();
  14436. $link = $this->binDir.'/'.basename($bin);
  14437. if (file_exists($link)) {
  14438. if (is_link($link)) {
  14439. Silencer::call('chmod', $link, 0777 & ~umask());
  14440. }
  14441. if ($warnOnOverwrite) {
  14442. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14443. }
  14444. continue;
  14445. }
  14446. if ($this->binCompat === "auto") {
  14447. if (Platform::isWindows()) {
  14448. $this->installFullBinaries($binPath, $link, $bin, $package);
  14449. } else {
  14450. $this->installSymlinkBinaries($binPath, $link);
  14451. }
  14452. } elseif ($this->binCompat === "full") {
  14453. $this->installFullBinaries($binPath, $link, $bin, $package);
  14454. }
  14455. Silencer::call('chmod', $link, 0777 & ~umask());
  14456. }
  14457. }
  14458. public function removeBinaries(PackageInterface $package)
  14459. {
  14460. $this->initializeBinDir();
  14461. $binaries = $this->getBinaries($package);
  14462. if (!$binaries) {
  14463. return;
  14464. }
  14465. foreach ($binaries as $bin) {
  14466. $link = $this->binDir.'/'.basename($bin);
  14467. if (is_link($link) || file_exists($link)) {
  14468. $this->filesystem->unlink($link);
  14469. }
  14470. if (file_exists($link.'.bat')) {
  14471. $this->filesystem->unlink($link.'.bat');
  14472. }
  14473. }
  14474. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14475. Silencer::call('rmdir', $this->binDir);
  14476. }
  14477. }
  14478. public static function determineBinaryCaller($bin)
  14479. {
  14480. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14481. return 'call';
  14482. }
  14483. $handle = fopen($bin, 'r');
  14484. $line = fgets($handle);
  14485. fclose($handle);
  14486. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14487. return trim($match[1]);
  14488. }
  14489. return 'php';
  14490. }
  14491. protected function getBinaries(PackageInterface $package)
  14492. {
  14493. return $package->getBinaries();
  14494. }
  14495. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14496. {
  14497. if ('.bat' !== substr($binPath, -4)) {
  14498. $this->installUnixyProxyBinaries($binPath, $link);
  14499. @chmod($link, 0777 & ~umask());
  14500. $link .= '.bat';
  14501. if (file_exists($link)) {
  14502. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14503. }
  14504. }
  14505. if (!file_exists($link)) {
  14506. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14507. }
  14508. }
  14509. protected function installSymlinkBinaries($binPath, $link)
  14510. {
  14511. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14512. $this->installUnixyProxyBinaries($binPath, $link);
  14513. }
  14514. }
  14515. protected function installUnixyProxyBinaries($binPath, $link)
  14516. {
  14517. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14518. }
  14519. protected function initializeBinDir()
  14520. {
  14521. $this->filesystem->ensureDirectoryExists($this->binDir);
  14522. $this->binDir = realpath($this->binDir);
  14523. }
  14524. protected function generateWindowsProxyCode($bin, $link)
  14525. {
  14526. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14527. $caller = self::determineBinaryCaller($bin);
  14528. return "@ECHO OFF\r\n".
  14529. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14530. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14531. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14532. }
  14533. protected function generateUnixyProxyCode($bin, $link)
  14534. {
  14535. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14536. $binDir = ProcessExecutor::escape(dirname($binPath));
  14537. $binFile = basename($binPath);
  14538. $proxyCode = <<<PROXY
  14539. #!/usr/bin/env sh
  14540. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14541. if [ -d /proc/cygdrive ]; then
  14542. case \$(which php) in
  14543. \$(readlink -n /proc/cygdrive)/*)
  14544. # We are in Cygwin using Windows php, so the path must be translated
  14545. dir=\$(cygpath -m "\$dir");
  14546. ;;
  14547. esac
  14548. fi
  14549. "\${dir}/$binFile" "\$@"
  14550. PROXY;
  14551. return $proxyCode;
  14552. }
  14553. }
  14554. <?php
  14555. namespace Composer\Installer;
  14556. use Composer\Package\PackageInterface;
  14557. interface BinaryPresenceInterface
  14558. {
  14559. public function ensureBinariesPresence(PackageInterface $package);
  14560. }
  14561. <?php
  14562. namespace Composer\Installer;
  14563. use Composer\IO\IOInterface;
  14564. use Composer\Package\PackageInterface;
  14565. use Composer\Package\AliasPackage;
  14566. use Composer\Repository\RepositoryInterface;
  14567. use Composer\Repository\InstalledRepositoryInterface;
  14568. use Composer\DependencyResolver\Operation\OperationInterface;
  14569. use Composer\DependencyResolver\Operation\InstallOperation;
  14570. use Composer\DependencyResolver\Operation\UpdateOperation;
  14571. use Composer\DependencyResolver\Operation\UninstallOperation;
  14572. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14573. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14574. use Composer\Util\StreamContextFactory;
  14575. class InstallationManager
  14576. {
  14577. private $installers = array();
  14578. private $cache = array();
  14579. private $notifiablePackages = array();
  14580. public function reset()
  14581. {
  14582. $this->notifiablePackages = array();
  14583. }
  14584. public function addInstaller(InstallerInterface $installer)
  14585. {
  14586. array_unshift($this->installers, $installer);
  14587. $this->cache = array();
  14588. }
  14589. public function removeInstaller(InstallerInterface $installer)
  14590. {
  14591. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14592. array_splice($this->installers, $key, 1);
  14593. $this->cache = array();
  14594. }
  14595. }
  14596. public function disablePlugins()
  14597. {
  14598. foreach ($this->installers as $i => $installer) {
  14599. if (!$installer instanceof PluginInstaller) {
  14600. continue;
  14601. }
  14602. unset($this->installers[$i]);
  14603. }
  14604. }
  14605. public function getInstaller($type)
  14606. {
  14607. $type = strtolower($type);
  14608. if (isset($this->cache[$type])) {
  14609. return $this->cache[$type];
  14610. }
  14611. foreach ($this->installers as $installer) {
  14612. if ($installer->supports($type)) {
  14613. return $this->cache[$type] = $installer;
  14614. }
  14615. }
  14616. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14617. }
  14618. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14619. {
  14620. if ($package instanceof AliasPackage) {
  14621. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14622. }
  14623. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14624. }
  14625. public function ensureBinariesPresence(PackageInterface $package)
  14626. {
  14627. try {
  14628. $installer = $this->getInstaller($package->getType());
  14629. } catch (\InvalidArgumentException $e) {
  14630. return;
  14631. }
  14632. if ($installer instanceof BinaryPresenceInterface) {
  14633. $installer->ensureBinariesPresence($package);
  14634. }
  14635. }
  14636. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14637. {
  14638. $method = $operation->getJobType();
  14639. $this->$method($repo, $operation);
  14640. }
  14641. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14642. {
  14643. $package = $operation->getPackage();
  14644. $installer = $this->getInstaller($package->getType());
  14645. $installer->install($repo, $package);
  14646. $this->markForNotification($package);
  14647. }
  14648. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14649. {
  14650. $initial = $operation->getInitialPackage();
  14651. $target = $operation->getTargetPackage();
  14652. $initialType = $initial->getType();
  14653. $targetType = $target->getType();
  14654. if ($initialType === $targetType) {
  14655. $installer = $this->getInstaller($initialType);
  14656. $installer->update($repo, $initial, $target);
  14657. $this->markForNotification($target);
  14658. } else {
  14659. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14660. $this->getInstaller($targetType)->install($repo, $target);
  14661. }
  14662. }
  14663. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14664. {
  14665. $package = $operation->getPackage();
  14666. $installer = $this->getInstaller($package->getType());
  14667. $installer->uninstall($repo, $package);
  14668. }
  14669. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14670. {
  14671. $package = $operation->getPackage();
  14672. if (!$repo->hasPackage($package)) {
  14673. $repo->addPackage(clone $package);
  14674. }
  14675. }
  14676. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14677. {
  14678. $package = $operation->getPackage();
  14679. $repo->removePackage($package);
  14680. }
  14681. public function getInstallPath(PackageInterface $package)
  14682. {
  14683. $installer = $this->getInstaller($package->getType());
  14684. return $installer->getInstallPath($package);
  14685. }
  14686. public function notifyInstalls(IOInterface $io)
  14687. {
  14688. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14689. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14690. if ($io->hasAuthentication($repositoryName)) {
  14691. $auth = $io->getAuthentication($repositoryName);
  14692. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14693. $authHeader = 'Authorization: Basic '.$authStr;
  14694. }
  14695. if (strpos($repoUrl, '%package%')) {
  14696. foreach ($packages as $package) {
  14697. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14698. $params = array(
  14699. 'version' => $package->getPrettyVersion(),
  14700. 'version_normalized' => $package->getVersion(),
  14701. );
  14702. $opts = array('http' =>
  14703. array(
  14704. 'method' => 'POST',
  14705. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14706. 'content' => http_build_query($params, '', '&'),
  14707. 'timeout' => 3,
  14708. ),
  14709. );
  14710. if (isset($authHeader)) {
  14711. $opts['http']['header'][] = $authHeader;
  14712. }
  14713. $context = StreamContextFactory::getContext($url, $opts);
  14714. @file_get_contents($url, false, $context);
  14715. }
  14716. continue;
  14717. }
  14718. $postData = array('downloads' => array());
  14719. foreach ($packages as $package) {
  14720. $postData['downloads'][] = array(
  14721. 'name' => $package->getPrettyName(),
  14722. 'version' => $package->getVersion(),
  14723. );
  14724. }
  14725. $opts = array('http' =>
  14726. array(
  14727. 'method' => 'POST',
  14728. 'header' => array('Content-Type: application/json'),
  14729. 'content' => json_encode($postData),
  14730. 'timeout' => 6,
  14731. ),
  14732. );
  14733. if (isset($authHeader)) {
  14734. $opts['http']['header'][] = $authHeader;
  14735. }
  14736. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14737. @file_get_contents($repoUrl, false, $context);
  14738. }
  14739. $this->reset();
  14740. }
  14741. private function markForNotification(PackageInterface $package)
  14742. {
  14743. if ($package->getNotificationUrl()) {
  14744. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14745. }
  14746. }
  14747. }
  14748. <?php
  14749. namespace Composer\Installer;
  14750. use Composer\Composer;
  14751. use Composer\DependencyResolver\PolicyInterface;
  14752. use Composer\DependencyResolver\Operation\OperationInterface;
  14753. use Composer\DependencyResolver\Pool;
  14754. use Composer\DependencyResolver\Request;
  14755. use Composer\EventDispatcher\Event;
  14756. use Composer\IO\IOInterface;
  14757. use Composer\Repository\CompositeRepository;
  14758. class InstallerEvent extends Event
  14759. {
  14760. private $composer;
  14761. private $io;
  14762. private $devMode;
  14763. private $policy;
  14764. private $pool;
  14765. private $installedRepo;
  14766. private $request;
  14767. private $operations;
  14768. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14769. {
  14770. parent::__construct($eventName);
  14771. $this->composer = $composer;
  14772. $this->io = $io;
  14773. $this->devMode = $devMode;
  14774. $this->policy = $policy;
  14775. $this->pool = $pool;
  14776. $this->installedRepo = $installedRepo;
  14777. $this->request = $request;
  14778. $this->operations = $operations;
  14779. }
  14780. public function getComposer()
  14781. {
  14782. return $this->composer;
  14783. }
  14784. public function getIO()
  14785. {
  14786. return $this->io;
  14787. }
  14788. public function isDevMode()
  14789. {
  14790. return $this->devMode;
  14791. }
  14792. public function getPolicy()
  14793. {
  14794. return $this->policy;
  14795. }
  14796. public function getPool()
  14797. {
  14798. return $this->pool;
  14799. }
  14800. public function getInstalledRepo()
  14801. {
  14802. return $this->installedRepo;
  14803. }
  14804. public function getRequest()
  14805. {
  14806. return $this->request;
  14807. }
  14808. public function getOperations()
  14809. {
  14810. return $this->operations;
  14811. }
  14812. }
  14813. <?php
  14814. namespace Composer\Installer;
  14815. class InstallerEvents
  14816. {
  14817. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14818. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14819. }
  14820. <?php
  14821. namespace Composer\Installer;
  14822. use Composer\Package\PackageInterface;
  14823. use Composer\Repository\InstalledRepositoryInterface;
  14824. use InvalidArgumentException;
  14825. interface InstallerInterface
  14826. {
  14827. public function supports($packageType);
  14828. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14829. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14830. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14831. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14832. public function getInstallPath(PackageInterface $package);
  14833. }
  14834. <?php
  14835. namespace Composer\Installer;
  14836. use Composer\Composer;
  14837. use Composer\IO\IOInterface;
  14838. use Composer\Repository\InstalledRepositoryInterface;
  14839. use Composer\Package\PackageInterface;
  14840. use Composer\Util\Filesystem;
  14841. use Composer\Util\Silencer;
  14842. use Composer\Util\Platform;
  14843. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14844. {
  14845. protected $composer;
  14846. protected $vendorDir;
  14847. protected $binDir;
  14848. protected $downloadManager;
  14849. protected $io;
  14850. protected $type;
  14851. protected $filesystem;
  14852. protected $binCompat;
  14853. protected $binaryInstaller;
  14854. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14855. {
  14856. $this->composer = $composer;
  14857. $this->downloadManager = $composer->getDownloadManager();
  14858. $this->io = $io;
  14859. $this->type = $type;
  14860. $this->filesystem = $filesystem ?: new Filesystem();
  14861. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14862. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14863. }
  14864. public function supports($packageType)
  14865. {
  14866. return $packageType === $this->type || null === $this->type;
  14867. }
  14868. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14869. {
  14870. if (!$repo->hasPackage($package)) {
  14871. return false;
  14872. }
  14873. $installPath = $this->getInstallPath($package);
  14874. if (is_readable($installPath)) {
  14875. return true;
  14876. }
  14877. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  14878. }
  14879. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14880. {
  14881. $this->initializeVendorDir();
  14882. $downloadPath = $this->getInstallPath($package);
  14883. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14884. $this->binaryInstaller->removeBinaries($package);
  14885. }
  14886. $this->installCode($package);
  14887. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14888. if (!$repo->hasPackage($package)) {
  14889. $repo->addPackage(clone $package);
  14890. }
  14891. }
  14892. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14893. {
  14894. if (!$repo->hasPackage($initial)) {
  14895. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14896. }
  14897. $this->initializeVendorDir();
  14898. $this->binaryInstaller->removeBinaries($initial);
  14899. $this->updateCode($initial, $target);
  14900. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14901. $repo->removePackage($initial);
  14902. if (!$repo->hasPackage($target)) {
  14903. $repo->addPackage(clone $target);
  14904. }
  14905. }
  14906. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14907. {
  14908. if (!$repo->hasPackage($package)) {
  14909. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14910. }
  14911. $this->removeCode($package);
  14912. $this->binaryInstaller->removeBinaries($package);
  14913. $repo->removePackage($package);
  14914. $downloadPath = $this->getPackageBasePath($package);
  14915. if (strpos($package->getName(), '/')) {
  14916. $packageVendorDir = dirname($downloadPath);
  14917. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14918. Silencer::call('rmdir', $packageVendorDir);
  14919. }
  14920. }
  14921. }
  14922. public function getInstallPath(PackageInterface $package)
  14923. {
  14924. $this->initializeVendorDir();
  14925. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14926. $targetDir = $package->getTargetDir();
  14927. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14928. }
  14929. public function ensureBinariesPresence(PackageInterface $package)
  14930. {
  14931. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14932. }
  14933. protected function getPackageBasePath(PackageInterface $package)
  14934. {
  14935. $installPath = $this->getInstallPath($package);
  14936. $targetDir = $package->getTargetDir();
  14937. if ($targetDir) {
  14938. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14939. }
  14940. return $installPath;
  14941. }
  14942. protected function installCode(PackageInterface $package)
  14943. {
  14944. $downloadPath = $this->getInstallPath($package);
  14945. $this->downloadManager->download($package, $downloadPath);
  14946. }
  14947. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14948. {
  14949. $initialDownloadPath = $this->getInstallPath($initial);
  14950. $targetDownloadPath = $this->getInstallPath($target);
  14951. if ($targetDownloadPath !== $initialDownloadPath) {
  14952. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14953. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14954. ) {
  14955. $this->removeCode($initial);
  14956. $this->installCode($target);
  14957. return;
  14958. }
  14959. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14960. }
  14961. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14962. }
  14963. protected function removeCode(PackageInterface $package)
  14964. {
  14965. $downloadPath = $this->getPackageBasePath($package);
  14966. $this->downloadManager->remove($package, $downloadPath);
  14967. }
  14968. protected function initializeVendorDir()
  14969. {
  14970. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14971. $this->vendorDir = realpath($this->vendorDir);
  14972. }
  14973. }
  14974. <?php
  14975. namespace Composer\Installer;
  14976. use Composer\Repository\InstalledRepositoryInterface;
  14977. use Composer\Package\PackageInterface;
  14978. use Composer\Package\Version\VersionParser;
  14979. use Composer\IO\IOInterface;
  14980. class MetapackageInstaller implements InstallerInterface
  14981. {
  14982. private $io;
  14983. public function __construct(IOInterface $io)
  14984. {
  14985. $this->io = $io;
  14986. }
  14987. public function supports($packageType)
  14988. {
  14989. return $packageType === 'metapackage';
  14990. }
  14991. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14992. {
  14993. return $repo->hasPackage($package);
  14994. }
  14995. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14996. {
  14997. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  14998. $repo->addPackage(clone $package);
  14999. }
  15000. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15001. {
  15002. if (!$repo->hasPackage($initial)) {
  15003. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15004. }
  15005. $name = $target->getName();
  15006. $from = $initial->getFullPrettyVersion();
  15007. $to = $target->getFullPrettyVersion();
  15008. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15009. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15010. $repo->removePackage($initial);
  15011. $repo->addPackage(clone $target);
  15012. }
  15013. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15014. {
  15015. if (!$repo->hasPackage($package)) {
  15016. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15017. }
  15018. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15019. $repo->removePackage($package);
  15020. }
  15021. public function getInstallPath(PackageInterface $package)
  15022. {
  15023. return '';
  15024. }
  15025. }
  15026. <?php
  15027. namespace Composer\Installer;
  15028. use Composer\Repository\InstalledRepositoryInterface;
  15029. use Composer\Package\PackageInterface;
  15030. class NoopInstaller implements InstallerInterface
  15031. {
  15032. public function supports($packageType)
  15033. {
  15034. return true;
  15035. }
  15036. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15037. {
  15038. return $repo->hasPackage($package);
  15039. }
  15040. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15041. {
  15042. if (!$repo->hasPackage($package)) {
  15043. $repo->addPackage(clone $package);
  15044. }
  15045. }
  15046. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15047. {
  15048. if (!$repo->hasPackage($initial)) {
  15049. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15050. }
  15051. $repo->removePackage($initial);
  15052. if (!$repo->hasPackage($target)) {
  15053. $repo->addPackage(clone $target);
  15054. }
  15055. }
  15056. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15057. {
  15058. if (!$repo->hasPackage($package)) {
  15059. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15060. }
  15061. $repo->removePackage($package);
  15062. }
  15063. public function getInstallPath(PackageInterface $package)
  15064. {
  15065. $targetDir = $package->getTargetDir();
  15066. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15067. }
  15068. }
  15069. <?php
  15070. namespace Composer\Installer;
  15071. use Composer\Composer;
  15072. use Composer\IO\IOInterface;
  15073. use Composer\DependencyResolver\Operation\OperationInterface;
  15074. use Composer\DependencyResolver\PolicyInterface;
  15075. use Composer\DependencyResolver\Pool;
  15076. use Composer\DependencyResolver\Request;
  15077. use Composer\Repository\CompositeRepository;
  15078. class PackageEvent extends InstallerEvent
  15079. {
  15080. private $operation;
  15081. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15082. {
  15083. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15084. $this->operation = $operation;
  15085. }
  15086. public function getOperation()
  15087. {
  15088. return $this->operation;
  15089. }
  15090. }
  15091. <?php
  15092. namespace Composer\Installer;
  15093. class PackageEvents
  15094. {
  15095. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15096. const POST_PACKAGE_INSTALL = 'post-package-install';
  15097. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15098. const POST_PACKAGE_UPDATE = 'post-package-update';
  15099. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15100. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15101. }
  15102. <?php
  15103. namespace Composer\Installer;
  15104. use Composer\IO\IOInterface;
  15105. use Composer\Package\PackageInterface;
  15106. use Composer\Util\Filesystem;
  15107. use Composer\Util\ProcessExecutor;
  15108. class PearBinaryInstaller extends BinaryInstaller
  15109. {
  15110. private $installer;
  15111. private $vendorDir;
  15112. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15113. {
  15114. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15115. $this->installer = $installer;
  15116. $this->vendorDir = $vendorDir;
  15117. }
  15118. protected function getBinaries(PackageInterface $package)
  15119. {
  15120. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15121. $binaries = array();
  15122. if (file_exists($binariesPath)) {
  15123. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15124. if (!$value->isDir()) {
  15125. $binaries[] = 'bin/'.$fileName;
  15126. }
  15127. }
  15128. }
  15129. return $binaries;
  15130. }
  15131. protected function initializeBinDir()
  15132. {
  15133. parent::initializeBinDir();
  15134. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  15135. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  15136. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  15137. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  15138. }
  15139. protected function generateWindowsProxyCode($bin, $link)
  15140. {
  15141. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15142. if ('.bat' === substr($bin, -4)) {
  15143. $caller = 'call';
  15144. } else {
  15145. $handle = fopen($bin, 'r');
  15146. $line = fgets($handle);
  15147. fclose($handle);
  15148. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15149. $caller = trim($match[1]);
  15150. } else {
  15151. $caller = 'php';
  15152. }
  15153. if ($caller === 'php') {
  15154. return "@echo off\r\n".
  15155. "pushd .\r\n".
  15156. "cd %~dp0\r\n".
  15157. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  15158. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15159. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15160. "popd\r\n".
  15161. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  15162. }
  15163. }
  15164. return "@echo off\r\n".
  15165. "pushd .\r\n".
  15166. "cd %~dp0\r\n".
  15167. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15168. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15169. "popd\r\n".
  15170. $caller." \"%BIN_TARGET%\" %*\r\n";
  15171. }
  15172. private function generateWindowsPhpProxyCode()
  15173. {
  15174. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15175. return
  15176. "@echo off\r\n" .
  15177. "setlocal enabledelayedexpansion\r\n" .
  15178. "set BIN_DIR=%~dp0\r\n" .
  15179. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15180. "set DIRS=.\r\n" .
  15181. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15182. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15183. " set DIRS=!DIRS!;%%~fP\r\n" .
  15184. " )\r\n" .
  15185. ")\r\n" .
  15186. "php.exe -d include_path=!DIRS! %*\r\n";
  15187. }
  15188. private function generateUnixyPhpProxyCode()
  15189. {
  15190. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15191. return
  15192. "#!/usr/bin/env sh\n".
  15193. "SRC_DIR=`pwd`\n".
  15194. "BIN_DIR=`dirname $0`\n".
  15195. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15196. "DIRS=\"\"\n".
  15197. "for vendor in \$VENDOR_DIR/*; do\n".
  15198. " if [ -d \"\$vendor\" ]; then\n".
  15199. " for package in \$vendor/*; do\n".
  15200. " if [ -d \"\$package\" ]; then\n".
  15201. " DIRS=\"\${DIRS}:\${package}\"\n".
  15202. " fi\n".
  15203. " done\n".
  15204. " fi\n".
  15205. "done\n".
  15206. "php -d include_path=\".\$DIRS\" $@\n";
  15207. }
  15208. }
  15209. <?php
  15210. namespace Composer\Installer;
  15211. use Composer\IO\IOInterface;
  15212. use Composer\Composer;
  15213. use Composer\Downloader\PearPackageExtractor;
  15214. use Composer\Repository\InstalledRepositoryInterface;
  15215. use Composer\Package\PackageInterface;
  15216. use Composer\Util\Platform;
  15217. use Composer\Util\Filesystem;
  15218. class PearInstaller extends LibraryInstaller
  15219. {
  15220. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15221. {
  15222. $filesystem = new Filesystem();
  15223. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15224. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15225. }
  15226. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15227. {
  15228. $this->uninstall($repo, $initial);
  15229. $this->install($repo, $target);
  15230. }
  15231. protected function installCode(PackageInterface $package)
  15232. {
  15233. parent::installCode($package);
  15234. $isWindows = Platform::isWindows();
  15235. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15236. if (!$isWindows) {
  15237. $php_bin = '/usr/bin/env ' . $php_bin;
  15238. }
  15239. $installPath = $this->getInstallPath($package);
  15240. $vars = array(
  15241. 'os' => $isWindows ? 'windows' : 'linux',
  15242. 'php_bin' => $php_bin,
  15243. 'pear_php' => $installPath,
  15244. 'php_dir' => $installPath,
  15245. 'bin_dir' => $installPath . '/bin',
  15246. 'data_dir' => $installPath . '/data',
  15247. 'version' => $package->getPrettyVersion(),
  15248. );
  15249. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15250. $pearExtractor = new PearPackageExtractor($packageArchive);
  15251. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15252. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15253. $this->filesystem->unlink($packageArchive);
  15254. }
  15255. }
  15256. <?php
  15257. namespace Composer\Installer;
  15258. use Composer\Composer;
  15259. use Composer\IO\IOInterface;
  15260. use Composer\Repository\InstalledRepositoryInterface;
  15261. use Composer\Package\PackageInterface;
  15262. class PluginInstaller extends LibraryInstaller
  15263. {
  15264. private $installationManager;
  15265. public function __construct(IOInterface $io, Composer $composer)
  15266. {
  15267. parent::__construct($io, $composer, 'composer-plugin');
  15268. $this->installationManager = $composer->getInstallationManager();
  15269. }
  15270. public function supports($packageType)
  15271. {
  15272. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15273. }
  15274. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15275. {
  15276. $extra = $package->getExtra();
  15277. if (empty($extra['class'])) {
  15278. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15279. }
  15280. parent::install($repo, $package);
  15281. try {
  15282. $this->composer->getPluginManager()->registerPackage($package, true);
  15283. } catch (\Exception $e) {
  15284. $this->io->writeError('Plugin installation failed, rolling back');
  15285. parent::uninstall($repo, $package);
  15286. throw $e;
  15287. }
  15288. }
  15289. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15290. {
  15291. $extra = $target->getExtra();
  15292. if (empty($extra['class'])) {
  15293. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15294. }
  15295. parent::update($repo, $initial, $target);
  15296. $this->composer->getPluginManager()->registerPackage($target, true);
  15297. }
  15298. }
  15299. <?php
  15300. namespace Composer\Installer;
  15301. use Composer\Package\PackageInterface;
  15302. use Composer\Downloader\DownloadManager;
  15303. use Composer\Repository\InstalledRepositoryInterface;
  15304. use Composer\Util\Filesystem;
  15305. class ProjectInstaller implements InstallerInterface
  15306. {
  15307. private $installPath;
  15308. private $downloadManager;
  15309. private $filesystem;
  15310. public function __construct($installPath, DownloadManager $dm)
  15311. {
  15312. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15313. $this->downloadManager = $dm;
  15314. $this->filesystem = new Filesystem;
  15315. }
  15316. public function supports($packageType)
  15317. {
  15318. return true;
  15319. }
  15320. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15321. {
  15322. return false;
  15323. }
  15324. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15325. {
  15326. $installPath = $this->installPath;
  15327. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15328. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15329. }
  15330. if (!is_dir($installPath)) {
  15331. mkdir($installPath, 0777, true);
  15332. }
  15333. $this->downloadManager->download($package, $installPath);
  15334. }
  15335. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15336. {
  15337. throw new \InvalidArgumentException("not supported");
  15338. }
  15339. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15340. {
  15341. throw new \InvalidArgumentException("not supported");
  15342. }
  15343. public function getInstallPath(PackageInterface $package)
  15344. {
  15345. return $this->installPath;
  15346. }
  15347. }
  15348. <?php
  15349. namespace Composer\Installer;
  15350. use Composer\IO\IOInterface;
  15351. use Composer\Package\PackageInterface;
  15352. use Composer\Repository\RepositoryInterface;
  15353. use Symfony\Component\Console\Formatter\OutputFormatter;
  15354. class SuggestedPackagesReporter
  15355. {
  15356. protected $suggestedPackages = array();
  15357. private $io;
  15358. public function __construct(IOInterface $io)
  15359. {
  15360. $this->io = $io;
  15361. }
  15362. public function getPackages()
  15363. {
  15364. return $this->suggestedPackages;
  15365. }
  15366. public function addPackage($source, $target, $reason)
  15367. {
  15368. $this->suggestedPackages[] = array(
  15369. 'source' => $source,
  15370. 'target' => $target,
  15371. 'reason' => $reason,
  15372. );
  15373. return $this;
  15374. }
  15375. public function addSuggestionsFromPackage(PackageInterface $package)
  15376. {
  15377. $source = $package->getPrettyName();
  15378. foreach ($package->getSuggests() as $target => $reason) {
  15379. $this->addPackage(
  15380. $source,
  15381. $target,
  15382. $reason
  15383. );
  15384. }
  15385. return $this;
  15386. }
  15387. public function output(RepositoryInterface $installedRepo = null)
  15388. {
  15389. $suggestedPackages = $this->getPackages();
  15390. $installedPackages = array();
  15391. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15392. foreach ($installedRepo->getPackages() as $package) {
  15393. $installedPackages = array_merge(
  15394. $installedPackages,
  15395. $package->getNames()
  15396. );
  15397. }
  15398. }
  15399. foreach ($suggestedPackages as $suggestion) {
  15400. if (in_array($suggestion['target'], $installedPackages)) {
  15401. continue;
  15402. }
  15403. $this->io->writeError(sprintf(
  15404. '%s suggests installing %s%s',
  15405. $suggestion['source'],
  15406. $this->escapeOutput($suggestion['target']),
  15407. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15408. ));
  15409. }
  15410. return $this;
  15411. }
  15412. private function escapeOutput($string)
  15413. {
  15414. return OutputFormatter::escape(
  15415. $this->removeControlCharacters($string)
  15416. );
  15417. }
  15418. private function removeControlCharacters($string)
  15419. {
  15420. return preg_replace(
  15421. '/[[:cntrl:]]/',
  15422. '',
  15423. str_replace("\n", ' ', $string)
  15424. );
  15425. }
  15426. }
  15427. <?php
  15428. namespace Composer\Json;
  15429. use JsonSchema\Validator;
  15430. use Seld\JsonLint\JsonParser;
  15431. use Seld\JsonLint\ParsingException;
  15432. use Composer\Util\RemoteFilesystem;
  15433. use Composer\IO\IOInterface;
  15434. use Composer\Downloader\TransportException;
  15435. class JsonFile
  15436. {
  15437. const LAX_SCHEMA = 1;
  15438. const STRICT_SCHEMA = 2;
  15439. const JSON_UNESCAPED_SLASHES = 64;
  15440. const JSON_PRETTY_PRINT = 128;
  15441. const JSON_UNESCAPED_UNICODE = 256;
  15442. private $path;
  15443. private $rfs;
  15444. private $io;
  15445. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15446. {
  15447. $this->path = $path;
  15448. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15449. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15450. }
  15451. $this->rfs = $rfs;
  15452. $this->io = $io;
  15453. }
  15454. public function getPath()
  15455. {
  15456. return $this->path;
  15457. }
  15458. public function exists()
  15459. {
  15460. return is_file($this->path);
  15461. }
  15462. public function read()
  15463. {
  15464. try {
  15465. if ($this->rfs) {
  15466. $json = $this->rfs->getContents($this->path, $this->path, false);
  15467. } else {
  15468. if ($this->io && $this->io->isDebug()) {
  15469. $this->io->writeError('Reading ' . $this->path);
  15470. }
  15471. $json = file_get_contents($this->path);
  15472. }
  15473. } catch (TransportException $e) {
  15474. throw new \RuntimeException($e->getMessage(), 0, $e);
  15475. } catch (\Exception $e) {
  15476. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15477. }
  15478. return static::parseJson($json, $this->path);
  15479. }
  15480. public function write(array $hash, $options = 448)
  15481. {
  15482. $dir = dirname($this->path);
  15483. if (!is_dir($dir)) {
  15484. if (file_exists($dir)) {
  15485. throw new \UnexpectedValueException(
  15486. $dir.' exists and is not a directory.'
  15487. );
  15488. }
  15489. if (!@mkdir($dir, 0777, true)) {
  15490. throw new \UnexpectedValueException(
  15491. $dir.' does not exist and could not be created.'
  15492. );
  15493. }
  15494. }
  15495. $retries = 3;
  15496. while ($retries--) {
  15497. try {
  15498. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15499. break;
  15500. } catch (\Exception $e) {
  15501. if ($retries) {
  15502. usleep(500000);
  15503. continue;
  15504. }
  15505. throw $e;
  15506. }
  15507. }
  15508. }
  15509. public function validateSchema($schema = self::STRICT_SCHEMA)
  15510. {
  15511. $content = file_get_contents($this->path);
  15512. $data = json_decode($content);
  15513. if (null === $data && 'null' !== $content) {
  15514. self::validateSyntax($content, $this->path);
  15515. }
  15516. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  15517. if (false === strpos($schemaFile, '://')) {
  15518. $schemaFile = 'file://' . $schemaFile;
  15519. }
  15520. $schemaData = (object) array('$ref' => $schemaFile);
  15521. if ($schema === self::LAX_SCHEMA) {
  15522. $schemaData->additionalProperties = true;
  15523. $schemaData->required = array();
  15524. }
  15525. $validator = new Validator();
  15526. $validator->check($data, $schemaData);
  15527. if (!$validator->isValid()) {
  15528. $errors = array();
  15529. foreach ((array) $validator->getErrors() as $error) {
  15530. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15531. }
  15532. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15533. }
  15534. return true;
  15535. }
  15536. public static function encode($data, $options = 448)
  15537. {
  15538. if (PHP_VERSION_ID >= 50400) {
  15539. $json = json_encode($data, $options);
  15540. if (false === $json) {
  15541. self::throwEncodeError(json_last_error());
  15542. }
  15543. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15544. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15545. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15546. }
  15547. return $json;
  15548. }
  15549. $json = json_encode($data);
  15550. if (false === $json) {
  15551. self::throwEncodeError(json_last_error());
  15552. }
  15553. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15554. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15555. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15556. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15557. return $json;
  15558. }
  15559. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15560. }
  15561. private static function throwEncodeError($code)
  15562. {
  15563. switch ($code) {
  15564. case JSON_ERROR_DEPTH:
  15565. $msg = 'Maximum stack depth exceeded';
  15566. break;
  15567. case JSON_ERROR_STATE_MISMATCH:
  15568. $msg = 'Underflow or the modes mismatch';
  15569. break;
  15570. case JSON_ERROR_CTRL_CHAR:
  15571. $msg = 'Unexpected control character found';
  15572. break;
  15573. case JSON_ERROR_UTF8:
  15574. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15575. break;
  15576. default:
  15577. $msg = 'Unknown error';
  15578. }
  15579. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15580. }
  15581. public static function parseJson($json, $file = null)
  15582. {
  15583. if (null === $json) {
  15584. return;
  15585. }
  15586. $data = json_decode($json, true);
  15587. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15588. self::validateSyntax($json, $file);
  15589. }
  15590. return $data;
  15591. }
  15592. protected static function validateSyntax($json, $file = null)
  15593. {
  15594. $parser = new JsonParser();
  15595. $result = $parser->lint($json);
  15596. if (null === $result) {
  15597. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15598. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15599. }
  15600. return true;
  15601. }
  15602. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15603. }
  15604. }
  15605. <?php
  15606. namespace Composer\Json;
  15607. class JsonFormatter
  15608. {
  15609. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15610. {
  15611. $result = '';
  15612. $pos = 0;
  15613. $strLen = strlen($json);
  15614. $indentStr = ' ';
  15615. $newLine = "\n";
  15616. $outOfQuotes = true;
  15617. $buffer = '';
  15618. $noescape = true;
  15619. for ($i = 0; $i < $strLen; $i++) {
  15620. $char = substr($json, $i, 1);
  15621. if ('"' === $char && $noescape) {
  15622. $outOfQuotes = !$outOfQuotes;
  15623. }
  15624. if (!$outOfQuotes) {
  15625. $buffer .= $char;
  15626. $noescape = '\\' === $char ? !$noescape : true;
  15627. continue;
  15628. } elseif ('' !== $buffer) {
  15629. if ($unescapeSlashes) {
  15630. $buffer = str_replace('\\/', '/', $buffer);
  15631. }
  15632. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15633. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15634. $l = strlen($match[1]);
  15635. if ($l % 2) {
  15636. $code = hexdec($match[2]);
  15637. if (0xD800 <= $code && 0xDFFF >= $code) {
  15638. return $match[0];
  15639. }
  15640. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15641. pack('H*', $match[2]),
  15642. 'UTF-8',
  15643. 'UCS-2BE'
  15644. );
  15645. }
  15646. return $match[0];
  15647. }, $buffer);
  15648. }
  15649. $result .= $buffer.$char;
  15650. $buffer = '';
  15651. continue;
  15652. }
  15653. if (':' === $char) {
  15654. $char .= ' ';
  15655. } elseif ('}' === $char || ']' === $char) {
  15656. $pos--;
  15657. $prevChar = substr($json, $i - 1, 1);
  15658. if ('{' !== $prevChar && '[' !== $prevChar) {
  15659. $result .= $newLine;
  15660. for ($j = 0; $j < $pos; $j++) {
  15661. $result .= $indentStr;
  15662. }
  15663. } else {
  15664. $result = rtrim($result);
  15665. }
  15666. }
  15667. $result .= $char;
  15668. if (',' === $char || '{' === $char || '[' === $char) {
  15669. $result .= $newLine;
  15670. if ('{' === $char || '[' === $char) {
  15671. $pos++;
  15672. }
  15673. for ($j = 0; $j < $pos; $j++) {
  15674. $result .= $indentStr;
  15675. }
  15676. }
  15677. }
  15678. return $result;
  15679. }
  15680. }
  15681. <?php
  15682. namespace Composer\Json;
  15683. use Composer\Repository\PlatformRepository;
  15684. class JsonManipulator
  15685. {
  15686. private static $DEFINES = '(?(DEFINE)
  15687. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15688. (?<boolean> true | false | null )
  15689. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15690. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15691. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15692. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15693. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15694. )';
  15695. private $contents;
  15696. private $newline;
  15697. private $indent;
  15698. public function __construct($contents)
  15699. {
  15700. $contents = trim($contents);
  15701. if ($contents === '') {
  15702. $contents = '{}';
  15703. }
  15704. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15705. throw new \InvalidArgumentException('The json file must be an object ({})');
  15706. }
  15707. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15708. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15709. $this->detectIndenting();
  15710. }
  15711. public function getContents()
  15712. {
  15713. return $this->contents . $this->newline;
  15714. }
  15715. public function addLink($type, $package, $constraint, $sortPackages = false)
  15716. {
  15717. $decoded = JsonFile::parseJson($this->contents);
  15718. if (!isset($decoded[$type])) {
  15719. return $this->addMainKey($type, array($package => $constraint));
  15720. }
  15721. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15722. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15723. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15724. return false;
  15725. }
  15726. $links = $matches['value'];
  15727. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15728. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15729. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15730. $existingPackage = $packageMatches['package'];
  15731. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15732. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15733. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15734. }, $links);
  15735. } else {
  15736. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15737. $links = preg_replace(
  15738. '{'.preg_quote($match[1]).'$}',
  15739. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15740. $links
  15741. );
  15742. } else {
  15743. $links = '{' . $this->newline .
  15744. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15745. $this->indent . '}';
  15746. }
  15747. }
  15748. if (true === $sortPackages) {
  15749. $requirements = json_decode($links, true);
  15750. $this->sortPackages($requirements);
  15751. $links = $this->format($requirements);
  15752. }
  15753. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15754. return true;
  15755. }
  15756. private function sortPackages(array &$packages = array())
  15757. {
  15758. $prefix = function ($requirement) {
  15759. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15760. return preg_replace(
  15761. array(
  15762. '/^php/',
  15763. '/^hhvm/',
  15764. '/^ext/',
  15765. '/^lib/',
  15766. '/^\D/',
  15767. ),
  15768. array(
  15769. '0-$0',
  15770. '1-$0',
  15771. '2-$0',
  15772. '3-$0',
  15773. '4-$0',
  15774. ),
  15775. $requirement
  15776. );
  15777. }
  15778. return '5-'.$requirement;
  15779. };
  15780. uksort($packages, function ($a, $b) use ($prefix) {
  15781. return strnatcmp($prefix($a), $prefix($b));
  15782. });
  15783. }
  15784. public function addRepository($name, $config)
  15785. {
  15786. return $this->addSubNode('repositories', $name, $config);
  15787. }
  15788. public function removeRepository($name)
  15789. {
  15790. return $this->removeSubNode('repositories', $name);
  15791. }
  15792. public function addConfigSetting($name, $value)
  15793. {
  15794. return $this->addSubNode('config', $name, $value);
  15795. }
  15796. public function removeConfigSetting($name)
  15797. {
  15798. return $this->removeSubNode('config', $name);
  15799. }
  15800. public function addProperty($name, $value)
  15801. {
  15802. if (substr($name, 0, 6) === 'extra.') {
  15803. return $this->addSubNode('extra', substr($name, 6), $value);
  15804. }
  15805. if (substr($name, 0, 8) === 'scripts.') {
  15806. return $this->addSubNode('scripts', substr($name, 8), $value);
  15807. }
  15808. return $this->addMainKey($name, $value);
  15809. }
  15810. public function removeProperty($name)
  15811. {
  15812. if (substr($name, 0, 6) === 'extra.') {
  15813. return $this->removeSubNode('extra', substr($name, 6));
  15814. }
  15815. if (substr($name, 0, 8) === 'scripts.') {
  15816. return $this->removeSubNode('scripts', substr($name, 8));
  15817. }
  15818. return $this->removeMainKey($name);
  15819. }
  15820. public function addSubNode($mainNode, $name, $value)
  15821. {
  15822. $decoded = JsonFile::parseJson($this->contents);
  15823. $subName = null;
  15824. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15825. list($name, $subName) = explode('.', $name, 2);
  15826. }
  15827. if (!isset($decoded[$mainNode])) {
  15828. if ($subName !== null) {
  15829. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15830. } else {
  15831. $this->addMainKey($mainNode, array($name => $value));
  15832. }
  15833. return true;
  15834. }
  15835. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15836. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15837. try {
  15838. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15839. return false;
  15840. }
  15841. } catch (\RuntimeException $e) {
  15842. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15843. return false;
  15844. }
  15845. throw $e;
  15846. }
  15847. $children = $match['content'];
  15848. if (!@json_decode($children)) {
  15849. return false;
  15850. }
  15851. $that = $this;
  15852. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15853. if ($this->pregMatch($childRegex, $children, $matches)) {
  15854. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  15855. if ($subName !== null) {
  15856. $curVal = json_decode($matches['content'], true);
  15857. if (!is_array($curVal)) {
  15858. $curVal = array();
  15859. }
  15860. $curVal[$subName] = $value;
  15861. $value = $curVal;
  15862. }
  15863. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15864. }, $children);
  15865. } else {
  15866. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15867. $whitespace = '';
  15868. if (!empty($match['trailingspace'])) {
  15869. $whitespace = $match['trailingspace'];
  15870. }
  15871. if (!empty($match['content'])) {
  15872. if ($subName !== null) {
  15873. $value = array($subName => $value);
  15874. }
  15875. $children = preg_replace(
  15876. '#'.$whitespace.'}$#',
  15877. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15878. $children
  15879. );
  15880. } else {
  15881. if ($subName !== null) {
  15882. $value = array($subName => $value);
  15883. }
  15884. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15885. }
  15886. }
  15887. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15888. return $m['start'] . $children . $m['end'];
  15889. }, $this->contents);
  15890. return true;
  15891. }
  15892. public function removeSubNode($mainNode, $name)
  15893. {
  15894. $decoded = JsonFile::parseJson($this->contents);
  15895. if (empty($decoded[$mainNode])) {
  15896. return true;
  15897. }
  15898. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15899. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15900. try {
  15901. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15902. return false;
  15903. }
  15904. } catch (\RuntimeException $e) {
  15905. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15906. return false;
  15907. }
  15908. throw $e;
  15909. }
  15910. $children = $match['content'];
  15911. if (!@json_decode($children, true)) {
  15912. return false;
  15913. }
  15914. $subName = null;
  15915. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15916. list($name, $subName) = explode('.', $name, 2);
  15917. }
  15918. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15919. return true;
  15920. }
  15921. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15922. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15923. $bestMatch = '';
  15924. foreach ($matches[0] as $match) {
  15925. if (strlen($bestMatch) < strlen($match)) {
  15926. $bestMatch = $match;
  15927. }
  15928. }
  15929. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15930. if (1 !== $count) {
  15931. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15932. if (1 !== $count) {
  15933. return false;
  15934. }
  15935. }
  15936. }
  15937. } else {
  15938. $childrenClean = $children;
  15939. }
  15940. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15941. if (empty($match['content'])) {
  15942. $newline = $this->newline;
  15943. $indent = $this->indent;
  15944. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15945. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15946. }, $this->contents);
  15947. if ($subName !== null) {
  15948. $curVal = json_decode($children, true);
  15949. unset($curVal[$name][$subName]);
  15950. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15951. }
  15952. return true;
  15953. }
  15954. $that = $this;
  15955. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15956. if ($subName !== null) {
  15957. $curVal = json_decode($matches['content'], true);
  15958. unset($curVal[$name][$subName]);
  15959. $childrenClean = $that->format($curVal, 0);
  15960. }
  15961. return $matches['start'] . $childrenClean . $matches['end'];
  15962. }, $this->contents);
  15963. return true;
  15964. }
  15965. public function addMainKey($key, $content)
  15966. {
  15967. $decoded = JsonFile::parseJson($this->contents);
  15968. $content = $this->format($content);
  15969. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15970. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15971. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15972. if (!@json_decode('{'.$matches['key'].'}')) {
  15973. return false;
  15974. }
  15975. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15976. return true;
  15977. }
  15978. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15979. $this->contents = preg_replace(
  15980. '#'.$match[1].'\}$#',
  15981. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15982. $this->contents
  15983. );
  15984. return true;
  15985. }
  15986. $this->contents = preg_replace(
  15987. '#\}$#',
  15988. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15989. $this->contents
  15990. );
  15991. return true;
  15992. }
  15993. public function removeMainKey($key)
  15994. {
  15995. $decoded = JsonFile::parseJson($this->contents);
  15996. if (!array_key_exists($key, $decoded)) {
  15997. return true;
  15998. }
  15999. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16000. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16001. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16002. if (!@json_decode('{'.$matches['removal'].'}')) {
  16003. return false;
  16004. }
  16005. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16006. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16007. }
  16008. $this->contents = $matches['start'] . $matches['end'];
  16009. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16010. $this->contents = "{\n}";
  16011. }
  16012. return true;
  16013. }
  16014. return false;
  16015. }
  16016. public function format($data, $depth = 0)
  16017. {
  16018. if (is_array($data)) {
  16019. reset($data);
  16020. if (is_numeric(key($data))) {
  16021. foreach ($data as $key => $val) {
  16022. $data[$key] = $this->format($val, $depth + 1);
  16023. }
  16024. return '['.implode(', ', $data).']';
  16025. }
  16026. $out = '{' . $this->newline;
  16027. $elems = array();
  16028. foreach ($data as $key => $val) {
  16029. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16030. }
  16031. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16032. }
  16033. return JsonFile::encode($data);
  16034. }
  16035. protected function detectIndenting()
  16036. {
  16037. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16038. $this->indent = $match[1];
  16039. } else {
  16040. $this->indent = ' ';
  16041. }
  16042. }
  16043. protected function pregMatch($re, $str, &$matches = array())
  16044. {
  16045. $count = preg_match($re, $str, $matches);
  16046. if ($count === false) {
  16047. switch (preg_last_error()) {
  16048. case PREG_NO_ERROR:
  16049. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16050. case PREG_INTERNAL_ERROR:
  16051. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16052. case PREG_BACKTRACK_LIMIT_ERROR:
  16053. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16054. case PREG_RECURSION_LIMIT_ERROR:
  16055. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16056. case PREG_BAD_UTF8_ERROR:
  16057. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16058. case PREG_BAD_UTF8_OFFSET_ERROR:
  16059. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16060. case 6:
  16061. if (PHP_VERSION_ID > 70000) {
  16062. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16063. }
  16064. default:
  16065. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16066. }
  16067. }
  16068. return $count;
  16069. }
  16070. }
  16071. <?php
  16072. namespace Composer\Json;
  16073. use Exception;
  16074. class JsonValidationException extends Exception
  16075. {
  16076. protected $errors;
  16077. public function __construct($message, $errors = array(), Exception $previous = null)
  16078. {
  16079. $this->errors = $errors;
  16080. parent::__construct($message, 0, $previous);
  16081. }
  16082. public function getErrors()
  16083. {
  16084. return $this->errors;
  16085. }
  16086. }
  16087. <?php
  16088. namespace Composer\Package;
  16089. use Composer\Semver\Constraint\Constraint;
  16090. use Composer\Package\Version\VersionParser;
  16091. class AliasPackage extends BasePackage implements CompletePackageInterface
  16092. {
  16093. protected $version;
  16094. protected $prettyVersion;
  16095. protected $dev;
  16096. protected $rootPackageAlias = false;
  16097. protected $stability;
  16098. protected $aliasOf;
  16099. protected $requires;
  16100. protected $devRequires;
  16101. protected $conflicts;
  16102. protected $provides;
  16103. protected $replaces;
  16104. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16105. {
  16106. parent::__construct($aliasOf->getName());
  16107. $this->version = $version;
  16108. $this->prettyVersion = $prettyVersion;
  16109. $this->aliasOf = $aliasOf;
  16110. $this->stability = VersionParser::parseStability($version);
  16111. $this->dev = $this->stability === 'dev';
  16112. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16113. $links = $aliasOf->{'get' . ucfirst($type)}();
  16114. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16115. }
  16116. }
  16117. public function getAliasOf()
  16118. {
  16119. return $this->aliasOf;
  16120. }
  16121. public function getVersion()
  16122. {
  16123. return $this->version;
  16124. }
  16125. public function getStability()
  16126. {
  16127. return $this->stability;
  16128. }
  16129. public function getPrettyVersion()
  16130. {
  16131. return $this->prettyVersion;
  16132. }
  16133. public function isDev()
  16134. {
  16135. return $this->dev;
  16136. }
  16137. public function getRequires()
  16138. {
  16139. return $this->requires;
  16140. }
  16141. public function getConflicts()
  16142. {
  16143. return $this->conflicts;
  16144. }
  16145. public function getProvides()
  16146. {
  16147. return $this->provides;
  16148. }
  16149. public function getReplaces()
  16150. {
  16151. return $this->replaces;
  16152. }
  16153. public function getDevRequires()
  16154. {
  16155. return $this->devRequires;
  16156. }
  16157. public function setRootPackageAlias($value)
  16158. {
  16159. return $this->rootPackageAlias = $value;
  16160. }
  16161. public function isRootPackageAlias()
  16162. {
  16163. return $this->rootPackageAlias;
  16164. }
  16165. protected function replaceSelfVersionDependencies(array $links, $linkType)
  16166. {
  16167. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  16168. $newLinks = array();
  16169. foreach ($links as $link) {
  16170. if ('self.version' === $link->getPrettyConstraint()) {
  16171. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16172. }
  16173. }
  16174. $links = array_merge($links, $newLinks);
  16175. } else {
  16176. foreach ($links as $index => $link) {
  16177. if ('self.version' === $link->getPrettyConstraint()) {
  16178. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16179. }
  16180. }
  16181. }
  16182. return $links;
  16183. }
  16184. public function getType()
  16185. {
  16186. return $this->aliasOf->getType();
  16187. }
  16188. public function getTargetDir()
  16189. {
  16190. return $this->aliasOf->getTargetDir();
  16191. }
  16192. public function getExtra()
  16193. {
  16194. return $this->aliasOf->getExtra();
  16195. }
  16196. public function setInstallationSource($type)
  16197. {
  16198. $this->aliasOf->setInstallationSource($type);
  16199. }
  16200. public function getInstallationSource()
  16201. {
  16202. return $this->aliasOf->getInstallationSource();
  16203. }
  16204. public function getSourceType()
  16205. {
  16206. return $this->aliasOf->getSourceType();
  16207. }
  16208. public function getSourceUrl()
  16209. {
  16210. return $this->aliasOf->getSourceUrl();
  16211. }
  16212. public function getSourceUrls()
  16213. {
  16214. return $this->aliasOf->getSourceUrls();
  16215. }
  16216. public function getSourceReference()
  16217. {
  16218. return $this->aliasOf->getSourceReference();
  16219. }
  16220. public function setSourceReference($reference)
  16221. {
  16222. return $this->aliasOf->setSourceReference($reference);
  16223. }
  16224. public function setSourceMirrors($mirrors)
  16225. {
  16226. return $this->aliasOf->setSourceMirrors($mirrors);
  16227. }
  16228. public function getSourceMirrors()
  16229. {
  16230. return $this->aliasOf->getSourceMirrors();
  16231. }
  16232. public function getDistType()
  16233. {
  16234. return $this->aliasOf->getDistType();
  16235. }
  16236. public function getDistUrl()
  16237. {
  16238. return $this->aliasOf->getDistUrl();
  16239. }
  16240. public function getDistUrls()
  16241. {
  16242. return $this->aliasOf->getDistUrls();
  16243. }
  16244. public function getDistReference()
  16245. {
  16246. return $this->aliasOf->getDistReference();
  16247. }
  16248. public function setDistReference($reference)
  16249. {
  16250. return $this->aliasOf->setDistReference($reference);
  16251. }
  16252. public function getDistSha1Checksum()
  16253. {
  16254. return $this->aliasOf->getDistSha1Checksum();
  16255. }
  16256. public function setTransportOptions(array $options)
  16257. {
  16258. return $this->aliasOf->setTransportOptions($options);
  16259. }
  16260. public function getTransportOptions()
  16261. {
  16262. return $this->aliasOf->getTransportOptions();
  16263. }
  16264. public function setDistMirrors($mirrors)
  16265. {
  16266. return $this->aliasOf->setDistMirrors($mirrors);
  16267. }
  16268. public function getDistMirrors()
  16269. {
  16270. return $this->aliasOf->getDistMirrors();
  16271. }
  16272. public function getScripts()
  16273. {
  16274. return $this->aliasOf->getScripts();
  16275. }
  16276. public function getLicense()
  16277. {
  16278. return $this->aliasOf->getLicense();
  16279. }
  16280. public function getAutoload()
  16281. {
  16282. return $this->aliasOf->getAutoload();
  16283. }
  16284. public function getDevAutoload()
  16285. {
  16286. return $this->aliasOf->getDevAutoload();
  16287. }
  16288. public function getIncludePaths()
  16289. {
  16290. return $this->aliasOf->getIncludePaths();
  16291. }
  16292. public function getRepositories()
  16293. {
  16294. return $this->aliasOf->getRepositories();
  16295. }
  16296. public function getReleaseDate()
  16297. {
  16298. return $this->aliasOf->getReleaseDate();
  16299. }
  16300. public function getBinaries()
  16301. {
  16302. return $this->aliasOf->getBinaries();
  16303. }
  16304. public function getKeywords()
  16305. {
  16306. return $this->aliasOf->getKeywords();
  16307. }
  16308. public function getDescription()
  16309. {
  16310. return $this->aliasOf->getDescription();
  16311. }
  16312. public function getHomepage()
  16313. {
  16314. return $this->aliasOf->getHomepage();
  16315. }
  16316. public function getSuggests()
  16317. {
  16318. return $this->aliasOf->getSuggests();
  16319. }
  16320. public function getAuthors()
  16321. {
  16322. return $this->aliasOf->getAuthors();
  16323. }
  16324. public function getSupport()
  16325. {
  16326. return $this->aliasOf->getSupport();
  16327. }
  16328. public function getNotificationUrl()
  16329. {
  16330. return $this->aliasOf->getNotificationUrl();
  16331. }
  16332. public function getArchiveExcludes()
  16333. {
  16334. return $this->aliasOf->getArchiveExcludes();
  16335. }
  16336. public function isAbandoned()
  16337. {
  16338. return $this->aliasOf->isAbandoned();
  16339. }
  16340. public function getReplacementPackage()
  16341. {
  16342. return $this->aliasOf->getReplacementPackage();
  16343. }
  16344. public function __toString()
  16345. {
  16346. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16347. }
  16348. }
  16349. <?php
  16350. namespace Composer\Package\Archiver;
  16351. use FilterIterator;
  16352. use PharData;
  16353. class ArchivableFilesFilter extends FilterIterator
  16354. {
  16355. private $dirs = array();
  16356. public function accept()
  16357. {
  16358. $file = $this->getInnerIterator()->current();
  16359. if ($file->isDir()) {
  16360. $this->dirs[] = (string) $file;
  16361. return false;
  16362. }
  16363. return true;
  16364. }
  16365. public function addEmptyDir(PharData $phar, $sources)
  16366. {
  16367. foreach ($this->dirs as $filepath) {
  16368. $localname = str_replace($sources . "/", '', $filepath);
  16369. $phar->addEmptyDir($localname);
  16370. }
  16371. }
  16372. }
  16373. <?php
  16374. namespace Composer\Package\Archiver;
  16375. use Composer\Util\Filesystem;
  16376. use FilesystemIterator;
  16377. use Symfony\Component\Finder\Finder;
  16378. use Symfony\Component\Finder\SplFileInfo;
  16379. class ArchivableFilesFinder extends \FilterIterator
  16380. {
  16381. protected $finder;
  16382. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16383. {
  16384. $fs = new Filesystem();
  16385. $sources = $fs->normalizePath($sources);
  16386. if ($ignoreFilters) {
  16387. $filters = array();
  16388. } else {
  16389. $filters = array(
  16390. new HgExcludeFilter($sources),
  16391. new GitExcludeFilter($sources),
  16392. new ComposerExcludeFilter($sources, $excludes),
  16393. );
  16394. }
  16395. $this->finder = new Finder();
  16396. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16397. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16398. return false;
  16399. }
  16400. $relativePath = preg_replace(
  16401. '#^'.preg_quote($sources, '#').'#',
  16402. '',
  16403. $fs->normalizePath($file->getRealPath())
  16404. );
  16405. $exclude = false;
  16406. foreach ($filters as $filter) {
  16407. $exclude = $filter->filter($relativePath, $exclude);
  16408. }
  16409. return !$exclude;
  16410. };
  16411. if (method_exists($filter, 'bindTo')) {
  16412. $filter = $filter->bindTo(null);
  16413. }
  16414. $this->finder
  16415. ->in($sources)
  16416. ->filter($filter)
  16417. ->ignoreVCS(true)
  16418. ->ignoreDotFiles(false);
  16419. parent::__construct($this->finder->getIterator());
  16420. }
  16421. public function accept()
  16422. {
  16423. $current = $this->getInnerIterator()->current();
  16424. if (!$current->isDir()) {
  16425. return true;
  16426. }
  16427. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16428. return !$iterator->valid();
  16429. }
  16430. }
  16431. <?php
  16432. namespace Composer\Package\Archiver;
  16433. use Composer\Downloader\DownloadManager;
  16434. use Composer\Package\PackageInterface;
  16435. use Composer\Package\RootPackageInterface;
  16436. use Composer\Util\Filesystem;
  16437. use Composer\Json\JsonFile;
  16438. class ArchiveManager
  16439. {
  16440. protected $downloadManager;
  16441. protected $archivers = array();
  16442. protected $overwriteFiles = true;
  16443. public function __construct(DownloadManager $downloadManager)
  16444. {
  16445. $this->downloadManager = $downloadManager;
  16446. }
  16447. public function addArchiver(ArchiverInterface $archiver)
  16448. {
  16449. $this->archivers[] = $archiver;
  16450. }
  16451. public function setOverwriteFiles($overwriteFiles)
  16452. {
  16453. $this->overwriteFiles = $overwriteFiles;
  16454. return $this;
  16455. }
  16456. public function getPackageFilename(PackageInterface $package)
  16457. {
  16458. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16459. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16460. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16461. } else {
  16462. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16463. }
  16464. if ($package->getSourceReference()) {
  16465. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16466. }
  16467. $name = implode('-', array_filter($nameParts, function ($p) {
  16468. return !empty($p);
  16469. }));
  16470. return str_replace('/', '-', $name);
  16471. }
  16472. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16473. {
  16474. if (empty($format)) {
  16475. throw new \InvalidArgumentException('Format must be specified');
  16476. }
  16477. $usableArchiver = null;
  16478. foreach ($this->archivers as $archiver) {
  16479. if ($archiver->supports($format, $package->getSourceType())) {
  16480. $usableArchiver = $archiver;
  16481. break;
  16482. }
  16483. }
  16484. if (null === $usableArchiver) {
  16485. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16486. }
  16487. $filesystem = new Filesystem();
  16488. if (null === $fileName) {
  16489. $packageName = $this->getPackageFilename($package);
  16490. } else {
  16491. $packageName = $fileName;
  16492. }
  16493. $filesystem->ensureDirectoryExists($targetDir);
  16494. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16495. $filesystem->ensureDirectoryExists(dirname($target));
  16496. if (!$this->overwriteFiles && file_exists($target)) {
  16497. return $target;
  16498. }
  16499. if ($package instanceof RootPackageInterface) {
  16500. $sourcePath = realpath('.');
  16501. } else {
  16502. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16503. $filesystem->ensureDirectoryExists($sourcePath);
  16504. try {
  16505. $this->downloadManager->download($package, $sourcePath);
  16506. } catch (\Exception $e) {
  16507. $filesystem->removeDirectory($sourcePath);
  16508. throw $e;
  16509. }
  16510. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16511. $jsonFile = new JsonFile($composerJsonPath);
  16512. $jsonData = $jsonFile->read();
  16513. if (!empty($jsonData['archive']['exclude'])) {
  16514. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16515. }
  16516. }
  16517. }
  16518. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16519. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16520. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16521. $filesystem->rename($archivePath, $target);
  16522. if (!$package instanceof RootPackageInterface) {
  16523. $filesystem->removeDirectory($sourcePath);
  16524. }
  16525. $filesystem->remove($tempTarget);
  16526. return $target;
  16527. }
  16528. }
  16529. <?php
  16530. namespace Composer\Package\Archiver;
  16531. interface ArchiverInterface
  16532. {
  16533. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16534. public function supports($format, $sourceType);
  16535. }
  16536. <?php
  16537. namespace Composer\Package\Archiver;
  16538. use Symfony\Component\Finder;
  16539. abstract class BaseExcludeFilter
  16540. {
  16541. protected $sourcePath;
  16542. protected $excludePatterns;
  16543. public function __construct($sourcePath)
  16544. {
  16545. $this->sourcePath = $sourcePath;
  16546. $this->excludePatterns = array();
  16547. }
  16548. public function filter($relativePath, $exclude)
  16549. {
  16550. foreach ($this->excludePatterns as $patternData) {
  16551. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16552. if ($stripLeadingSlash) {
  16553. $path = substr($relativePath, 1);
  16554. } else {
  16555. $path = $relativePath;
  16556. }
  16557. if (preg_match($pattern, $path)) {
  16558. $exclude = !$negate;
  16559. }
  16560. }
  16561. return $exclude;
  16562. }
  16563. protected function parseLines(array $lines, $lineParser)
  16564. {
  16565. return array_filter(
  16566. array_map(
  16567. function ($line) use ($lineParser) {
  16568. $line = trim($line);
  16569. if (!$line || 0 === strpos($line, '#')) {
  16570. return null;
  16571. }
  16572. return call_user_func($lineParser, $line);
  16573. },
  16574. $lines
  16575. ),
  16576. function ($pattern) {
  16577. return $pattern !== null;
  16578. }
  16579. );
  16580. }
  16581. protected function generatePatterns($rules)
  16582. {
  16583. $patterns = array();
  16584. foreach ($rules as $rule) {
  16585. $patterns[] = $this->generatePattern($rule);
  16586. }
  16587. return $patterns;
  16588. }
  16589. protected function generatePattern($rule)
  16590. {
  16591. $negate = false;
  16592. $pattern = '{';
  16593. if (strlen($rule) && $rule[0] === '!') {
  16594. $negate = true;
  16595. $rule = substr($rule, 1);
  16596. }
  16597. if (strlen($rule) && $rule[0] === '/') {
  16598. $pattern .= '^/';
  16599. $rule = substr($rule, 1);
  16600. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16601. $pattern .= '/';
  16602. $rule = substr($rule, 0, -1);
  16603. } elseif (false === strpos($rule, '/')) {
  16604. $pattern .= '/';
  16605. }
  16606. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16607. return array($pattern . '}', $negate, false);
  16608. }
  16609. }
  16610. <?php
  16611. namespace Composer\Package\Archiver;
  16612. class ComposerExcludeFilter extends BaseExcludeFilter
  16613. {
  16614. public function __construct($sourcePath, array $excludeRules)
  16615. {
  16616. parent::__construct($sourcePath);
  16617. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16618. }
  16619. }
  16620. <?php
  16621. namespace Composer\Package\Archiver;
  16622. class GitExcludeFilter extends BaseExcludeFilter
  16623. {
  16624. public function __construct($sourcePath)
  16625. {
  16626. parent::__construct($sourcePath);
  16627. if (file_exists($sourcePath.'/.gitignore')) {
  16628. $this->excludePatterns = $this->parseLines(
  16629. file($sourcePath.'/.gitignore'),
  16630. array($this, 'parseGitIgnoreLine')
  16631. );
  16632. }
  16633. if (file_exists($sourcePath.'/.gitattributes')) {
  16634. $this->excludePatterns = array_merge(
  16635. $this->excludePatterns,
  16636. $this->parseLines(
  16637. file($sourcePath.'/.gitattributes'),
  16638. array($this, 'parseGitAttributesLine')
  16639. )
  16640. );
  16641. }
  16642. }
  16643. public function parseGitIgnoreLine($line)
  16644. {
  16645. return $this->generatePattern($line);
  16646. }
  16647. public function parseGitAttributesLine($line)
  16648. {
  16649. $parts = preg_split('#\s+#', $line);
  16650. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16651. return $this->generatePattern($parts[0]);
  16652. }
  16653. return null;
  16654. }
  16655. }
  16656. <?php
  16657. namespace Composer\Package\Archiver;
  16658. use Symfony\Component\Finder;
  16659. class HgExcludeFilter extends BaseExcludeFilter
  16660. {
  16661. const HG_IGNORE_REGEX = 1;
  16662. const HG_IGNORE_GLOB = 2;
  16663. protected $patternMode;
  16664. public function __construct($sourcePath)
  16665. {
  16666. parent::__construct($sourcePath);
  16667. $this->patternMode = self::HG_IGNORE_REGEX;
  16668. if (file_exists($sourcePath.'/.hgignore')) {
  16669. $this->excludePatterns = $this->parseLines(
  16670. file($sourcePath.'/.hgignore'),
  16671. array($this, 'parseHgIgnoreLine')
  16672. );
  16673. }
  16674. }
  16675. public function parseHgIgnoreLine($line)
  16676. {
  16677. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16678. if ($matches[1] === 'glob') {
  16679. $this->patternMode = self::HG_IGNORE_GLOB;
  16680. } else {
  16681. $this->patternMode = self::HG_IGNORE_REGEX;
  16682. }
  16683. return null;
  16684. }
  16685. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16686. return $this->patternFromGlob($line);
  16687. }
  16688. return $this->patternFromRegex($line);
  16689. }
  16690. protected function patternFromGlob($line)
  16691. {
  16692. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16693. $pattern = str_replace('[^/]*', '.*', $pattern);
  16694. return array($pattern, false, true);
  16695. }
  16696. public function patternFromRegex($line)
  16697. {
  16698. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16699. return array($pattern, false, true);
  16700. }
  16701. }
  16702. <?php
  16703. namespace Composer\Package\Archiver;
  16704. class PharArchiver implements ArchiverInterface
  16705. {
  16706. protected static $formats = array(
  16707. 'zip' => \Phar::ZIP,
  16708. 'tar' => \Phar::TAR,
  16709. 'tar.gz' => \Phar::TAR,
  16710. 'tar.bz2' => \Phar::TAR,
  16711. );
  16712. protected static $compressFormats = array(
  16713. 'tar.gz' => \Phar::GZ,
  16714. 'tar.bz2' => \Phar::BZ2,
  16715. );
  16716. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16717. {
  16718. $sources = realpath($sources);
  16719. if (file_exists($target)) {
  16720. unlink($target);
  16721. }
  16722. try {
  16723. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16724. if (isset(static::$compressFormats[$format])) {
  16725. $target = $filename . '.tar';
  16726. }
  16727. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16728. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16729. $filesOnly = new ArchivableFilesFilter($files);
  16730. $phar->buildFromIterator($filesOnly, $sources);
  16731. $filesOnly->addEmptyDir($phar, $sources);
  16732. if (isset(static::$compressFormats[$format])) {
  16733. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16734. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16735. }
  16736. unlink($target);
  16737. $phar->compress(static::$compressFormats[$format]);
  16738. $target = $filename . '.' . $format;
  16739. }
  16740. return $target;
  16741. } catch (\UnexpectedValueException $e) {
  16742. $message = sprintf(
  16743. "Could not create archive '%s' from '%s': %s",
  16744. $target,
  16745. $sources,
  16746. $e->getMessage()
  16747. );
  16748. throw new \RuntimeException($message, $e->getCode(), $e);
  16749. }
  16750. }
  16751. public function supports($format, $sourceType)
  16752. {
  16753. return isset(static::$formats[$format]);
  16754. }
  16755. }
  16756. <?php
  16757. namespace Composer\Package\Archiver;
  16758. use ZipArchive;
  16759. use Composer\Util\Filesystem;
  16760. class ZipArchiver implements ArchiverInterface
  16761. {
  16762. protected static $formats = array(
  16763. 'zip' => 1,
  16764. );
  16765. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16766. {
  16767. $fs = new Filesystem();
  16768. $sources = $fs->normalizePath($sources);
  16769. $zip = new ZipArchive();
  16770. $res = $zip->open($target, ZipArchive::CREATE);
  16771. if ($res === true) {
  16772. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16773. foreach ($files as $file) {
  16774. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16775. $localname = str_replace($sources.'/', '', $filepath);
  16776. if ($file->isDir()) {
  16777. $zip->addEmptyDir($localname);
  16778. } else {
  16779. $zip->addFile($filepath, $localname);
  16780. }
  16781. }
  16782. if ($zip->close()) {
  16783. return $target;
  16784. }
  16785. }
  16786. $message = sprintf(
  16787. "Could not create archive '%s' from '%s': %s",
  16788. $target,
  16789. $sources,
  16790. $zip->getStatusString()
  16791. );
  16792. throw new \RuntimeException($message);
  16793. }
  16794. public function supports($format, $sourceType)
  16795. {
  16796. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16797. }
  16798. private function compressionAvailable()
  16799. {
  16800. return class_exists('ZipArchive');
  16801. }
  16802. }
  16803. <?php
  16804. namespace Composer\Package;
  16805. use Composer\Repository\RepositoryInterface;
  16806. use Composer\Repository\PlatformRepository;
  16807. abstract class BasePackage implements PackageInterface
  16808. {
  16809. public static $supportedLinkTypes = array(
  16810. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16811. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16812. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16813. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16814. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16815. );
  16816. const STABILITY_STABLE = 0;
  16817. const STABILITY_RC = 5;
  16818. const STABILITY_BETA = 10;
  16819. const STABILITY_ALPHA = 15;
  16820. const STABILITY_DEV = 20;
  16821. public static $stabilities = array(
  16822. 'stable' => self::STABILITY_STABLE,
  16823. 'RC' => self::STABILITY_RC,
  16824. 'beta' => self::STABILITY_BETA,
  16825. 'alpha' => self::STABILITY_ALPHA,
  16826. 'dev' => self::STABILITY_DEV,
  16827. );
  16828. public $id;
  16829. protected $name;
  16830. protected $prettyName;
  16831. protected $repository;
  16832. protected $transportOptions = array();
  16833. public function __construct($name)
  16834. {
  16835. $this->prettyName = $name;
  16836. $this->name = strtolower($name);
  16837. $this->id = -1;
  16838. }
  16839. public function getName()
  16840. {
  16841. return $this->name;
  16842. }
  16843. public function getPrettyName()
  16844. {
  16845. return $this->prettyName;
  16846. }
  16847. public function getNames()
  16848. {
  16849. $names = array(
  16850. $this->getName() => true,
  16851. );
  16852. foreach ($this->getProvides() as $link) {
  16853. $names[$link->getTarget()] = true;
  16854. }
  16855. foreach ($this->getReplaces() as $link) {
  16856. $names[$link->getTarget()] = true;
  16857. }
  16858. return array_keys($names);
  16859. }
  16860. public function setId($id)
  16861. {
  16862. $this->id = $id;
  16863. }
  16864. public function getId()
  16865. {
  16866. return $this->id;
  16867. }
  16868. public function setRepository(RepositoryInterface $repository)
  16869. {
  16870. if ($this->repository && $repository !== $this->repository) {
  16871. throw new \LogicException('A package can only be added to one repository');
  16872. }
  16873. $this->repository = $repository;
  16874. }
  16875. public function getRepository()
  16876. {
  16877. return $this->repository;
  16878. }
  16879. public function getTransportOptions()
  16880. {
  16881. return $this->transportOptions;
  16882. }
  16883. public function setTransportOptions(array $options)
  16884. {
  16885. $this->transportOptions = $options;
  16886. }
  16887. public function isPlatform()
  16888. {
  16889. return $this->getRepository() instanceof PlatformRepository;
  16890. }
  16891. public function getUniqueName()
  16892. {
  16893. return $this->getName().'-'.$this->getVersion();
  16894. }
  16895. public function equals(PackageInterface $package)
  16896. {
  16897. $self = $this;
  16898. if ($this instanceof AliasPackage) {
  16899. $self = $this->getAliasOf();
  16900. }
  16901. if ($package instanceof AliasPackage) {
  16902. $package = $package->getAliasOf();
  16903. }
  16904. return $package === $self;
  16905. }
  16906. public function __toString()
  16907. {
  16908. return $this->getUniqueName();
  16909. }
  16910. public function getPrettyString()
  16911. {
  16912. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16913. }
  16914. public function getFullPrettyVersion($truncate = true)
  16915. {
  16916. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16917. return $this->getPrettyVersion();
  16918. }
  16919. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16920. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16921. }
  16922. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16923. }
  16924. public function getStabilityPriority()
  16925. {
  16926. return self::$stabilities[$this->getStability()];
  16927. }
  16928. public function __clone()
  16929. {
  16930. $this->repository = null;
  16931. $this->id = -1;
  16932. }
  16933. public static function packageNameToRegexp($whiteListedPattern, $wrap = '{^%s$}i')
  16934. {
  16935. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  16936. return sprintf($wrap, $cleanedWhiteListedPattern);
  16937. }
  16938. }
  16939. <?php
  16940. namespace Composer\Package\Comparer;
  16941. class Comparer
  16942. {
  16943. private $source;
  16944. private $update;
  16945. private $changed;
  16946. public function setSource($source)
  16947. {
  16948. $this->source = $source;
  16949. }
  16950. public function setUpdate($update)
  16951. {
  16952. $this->update = $update;
  16953. }
  16954. public function getChanged($toString = false, $explicated = false)
  16955. {
  16956. $changed = $this->changed;
  16957. if (!count($changed)) {
  16958. return false;
  16959. }
  16960. if ($explicated) {
  16961. foreach ($changed as $sectionKey => $itemSection) {
  16962. foreach ($itemSection as $itemKey => $item) {
  16963. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  16964. }
  16965. }
  16966. }
  16967. if ($toString) {
  16968. foreach ($changed as $sectionKey => $itemSection) {
  16969. foreach ($itemSection as $itemKey => $item) {
  16970. $changed['string'][] = $item."\r\n";
  16971. }
  16972. }
  16973. $changed = implode("\r\n", $changed['string']);
  16974. }
  16975. return $changed;
  16976. }
  16977. public function doCompare()
  16978. {
  16979. $source = array();
  16980. $destination = array();
  16981. $this->changed = array();
  16982. $currentDirectory = getcwd();
  16983. chdir($this->source);
  16984. $source = $this->doTree('.', $source);
  16985. if (!is_array($source)) {
  16986. return;
  16987. }
  16988. chdir($currentDirectory);
  16989. chdir($this->update);
  16990. $destination = $this->doTree('.', $destination);
  16991. if (!is_array($destination)) {
  16992. exit;
  16993. }
  16994. chdir($currentDirectory);
  16995. foreach ($source as $dir => $value) {
  16996. foreach ($value as $file => $hash) {
  16997. if (isset($destination[$dir][$file])) {
  16998. if ($hash !== $destination[$dir][$file]) {
  16999. $this->changed['changed'][] = $dir.'/'.$file;
  17000. }
  17001. } else {
  17002. $this->changed['removed'][] = $dir.'/'.$file;
  17003. }
  17004. }
  17005. }
  17006. foreach ($destination as $dir => $value) {
  17007. foreach ($value as $file => $hash) {
  17008. if (!isset($source[$dir][$file])) {
  17009. $this->changed['added'][] = $dir.'/'.$file;
  17010. }
  17011. }
  17012. }
  17013. }
  17014. private function doTree($dir, &$array)
  17015. {
  17016. if ($dh = opendir($dir)) {
  17017. while ($file = readdir($dh)) {
  17018. if ($file !== '.' && $file !== '..') {
  17019. if (is_dir($dir.'/'.$file)) {
  17020. if (!count($array)) {
  17021. $array[0] = 'Temp';
  17022. }
  17023. if (!$this->doTree($dir.'/'.$file, $array)) {
  17024. return false;
  17025. }
  17026. } else {
  17027. if (filesize($dir.'/'.$file)) {
  17028. set_time_limit(30);
  17029. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17030. }
  17031. }
  17032. }
  17033. }
  17034. if (count($array) > 1 && isset($array['0'])) {
  17035. unset($array['0']);
  17036. }
  17037. return $array;
  17038. }
  17039. return false;
  17040. }
  17041. }
  17042. <?php
  17043. namespace Composer\Package;
  17044. class CompletePackage extends Package implements CompletePackageInterface
  17045. {
  17046. protected $repositories;
  17047. protected $license = array();
  17048. protected $keywords;
  17049. protected $authors;
  17050. protected $description;
  17051. protected $homepage;
  17052. protected $scripts = array();
  17053. protected $support = array();
  17054. protected $abandoned = false;
  17055. public function setScripts(array $scripts)
  17056. {
  17057. $this->scripts = $scripts;
  17058. }
  17059. public function getScripts()
  17060. {
  17061. return $this->scripts;
  17062. }
  17063. public function setRepositories($repositories)
  17064. {
  17065. $this->repositories = $repositories;
  17066. }
  17067. public function getRepositories()
  17068. {
  17069. return $this->repositories;
  17070. }
  17071. public function setLicense(array $license)
  17072. {
  17073. $this->license = $license;
  17074. }
  17075. public function getLicense()
  17076. {
  17077. return $this->license;
  17078. }
  17079. public function setKeywords(array $keywords)
  17080. {
  17081. $this->keywords = $keywords;
  17082. }
  17083. public function getKeywords()
  17084. {
  17085. return $this->keywords;
  17086. }
  17087. public function setAuthors(array $authors)
  17088. {
  17089. $this->authors = $authors;
  17090. }
  17091. public function getAuthors()
  17092. {
  17093. return $this->authors;
  17094. }
  17095. public function setDescription($description)
  17096. {
  17097. $this->description = $description;
  17098. }
  17099. public function getDescription()
  17100. {
  17101. return $this->description;
  17102. }
  17103. public function setHomepage($homepage)
  17104. {
  17105. $this->homepage = $homepage;
  17106. }
  17107. public function getHomepage()
  17108. {
  17109. return $this->homepage;
  17110. }
  17111. public function setSupport(array $support)
  17112. {
  17113. $this->support = $support;
  17114. }
  17115. public function getSupport()
  17116. {
  17117. return $this->support;
  17118. }
  17119. public function isAbandoned()
  17120. {
  17121. return (bool) $this->abandoned;
  17122. }
  17123. public function setAbandoned($abandoned)
  17124. {
  17125. $this->abandoned = $abandoned;
  17126. }
  17127. public function getReplacementPackage()
  17128. {
  17129. return is_string($this->abandoned) ? $this->abandoned : null;
  17130. }
  17131. }
  17132. <?php
  17133. namespace Composer\Package;
  17134. interface CompletePackageInterface extends PackageInterface
  17135. {
  17136. public function getScripts();
  17137. public function getRepositories();
  17138. public function getLicense();
  17139. public function getKeywords();
  17140. public function getDescription();
  17141. public function getHomepage();
  17142. public function getAuthors();
  17143. public function getSupport();
  17144. public function isAbandoned();
  17145. public function getReplacementPackage();
  17146. }
  17147. <?php
  17148. namespace Composer\Package\Dumper;
  17149. use Composer\Package\BasePackage;
  17150. use Composer\Package\PackageInterface;
  17151. use Composer\Package\CompletePackageInterface;
  17152. use Composer\Package\RootPackageInterface;
  17153. class ArrayDumper
  17154. {
  17155. public function dump(PackageInterface $package)
  17156. {
  17157. $keys = array(
  17158. 'binaries' => 'bin',
  17159. 'type',
  17160. 'extra',
  17161. 'installationSource' => 'installation-source',
  17162. 'autoload',
  17163. 'devAutoload' => 'autoload-dev',
  17164. 'notificationUrl' => 'notification-url',
  17165. 'includePaths' => 'include-path',
  17166. );
  17167. $data = array();
  17168. $data['name'] = $package->getPrettyName();
  17169. $data['version'] = $package->getPrettyVersion();
  17170. $data['version_normalized'] = $package->getVersion();
  17171. if ($package->getTargetDir()) {
  17172. $data['target-dir'] = $package->getTargetDir();
  17173. }
  17174. if ($package->getSourceType()) {
  17175. $data['source']['type'] = $package->getSourceType();
  17176. $data['source']['url'] = $package->getSourceUrl();
  17177. if (null !== ($value = $package->getSourceReference())) {
  17178. $data['source']['reference'] = $value;
  17179. }
  17180. if ($mirrors = $package->getSourceMirrors()) {
  17181. $data['source']['mirrors'] = $mirrors;
  17182. }
  17183. }
  17184. if ($package->getDistType()) {
  17185. $data['dist']['type'] = $package->getDistType();
  17186. $data['dist']['url'] = $package->getDistUrl();
  17187. if (null !== ($value = $package->getDistReference())) {
  17188. $data['dist']['reference'] = $value;
  17189. }
  17190. if (null !== ($value = $package->getDistSha1Checksum())) {
  17191. $data['dist']['shasum'] = $value;
  17192. }
  17193. if ($mirrors = $package->getDistMirrors()) {
  17194. $data['dist']['mirrors'] = $mirrors;
  17195. }
  17196. }
  17197. if ($package->getArchiveExcludes()) {
  17198. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17199. }
  17200. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17201. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17202. foreach ($links as $link) {
  17203. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17204. }
  17205. ksort($data[$type]);
  17206. }
  17207. }
  17208. if ($packages = $package->getSuggests()) {
  17209. ksort($packages);
  17210. $data['suggest'] = $packages;
  17211. }
  17212. if ($package->getReleaseDate()) {
  17213. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17214. }
  17215. $data = $this->dumpValues($package, $keys, $data);
  17216. if ($package instanceof CompletePackageInterface) {
  17217. $keys = array(
  17218. 'scripts',
  17219. 'license',
  17220. 'authors',
  17221. 'description',
  17222. 'homepage',
  17223. 'keywords',
  17224. 'repositories',
  17225. 'support',
  17226. );
  17227. $data = $this->dumpValues($package, $keys, $data);
  17228. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17229. sort($data['keywords']);
  17230. }
  17231. if ($package->isAbandoned()) {
  17232. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17233. }
  17234. }
  17235. if ($package instanceof RootPackageInterface) {
  17236. $minimumStability = $package->getMinimumStability();
  17237. if ($minimumStability) {
  17238. $data['minimum-stability'] = $minimumStability;
  17239. }
  17240. }
  17241. if (count($package->getTransportOptions()) > 0) {
  17242. $data['transport-options'] = $package->getTransportOptions();
  17243. }
  17244. return $data;
  17245. }
  17246. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17247. {
  17248. foreach ($keys as $method => $key) {
  17249. if (is_numeric($method)) {
  17250. $method = $key;
  17251. }
  17252. $getter = 'get'.ucfirst($method);
  17253. $value = $package->$getter();
  17254. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17255. $data[$key] = $value;
  17256. }
  17257. }
  17258. return $data;
  17259. }
  17260. }
  17261. <?php
  17262. namespace Composer\Package;
  17263. use Composer\Semver\Constraint\ConstraintInterface;
  17264. class Link
  17265. {
  17266. protected $source;
  17267. protected $target;
  17268. protected $constraint;
  17269. protected $description;
  17270. protected $prettyConstraint;
  17271. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17272. {
  17273. $this->source = strtolower($source);
  17274. $this->target = strtolower($target);
  17275. $this->constraint = $constraint;
  17276. $this->description = $description;
  17277. $this->prettyConstraint = $prettyConstraint;
  17278. }
  17279. public function getDescription()
  17280. {
  17281. return $this->description;
  17282. }
  17283. public function getSource()
  17284. {
  17285. return $this->source;
  17286. }
  17287. public function getTarget()
  17288. {
  17289. return $this->target;
  17290. }
  17291. public function getConstraint()
  17292. {
  17293. return $this->constraint;
  17294. }
  17295. public function getPrettyConstraint()
  17296. {
  17297. if (null === $this->prettyConstraint) {
  17298. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17299. }
  17300. return $this->prettyConstraint;
  17301. }
  17302. public function __toString()
  17303. {
  17304. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17305. }
  17306. public function getPrettyString(PackageInterface $sourcePackage)
  17307. {
  17308. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17309. }
  17310. }
  17311. <?php
  17312. namespace Composer\Package\LinkConstraint;
  17313. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17314. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17315. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17316. {
  17317. }
  17318. <?php
  17319. namespace Composer\Package\LinkConstraint;
  17320. use Composer\Semver\Constraint\ConstraintInterface;
  17321. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17322. interface LinkConstraintInterface extends ConstraintInterface
  17323. {
  17324. }
  17325. <?php
  17326. namespace Composer\Package\LinkConstraint;
  17327. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17328. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17329. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17330. {
  17331. }
  17332. <?php
  17333. namespace Composer\Package\LinkConstraint;
  17334. use Composer\Semver\Constraint\AbstractConstraint;
  17335. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17336. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17337. {
  17338. }
  17339. <?php
  17340. namespace Composer\Package\LinkConstraint;
  17341. use Composer\Semver\Constraint\Constraint;
  17342. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17343. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17344. {
  17345. }
  17346. <?php
  17347. namespace Composer\Package\Loader;
  17348. use Composer\Package;
  17349. use Composer\Package\AliasPackage;
  17350. use Composer\Package\Link;
  17351. use Composer\Package\RootAliasPackage;
  17352. use Composer\Package\RootPackageInterface;
  17353. use Composer\Package\Version\VersionParser;
  17354. use Composer\Semver\VersionParser as SemverVersionParser;
  17355. class ArrayLoader implements LoaderInterface
  17356. {
  17357. protected $versionParser;
  17358. protected $loadOptions;
  17359. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17360. {
  17361. if (!$parser) {
  17362. $parser = new VersionParser;
  17363. }
  17364. $this->versionParser = $parser;
  17365. $this->loadOptions = $loadOptions;
  17366. }
  17367. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17368. {
  17369. if (!isset($config['name'])) {
  17370. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17371. }
  17372. if (!isset($config['version'])) {
  17373. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17374. }
  17375. if (isset($config['version_normalized'])) {
  17376. $version = $config['version_normalized'];
  17377. } else {
  17378. $version = $this->versionParser->normalize($config['version']);
  17379. }
  17380. $package = new $class($config['name'], $version, $config['version']);
  17381. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17382. if (isset($config['target-dir'])) {
  17383. $package->setTargetDir($config['target-dir']);
  17384. }
  17385. if (isset($config['extra']) && is_array($config['extra'])) {
  17386. $package->setExtra($config['extra']);
  17387. }
  17388. if (isset($config['bin'])) {
  17389. foreach ((array) $config['bin'] as $key => $bin) {
  17390. $config['bin'][$key] = ltrim($bin, '/');
  17391. }
  17392. $package->setBinaries((array) $config['bin']);
  17393. }
  17394. if (isset($config['installation-source'])) {
  17395. $package->setInstallationSource($config['installation-source']);
  17396. }
  17397. if (isset($config['source'])) {
  17398. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17399. throw new \UnexpectedValueException(sprintf(
  17400. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17401. $config['name'],
  17402. json_encode($config['source'])
  17403. ));
  17404. }
  17405. $package->setSourceType($config['source']['type']);
  17406. $package->setSourceUrl($config['source']['url']);
  17407. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  17408. if (isset($config['source']['mirrors'])) {
  17409. $package->setSourceMirrors($config['source']['mirrors']);
  17410. }
  17411. }
  17412. if (isset($config['dist'])) {
  17413. if (!isset($config['dist']['type'])
  17414. || !isset($config['dist']['url'])) {
  17415. throw new \UnexpectedValueException(sprintf(
  17416. "Package %s's dist key should be specified as ".
  17417. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17418. $config['name'],
  17419. json_encode($config['dist'])
  17420. ));
  17421. }
  17422. $package->setDistType($config['dist']['type']);
  17423. $package->setDistUrl($config['dist']['url']);
  17424. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17425. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17426. if (isset($config['dist']['mirrors'])) {
  17427. $package->setDistMirrors($config['dist']['mirrors']);
  17428. }
  17429. }
  17430. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17431. if (isset($config[$type])) {
  17432. $method = 'set'.ucfirst($opts['method']);
  17433. $package->{$method}(
  17434. $this->parseLinks(
  17435. $package->getName(),
  17436. $package->getPrettyVersion(),
  17437. $opts['description'],
  17438. $config[$type]
  17439. )
  17440. );
  17441. }
  17442. }
  17443. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17444. foreach ($config['suggest'] as $target => $reason) {
  17445. if ('self.version' === trim($reason)) {
  17446. $config['suggest'][$target] = $package->getPrettyVersion();
  17447. }
  17448. }
  17449. $package->setSuggests($config['suggest']);
  17450. }
  17451. if (isset($config['autoload'])) {
  17452. $package->setAutoload($config['autoload']);
  17453. }
  17454. if (isset($config['autoload-dev'])) {
  17455. $package->setDevAutoload($config['autoload-dev']);
  17456. }
  17457. if (isset($config['include-path'])) {
  17458. $package->setIncludePaths($config['include-path']);
  17459. }
  17460. if (!empty($config['time'])) {
  17461. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17462. try {
  17463. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17464. $package->setReleaseDate($date);
  17465. } catch (\Exception $e) {
  17466. }
  17467. }
  17468. if (!empty($config['notification-url'])) {
  17469. $package->setNotificationUrl($config['notification-url']);
  17470. }
  17471. if (!empty($config['archive']['exclude'])) {
  17472. $package->setArchiveExcludes($config['archive']['exclude']);
  17473. }
  17474. if ($package instanceof Package\CompletePackageInterface) {
  17475. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17476. foreach ($config['scripts'] as $event => $listeners) {
  17477. $config['scripts'][$event] = (array) $listeners;
  17478. }
  17479. if (isset($config['scripts']['composer'])) {
  17480. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17481. }
  17482. $package->setScripts($config['scripts']);
  17483. }
  17484. if (!empty($config['description']) && is_string($config['description'])) {
  17485. $package->setDescription($config['description']);
  17486. }
  17487. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17488. $package->setHomepage($config['homepage']);
  17489. }
  17490. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17491. $package->setKeywords($config['keywords']);
  17492. }
  17493. if (!empty($config['license'])) {
  17494. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17495. }
  17496. if (!empty($config['authors']) && is_array($config['authors'])) {
  17497. $package->setAuthors($config['authors']);
  17498. }
  17499. if (isset($config['support'])) {
  17500. $package->setSupport($config['support']);
  17501. }
  17502. if (isset($config['abandoned'])) {
  17503. $package->setAbandoned($config['abandoned']);
  17504. }
  17505. }
  17506. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17507. if ($package instanceof RootPackageInterface) {
  17508. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17509. } else {
  17510. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17511. }
  17512. }
  17513. if ($this->loadOptions && isset($config['transport-options'])) {
  17514. $package->setTransportOptions($config['transport-options']);
  17515. }
  17516. return $package;
  17517. }
  17518. public function parseLinks($source, $sourceVersion, $description, $links)
  17519. {
  17520. $res = array();
  17521. foreach ($links as $target => $constraint) {
  17522. if (!is_string($constraint)) {
  17523. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17524. }
  17525. if ('self.version' === $constraint) {
  17526. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17527. } else {
  17528. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17529. }
  17530. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17531. }
  17532. return $res;
  17533. }
  17534. public function getBranchAlias(array $config)
  17535. {
  17536. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17537. || !isset($config['extra']['branch-alias'])
  17538. || !is_array($config['extra']['branch-alias'])
  17539. ) {
  17540. return;
  17541. }
  17542. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17543. if ('-dev' !== substr($targetBranch, -4)) {
  17544. continue;
  17545. }
  17546. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17547. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17548. continue;
  17549. }
  17550. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17551. continue;
  17552. }
  17553. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17554. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17555. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17556. ) {
  17557. continue;
  17558. }
  17559. return $validatedTargetBranch;
  17560. }
  17561. }
  17562. }
  17563. <?php
  17564. namespace Composer\Package\Loader;
  17565. class InvalidPackageException extends \Exception
  17566. {
  17567. private $errors;
  17568. private $warnings;
  17569. private $data;
  17570. public function __construct(array $errors, array $warnings, array $data)
  17571. {
  17572. $this->errors = $errors;
  17573. $this->warnings = $warnings;
  17574. $this->data = $data;
  17575. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17576. }
  17577. public function getData()
  17578. {
  17579. return $this->data;
  17580. }
  17581. public function getErrors()
  17582. {
  17583. return $this->errors;
  17584. }
  17585. public function getWarnings()
  17586. {
  17587. return $this->warnings;
  17588. }
  17589. }
  17590. <?php
  17591. namespace Composer\Package\Loader;
  17592. use Composer\Json\JsonFile;
  17593. class JsonLoader
  17594. {
  17595. private $loader;
  17596. public function __construct(LoaderInterface $loader)
  17597. {
  17598. $this->loader = $loader;
  17599. }
  17600. public function load($json)
  17601. {
  17602. if ($json instanceof JsonFile) {
  17603. $config = $json->read();
  17604. } elseif (file_exists($json)) {
  17605. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17606. } elseif (is_string($json)) {
  17607. $config = JsonFile::parseJson($json);
  17608. }
  17609. return $this->loader->load($config);
  17610. }
  17611. }
  17612. <?php
  17613. namespace Composer\Package\Loader;
  17614. interface LoaderInterface
  17615. {
  17616. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17617. }
  17618. <?php
  17619. namespace Composer\Package\Loader;
  17620. use Composer\Package\BasePackage;
  17621. use Composer\Package\AliasPackage;
  17622. use Composer\Config;
  17623. use Composer\IO\IOInterface;
  17624. use Composer\Package\RootPackageInterface;
  17625. use Composer\Repository\RepositoryFactory;
  17626. use Composer\Package\Version\VersionGuesser;
  17627. use Composer\Package\Version\VersionParser;
  17628. use Composer\Repository\RepositoryManager;
  17629. use Composer\Util\ProcessExecutor;
  17630. class RootPackageLoader extends ArrayLoader
  17631. {
  17632. private $manager;
  17633. private $config;
  17634. private $versionGuesser;
  17635. private $io;
  17636. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  17637. {
  17638. parent::__construct($parser);
  17639. $this->manager = $manager;
  17640. $this->config = $config;
  17641. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17642. $this->io = $io;
  17643. }
  17644. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17645. {
  17646. if (!isset($config['name'])) {
  17647. $config['name'] = '__root__';
  17648. } elseif ($this->io) {
  17649. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  17650. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17651. }
  17652. }
  17653. $autoVersioned = false;
  17654. if (!isset($config['version'])) {
  17655. $commit = null;
  17656. if (getenv('COMPOSER_ROOT_VERSION')) {
  17657. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17658. } else {
  17659. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17660. if ($versionData) {
  17661. $config['version'] = $versionData['pretty_version'];
  17662. $config['version_normalized'] = $versionData['version'];
  17663. $commit = $versionData['commit'];
  17664. }
  17665. }
  17666. if (!isset($config['version'])) {
  17667. $config['version'] = '1.0.0';
  17668. $autoVersioned = true;
  17669. }
  17670. if ($commit) {
  17671. $config['source'] = array(
  17672. 'type' => '',
  17673. 'url' => '',
  17674. 'reference' => $commit,
  17675. );
  17676. $config['dist'] = array(
  17677. 'type' => '',
  17678. 'url' => '',
  17679. 'reference' => $commit,
  17680. );
  17681. }
  17682. }
  17683. $realPackage = $package = parent::load($config, $class);
  17684. if ($realPackage instanceof AliasPackage) {
  17685. $realPackage = $package->getAliasOf();
  17686. }
  17687. if ($autoVersioned) {
  17688. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17689. }
  17690. if (isset($config['minimum-stability'])) {
  17691. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17692. }
  17693. $aliases = array();
  17694. $stabilityFlags = array();
  17695. $references = array();
  17696. foreach (array('require', 'require-dev') as $linkType) {
  17697. if (isset($config[$linkType])) {
  17698. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17699. $method = 'get'.ucfirst($linkInfo['method']);
  17700. $links = array();
  17701. foreach ($realPackage->$method() as $link) {
  17702. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17703. }
  17704. $aliases = $this->extractAliases($links, $aliases);
  17705. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17706. $references = $this->extractReferences($links, $references);
  17707. }
  17708. }
  17709. if ($this->io) {
  17710. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17711. if (isset($config[$linkType])) {
  17712. foreach ($config[$linkType] as $linkName => $constraint) {
  17713. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  17714. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17715. }
  17716. }
  17717. }
  17718. }
  17719. }
  17720. if (isset($links[$config['name']])) {
  17721. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17722. 'Did you accidentally name your root package after an external package?', $config['name']));
  17723. }
  17724. $realPackage->setAliases($aliases);
  17725. $realPackage->setStabilityFlags($stabilityFlags);
  17726. $realPackage->setReferences($references);
  17727. if (isset($config['prefer-stable'])) {
  17728. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17729. }
  17730. if (isset($config['config'])) {
  17731. $realPackage->setConfig($config['config']);
  17732. }
  17733. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17734. foreach ($repos as $repo) {
  17735. $this->manager->addRepository($repo);
  17736. }
  17737. $realPackage->setRepositories($this->config->getRepositories());
  17738. return $package;
  17739. }
  17740. private function extractAliases(array $requires, array $aliases)
  17741. {
  17742. foreach ($requires as $reqName => $reqVersion) {
  17743. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17744. $aliases[] = array(
  17745. 'package' => strtolower($reqName),
  17746. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17747. 'alias' => $match[2],
  17748. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17749. );
  17750. }
  17751. }
  17752. return $aliases;
  17753. }
  17754. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17755. {
  17756. $stabilities = BasePackage::$stabilities;
  17757. $minimumStability = $stabilities[$minimumStability];
  17758. foreach ($requires as $reqName => $reqVersion) {
  17759. $constraints = array();
  17760. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17761. foreach ($orSplit as $orConstraint) {
  17762. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17763. foreach ($andSplit as $andConstraint) {
  17764. $constraints[] = $andConstraint;
  17765. }
  17766. }
  17767. $match = false;
  17768. foreach ($constraints as $constraint) {
  17769. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17770. $name = strtolower($reqName);
  17771. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17772. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17773. continue;
  17774. }
  17775. $stabilityFlags[$name] = $stability;
  17776. $match = true;
  17777. }
  17778. }
  17779. if ($match) {
  17780. continue;
  17781. }
  17782. foreach ($constraints as $constraint) {
  17783. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17784. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17785. $name = strtolower($reqName);
  17786. $stability = $stabilities[$stabilityName];
  17787. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17788. continue;
  17789. }
  17790. $stabilityFlags[$name] = $stability;
  17791. }
  17792. }
  17793. }
  17794. return $stabilityFlags;
  17795. }
  17796. private function extractReferences(array $requires, array $references)
  17797. {
  17798. foreach ($requires as $reqName => $reqVersion) {
  17799. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17800. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  17801. $name = strtolower($reqName);
  17802. $references[$name] = $match[1];
  17803. }
  17804. }
  17805. return $references;
  17806. }
  17807. }
  17808. <?php
  17809. namespace Composer\Package\Loader;
  17810. use Composer\Package\BasePackage;
  17811. use Composer\Semver\Constraint\Constraint;
  17812. use Composer\Package\Version\VersionParser;
  17813. use Composer\Repository\PlatformRepository;
  17814. use Composer\Spdx\SpdxLicenses;
  17815. class ValidatingArrayLoader implements LoaderInterface
  17816. {
  17817. const CHECK_ALL = 3;
  17818. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17819. const CHECK_STRICT_CONSTRAINTS = 2;
  17820. private $loader;
  17821. private $versionParser;
  17822. private $errors;
  17823. private $warnings;
  17824. private $config;
  17825. private $strictName;
  17826. private $flags;
  17827. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17828. {
  17829. $this->loader = $loader;
  17830. $this->versionParser = $parser ?: new VersionParser();
  17831. $this->strictName = $strictName;
  17832. $this->flags = $flags;
  17833. }
  17834. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17835. {
  17836. $this->errors = array();
  17837. $this->warnings = array();
  17838. $this->config = $config;
  17839. if ($this->strictName) {
  17840. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17841. } else {
  17842. $this->validateString('name', true);
  17843. }
  17844. if (!empty($this->config['version'])) {
  17845. try {
  17846. $this->versionParser->normalize($this->config['version']);
  17847. } catch (\Exception $e) {
  17848. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17849. unset($this->config['version']);
  17850. }
  17851. }
  17852. if (!empty($this->config['config']['platform'])) {
  17853. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17854. try {
  17855. $this->versionParser->normalize($platform);
  17856. } catch (\Exception $e) {
  17857. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17858. }
  17859. }
  17860. }
  17861. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17862. $this->validateString('target-dir');
  17863. $this->validateArray('extra');
  17864. if (isset($this->config['bin'])) {
  17865. if (is_string($this->config['bin'])) {
  17866. $this->validateString('bin');
  17867. } else {
  17868. $this->validateFlatArray('bin');
  17869. }
  17870. }
  17871. $this->validateArray('scripts');
  17872. $this->validateString('description');
  17873. $this->validateUrl('homepage');
  17874. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17875. $releaseDate = null;
  17876. $this->validateString('time');
  17877. if (!empty($this->config['time'])) {
  17878. try {
  17879. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17880. } catch (\Exception $e) {
  17881. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17882. unset($this->config['time']);
  17883. }
  17884. }
  17885. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17886. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17887. $licenses = (array) $this->config['license'];
  17888. foreach ($licenses as $key => $license) {
  17889. if ('proprietary' === $license) {
  17890. unset($licenses[$key]);
  17891. }
  17892. }
  17893. $licenseValidator = new SpdxLicenses();
  17894. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17895. $this->warnings[] = sprintf(
  17896. 'License %s must not contain extra spaces, make sure to trim it.',
  17897. json_encode($this->config['license'])
  17898. );
  17899. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17900. $this->warnings[] = sprintf(
  17901. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17902. 'If the software is closed-source, you may use "proprietary" as license.',
  17903. json_encode($this->config['license'])
  17904. );
  17905. }
  17906. }
  17907. }
  17908. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17909. foreach ($this->config['authors'] as $key => $author) {
  17910. if (!is_array($author)) {
  17911. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17912. unset($this->config['authors'][$key]);
  17913. continue;
  17914. }
  17915. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17916. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17917. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17918. unset($this->config['authors'][$key][$authorData]);
  17919. }
  17920. }
  17921. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17922. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17923. unset($this->config['authors'][$key]['homepage']);
  17924. }
  17925. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17926. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17927. unset($this->config['authors'][$key]['email']);
  17928. }
  17929. if (empty($this->config['authors'][$key])) {
  17930. unset($this->config['authors'][$key]);
  17931. }
  17932. }
  17933. if (empty($this->config['authors'])) {
  17934. unset($this->config['authors']);
  17935. }
  17936. }
  17937. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17938. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  17939. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17940. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17941. unset($this->config['support'][$key]);
  17942. }
  17943. }
  17944. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17945. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17946. unset($this->config['support']['email']);
  17947. }
  17948. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17949. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17950. unset($this->config['support']['irc']);
  17951. }
  17952. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  17953. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17954. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17955. unset($this->config['support'][$key]);
  17956. }
  17957. }
  17958. if (empty($this->config['support'])) {
  17959. unset($this->config['support']);
  17960. }
  17961. }
  17962. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17963. $stableConstraint = new Constraint('=', '1.0.0');
  17964. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17965. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17966. foreach ($this->config[$linkType] as $package => $constraint) {
  17967. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17968. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17969. }
  17970. if (!is_string($constraint)) {
  17971. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17972. unset($this->config[$linkType][$package]);
  17973. } elseif ('self.version' !== $constraint) {
  17974. try {
  17975. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17976. } catch (\Exception $e) {
  17977. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17978. unset($this->config[$linkType][$package]);
  17979. continue;
  17980. }
  17981. if (
  17982. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17983. && 'require' === $linkType
  17984. && $linkConstraint->matches($unboundConstraint)
  17985. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17986. ) {
  17987. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17988. } elseif (
  17989. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17990. && 'require' === $linkType
  17991. && substr($linkConstraint, 0, 1) === '='
  17992. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17993. ) {
  17994. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17995. }
  17996. }
  17997. }
  17998. }
  17999. }
  18000. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18001. foreach ($this->config['suggest'] as $package => $description) {
  18002. if (!is_string($description)) {
  18003. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18004. unset($this->config['suggest'][$package]);
  18005. }
  18006. }
  18007. }
  18008. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18009. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18010. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18011. unset($this->config['minimum-stability']);
  18012. }
  18013. }
  18014. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18015. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18016. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18017. if (!in_array($type, $types)) {
  18018. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18019. unset($this->config['autoload'][$type]);
  18020. }
  18021. if ($type === 'psr-4') {
  18022. foreach ($typeConfig as $namespace => $dirs) {
  18023. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18024. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18025. }
  18026. }
  18027. }
  18028. }
  18029. }
  18030. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18031. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18032. unset($this->config['autoload']['psr-4']);
  18033. }
  18034. $this->validateFlatArray('include-path');
  18035. $this->validateArray('transport-options');
  18036. if (isset($this->config['extra']['branch-alias'])) {
  18037. if (!is_array($this->config['extra']['branch-alias'])) {
  18038. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18039. } else {
  18040. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18041. if ('-dev' !== substr($targetBranch, -4)) {
  18042. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18043. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18044. continue;
  18045. }
  18046. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18047. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18048. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18049. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18050. continue;
  18051. }
  18052. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18053. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18054. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18055. ) {
  18056. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  18057. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18058. }
  18059. }
  18060. }
  18061. }
  18062. if ($this->errors) {
  18063. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  18064. }
  18065. $package = $this->loader->load($this->config, $class);
  18066. $this->config = null;
  18067. return $package;
  18068. }
  18069. public function getWarnings()
  18070. {
  18071. return $this->warnings;
  18072. }
  18073. public function getErrors()
  18074. {
  18075. return $this->errors;
  18076. }
  18077. public static function hasPackageNamingError($name, $isLink = false)
  18078. {
  18079. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  18080. return;
  18081. }
  18082. if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) {
  18083. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".';
  18084. }
  18085. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  18086. $bits = explode('/', strtolower($name));
  18087. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  18088. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  18089. }
  18090. if (preg_match('{\.json$}', $name)) {
  18091. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  18092. }
  18093. if (preg_match('{[A-Z]}', $name)) {
  18094. if ($isLink) {
  18095. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  18096. }
  18097. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  18098. $suggestName = strtolower($suggestName);
  18099. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  18100. }
  18101. }
  18102. private function validateRegex($property, $regex, $mandatory = false)
  18103. {
  18104. if (!$this->validateString($property, $mandatory)) {
  18105. return false;
  18106. }
  18107. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  18108. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  18109. if ($mandatory) {
  18110. $this->errors[] = $message;
  18111. } else {
  18112. $this->warnings[] = $message;
  18113. }
  18114. unset($this->config[$property]);
  18115. return false;
  18116. }
  18117. return true;
  18118. }
  18119. private function validateString($property, $mandatory = false)
  18120. {
  18121. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  18122. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  18123. unset($this->config[$property]);
  18124. return false;
  18125. }
  18126. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  18127. if ($mandatory) {
  18128. $this->errors[] = $property.' : must be present';
  18129. }
  18130. unset($this->config[$property]);
  18131. return false;
  18132. }
  18133. return true;
  18134. }
  18135. private function validateArray($property, $mandatory = false)
  18136. {
  18137. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  18138. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  18139. unset($this->config[$property]);
  18140. return false;
  18141. }
  18142. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  18143. if ($mandatory) {
  18144. $this->errors[] = $property.' : must be present and contain at least one element';
  18145. }
  18146. unset($this->config[$property]);
  18147. return false;
  18148. }
  18149. return true;
  18150. }
  18151. private function validateFlatArray($property, $regex = null, $mandatory = false)
  18152. {
  18153. if (!$this->validateArray($property, $mandatory)) {
  18154. return false;
  18155. }
  18156. $pass = true;
  18157. foreach ($this->config[$property] as $key => $value) {
  18158. if (!is_string($value) && !is_numeric($value)) {
  18159. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  18160. unset($this->config[$property][$key]);
  18161. $pass = false;
  18162. continue;
  18163. }
  18164. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  18165. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  18166. unset($this->config[$property][$key]);
  18167. $pass = false;
  18168. }
  18169. }
  18170. return $pass;
  18171. }
  18172. private function validateUrl($property, $mandatory = false)
  18173. {
  18174. if (!$this->validateString($property, $mandatory)) {
  18175. return false;
  18176. }
  18177. if (!$this->filterUrl($this->config[$property])) {
  18178. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  18179. unset($this->config[$property]);
  18180. return false;
  18181. }
  18182. return true;
  18183. }
  18184. private function filterUrl($value, array $schemes = array('http', 'https'))
  18185. {
  18186. if ($value === '') {
  18187. return true;
  18188. }
  18189. $bits = parse_url($value);
  18190. if (empty($bits['scheme']) || empty($bits['host'])) {
  18191. return false;
  18192. }
  18193. if (!in_array($bits['scheme'], $schemes, true)) {
  18194. return false;
  18195. }
  18196. return true;
  18197. }
  18198. }
  18199. <?php
  18200. namespace Composer\Package;
  18201. use Composer\Json\JsonFile;
  18202. use Composer\Installer\InstallationManager;
  18203. use Composer\Repository\RepositoryManager;
  18204. use Composer\Util\ProcessExecutor;
  18205. use Composer\Repository\ArrayRepository;
  18206. use Composer\Package\Dumper\ArrayDumper;
  18207. use Composer\Package\Loader\ArrayLoader;
  18208. use Composer\Util\Git as GitUtil;
  18209. use Composer\IO\IOInterface;
  18210. use Seld\JsonLint\ParsingException;
  18211. class Locker
  18212. {
  18213. private $lockFile;
  18214. private $repositoryManager;
  18215. private $installationManager;
  18216. private $hash;
  18217. private $contentHash;
  18218. private $loader;
  18219. private $dumper;
  18220. private $process;
  18221. private $lockDataCache;
  18222. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  18223. {
  18224. $this->lockFile = $lockFile;
  18225. $this->repositoryManager = $repositoryManager;
  18226. $this->installationManager = $installationManager;
  18227. $this->hash = md5($composerFileContents);
  18228. $this->contentHash = self::getContentHash($composerFileContents);
  18229. $this->loader = new ArrayLoader(null, true);
  18230. $this->dumper = new ArrayDumper();
  18231. $this->process = new ProcessExecutor($io);
  18232. }
  18233. public static function getContentHash($composerFileContents)
  18234. {
  18235. $content = json_decode($composerFileContents, true);
  18236. $relevantKeys = array(
  18237. 'name',
  18238. 'version',
  18239. 'require',
  18240. 'require-dev',
  18241. 'conflict',
  18242. 'replace',
  18243. 'provide',
  18244. 'minimum-stability',
  18245. 'prefer-stable',
  18246. 'repositories',
  18247. 'extra',
  18248. );
  18249. $relevantContent = array();
  18250. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18251. $relevantContent[$key] = $content[$key];
  18252. }
  18253. if (isset($content['config']['platform'])) {
  18254. $relevantContent['config']['platform'] = $content['config']['platform'];
  18255. }
  18256. ksort($relevantContent);
  18257. return md5(json_encode($relevantContent));
  18258. }
  18259. public function isLocked()
  18260. {
  18261. if (!$this->lockFile->exists()) {
  18262. return false;
  18263. }
  18264. $data = $this->getLockData();
  18265. return isset($data['packages']);
  18266. }
  18267. public function isFresh()
  18268. {
  18269. $lock = $this->lockFile->read();
  18270. if (!empty($lock['content-hash'])) {
  18271. return $this->contentHash === $lock['content-hash'];
  18272. }
  18273. if (!empty($lock['hash'])) {
  18274. return $this->hash === $lock['hash'];
  18275. }
  18276. return false;
  18277. }
  18278. public function getLockedRepository($withDevReqs = false)
  18279. {
  18280. $lockData = $this->getLockData();
  18281. $packages = new ArrayRepository();
  18282. $lockedPackages = $lockData['packages'];
  18283. if ($withDevReqs) {
  18284. if (isset($lockData['packages-dev'])) {
  18285. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18286. } else {
  18287. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  18288. }
  18289. }
  18290. if (empty($lockedPackages)) {
  18291. return $packages;
  18292. }
  18293. if (isset($lockedPackages[0]['name'])) {
  18294. foreach ($lockedPackages as $info) {
  18295. $packages->addPackage($this->loader->load($info));
  18296. }
  18297. return $packages;
  18298. }
  18299. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  18300. }
  18301. public function getPlatformRequirements($withDevReqs = false)
  18302. {
  18303. $lockData = $this->getLockData();
  18304. $requirements = array();
  18305. if (!empty($lockData['platform'])) {
  18306. $requirements = $this->loader->parseLinks(
  18307. '__ROOT__',
  18308. '1.0.0',
  18309. 'requires',
  18310. isset($lockData['platform']) ? $lockData['platform'] : array()
  18311. );
  18312. }
  18313. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18314. $devRequirements = $this->loader->parseLinks(
  18315. '__ROOT__',
  18316. '1.0.0',
  18317. 'requires',
  18318. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18319. );
  18320. $requirements = array_merge($requirements, $devRequirements);
  18321. }
  18322. return $requirements;
  18323. }
  18324. public function getMinimumStability()
  18325. {
  18326. $lockData = $this->getLockData();
  18327. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18328. }
  18329. public function getStabilityFlags()
  18330. {
  18331. $lockData = $this->getLockData();
  18332. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18333. }
  18334. public function getPreferStable()
  18335. {
  18336. $lockData = $this->getLockData();
  18337. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18338. }
  18339. public function getPreferLowest()
  18340. {
  18341. $lockData = $this->getLockData();
  18342. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18343. }
  18344. public function getPlatformOverrides()
  18345. {
  18346. $lockData = $this->getLockData();
  18347. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18348. }
  18349. public function getAliases()
  18350. {
  18351. $lockData = $this->getLockData();
  18352. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18353. }
  18354. public function getLockData()
  18355. {
  18356. if (null !== $this->lockDataCache) {
  18357. return $this->lockDataCache;
  18358. }
  18359. if (!$this->lockFile->exists()) {
  18360. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18361. }
  18362. return $this->lockDataCache = $this->lockFile->read();
  18363. }
  18364. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18365. {
  18366. $lock = array(
  18367. '_readme' => array('This file locks the dependencies of your project to a known state',
  18368. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18369. 'This file is @gener'.'ated automatically', ),
  18370. 'content-hash' => $this->contentHash,
  18371. 'packages' => null,
  18372. 'packages-dev' => null,
  18373. 'aliases' => array(),
  18374. 'minimum-stability' => $minimumStability,
  18375. 'stability-flags' => $stabilityFlags,
  18376. 'prefer-stable' => $preferStable,
  18377. 'prefer-lowest' => $preferLowest,
  18378. );
  18379. foreach ($aliases as $package => $versions) {
  18380. foreach ($versions as $version => $alias) {
  18381. $lock['aliases'][] = array(
  18382. 'alias' => $alias['alias'],
  18383. 'alias_normalized' => $alias['alias_normalized'],
  18384. 'version' => $version,
  18385. 'package' => $package,
  18386. );
  18387. }
  18388. }
  18389. $lock['packages'] = $this->lockPackages($packages);
  18390. if (null !== $devPackages) {
  18391. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18392. }
  18393. $lock['platform'] = $platformReqs;
  18394. $lock['platform-dev'] = $platformDevReqs;
  18395. if ($platformOverrides) {
  18396. $lock['platform-overrides'] = $platformOverrides;
  18397. }
  18398. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18399. if ($this->lockFile->exists()) {
  18400. unlink($this->lockFile->getPath());
  18401. }
  18402. return false;
  18403. }
  18404. try {
  18405. $isLocked = $this->isLocked();
  18406. } catch (ParsingException $e) {
  18407. $isLocked = false;
  18408. }
  18409. if (!$isLocked || $lock !== $this->getLockData()) {
  18410. $this->lockFile->write($lock);
  18411. $this->lockDataCache = null;
  18412. return true;
  18413. }
  18414. return false;
  18415. }
  18416. private function lockPackages(array $packages)
  18417. {
  18418. $locked = array();
  18419. foreach ($packages as $package) {
  18420. if ($package instanceof AliasPackage) {
  18421. continue;
  18422. }
  18423. $name = $package->getPrettyName();
  18424. $version = $package->getPrettyVersion();
  18425. if (!$name || !$version) {
  18426. throw new \LogicException(sprintf(
  18427. 'Package "%s" has no version or name and can not be locked',
  18428. $package
  18429. ));
  18430. }
  18431. $spec = $this->dumper->dump($package);
  18432. unset($spec['version_normalized']);
  18433. $time = isset($spec['time']) ? $spec['time'] : null;
  18434. unset($spec['time']);
  18435. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18436. $time = $this->getPackageTime($package) ?: $time;
  18437. }
  18438. if (null !== $time) {
  18439. $spec['time'] = $time;
  18440. }
  18441. unset($spec['installation-source']);
  18442. $locked[] = $spec;
  18443. }
  18444. usort($locked, function ($a, $b) {
  18445. $comparison = strcmp($a['name'], $b['name']);
  18446. if (0 !== $comparison) {
  18447. return $comparison;
  18448. }
  18449. return strcmp($a['version'], $b['version']);
  18450. });
  18451. return $locked;
  18452. }
  18453. private function getPackageTime(PackageInterface $package)
  18454. {
  18455. if (!function_exists('proc_open')) {
  18456. return null;
  18457. }
  18458. $path = realpath($this->installationManager->getInstallPath($package));
  18459. $sourceType = $package->getSourceType();
  18460. $datetime = null;
  18461. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18462. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18463. switch ($sourceType) {
  18464. case 'git':
  18465. GitUtil::cleanEnv();
  18466. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18467. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18468. }
  18469. break;
  18470. case 'hg':
  18471. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18472. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18473. }
  18474. break;
  18475. }
  18476. }
  18477. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18478. }
  18479. }
  18480. <?php
  18481. namespace Composer\Package;
  18482. use Composer\Package\Version\VersionParser;
  18483. use Composer\Util\ComposerMirror;
  18484. class Package extends BasePackage
  18485. {
  18486. protected $type;
  18487. protected $targetDir;
  18488. protected $installationSource;
  18489. protected $sourceType;
  18490. protected $sourceUrl;
  18491. protected $sourceReference;
  18492. protected $sourceMirrors;
  18493. protected $distType;
  18494. protected $distUrl;
  18495. protected $distReference;
  18496. protected $distSha1Checksum;
  18497. protected $distMirrors;
  18498. protected $version;
  18499. protected $prettyVersion;
  18500. protected $releaseDate;
  18501. protected $extra = array();
  18502. protected $binaries = array();
  18503. protected $dev;
  18504. protected $stability;
  18505. protected $notificationUrl;
  18506. protected $requires = array();
  18507. protected $conflicts = array();
  18508. protected $provides = array();
  18509. protected $replaces = array();
  18510. protected $devRequires = array();
  18511. protected $suggests = array();
  18512. protected $autoload = array();
  18513. protected $devAutoload = array();
  18514. protected $includePaths = array();
  18515. protected $archiveExcludes = array();
  18516. public function __construct($name, $version, $prettyVersion)
  18517. {
  18518. parent::__construct($name);
  18519. $this->version = $version;
  18520. $this->prettyVersion = $prettyVersion;
  18521. $this->stability = VersionParser::parseStability($version);
  18522. $this->dev = $this->stability === 'dev';
  18523. }
  18524. public function isDev()
  18525. {
  18526. return $this->dev;
  18527. }
  18528. public function setType($type)
  18529. {
  18530. $this->type = $type;
  18531. }
  18532. public function getType()
  18533. {
  18534. return $this->type ?: 'library';
  18535. }
  18536. public function getStability()
  18537. {
  18538. return $this->stability;
  18539. }
  18540. public function setTargetDir($targetDir)
  18541. {
  18542. $this->targetDir = $targetDir;
  18543. }
  18544. public function getTargetDir()
  18545. {
  18546. if (null === $this->targetDir) {
  18547. return;
  18548. }
  18549. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18550. }
  18551. public function setExtra(array $extra)
  18552. {
  18553. $this->extra = $extra;
  18554. }
  18555. public function getExtra()
  18556. {
  18557. return $this->extra;
  18558. }
  18559. public function setBinaries(array $binaries)
  18560. {
  18561. $this->binaries = $binaries;
  18562. }
  18563. public function getBinaries()
  18564. {
  18565. return $this->binaries;
  18566. }
  18567. public function setInstallationSource($type)
  18568. {
  18569. $this->installationSource = $type;
  18570. }
  18571. public function getInstallationSource()
  18572. {
  18573. return $this->installationSource;
  18574. }
  18575. public function setSourceType($type)
  18576. {
  18577. $this->sourceType = $type;
  18578. }
  18579. public function getSourceType()
  18580. {
  18581. return $this->sourceType;
  18582. }
  18583. public function setSourceUrl($url)
  18584. {
  18585. $this->sourceUrl = $url;
  18586. }
  18587. public function getSourceUrl()
  18588. {
  18589. return $this->sourceUrl;
  18590. }
  18591. public function setSourceReference($reference)
  18592. {
  18593. $this->sourceReference = $reference;
  18594. }
  18595. public function getSourceReference()
  18596. {
  18597. return $this->sourceReference;
  18598. }
  18599. public function setSourceMirrors($mirrors)
  18600. {
  18601. $this->sourceMirrors = $mirrors;
  18602. }
  18603. public function getSourceMirrors()
  18604. {
  18605. return $this->sourceMirrors;
  18606. }
  18607. public function getSourceUrls()
  18608. {
  18609. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18610. }
  18611. public function setDistType($type)
  18612. {
  18613. $this->distType = $type;
  18614. }
  18615. public function getDistType()
  18616. {
  18617. return $this->distType;
  18618. }
  18619. public function setDistUrl($url)
  18620. {
  18621. $this->distUrl = $url;
  18622. }
  18623. public function getDistUrl()
  18624. {
  18625. return $this->distUrl;
  18626. }
  18627. public function setDistReference($reference)
  18628. {
  18629. $this->distReference = $reference;
  18630. }
  18631. public function getDistReference()
  18632. {
  18633. return $this->distReference;
  18634. }
  18635. public function setDistSha1Checksum($sha1checksum)
  18636. {
  18637. $this->distSha1Checksum = $sha1checksum;
  18638. }
  18639. public function getDistSha1Checksum()
  18640. {
  18641. return $this->distSha1Checksum;
  18642. }
  18643. public function setDistMirrors($mirrors)
  18644. {
  18645. $this->distMirrors = $mirrors;
  18646. }
  18647. public function getDistMirrors()
  18648. {
  18649. return $this->distMirrors;
  18650. }
  18651. public function getDistUrls()
  18652. {
  18653. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18654. }
  18655. public function getVersion()
  18656. {
  18657. return $this->version;
  18658. }
  18659. public function getPrettyVersion()
  18660. {
  18661. return $this->prettyVersion;
  18662. }
  18663. public function setReleaseDate(\DateTime $releaseDate)
  18664. {
  18665. $this->releaseDate = $releaseDate;
  18666. }
  18667. public function getReleaseDate()
  18668. {
  18669. return $this->releaseDate;
  18670. }
  18671. public function setRequires(array $requires)
  18672. {
  18673. $this->requires = $requires;
  18674. }
  18675. public function getRequires()
  18676. {
  18677. return $this->requires;
  18678. }
  18679. public function setConflicts(array $conflicts)
  18680. {
  18681. $this->conflicts = $conflicts;
  18682. }
  18683. public function getConflicts()
  18684. {
  18685. return $this->conflicts;
  18686. }
  18687. public function setProvides(array $provides)
  18688. {
  18689. $this->provides = $provides;
  18690. }
  18691. public function getProvides()
  18692. {
  18693. return $this->provides;
  18694. }
  18695. public function setReplaces(array $replaces)
  18696. {
  18697. $this->replaces = $replaces;
  18698. }
  18699. public function getReplaces()
  18700. {
  18701. return $this->replaces;
  18702. }
  18703. public function setDevRequires(array $devRequires)
  18704. {
  18705. $this->devRequires = $devRequires;
  18706. }
  18707. public function getDevRequires()
  18708. {
  18709. return $this->devRequires;
  18710. }
  18711. public function setSuggests(array $suggests)
  18712. {
  18713. $this->suggests = $suggests;
  18714. }
  18715. public function getSuggests()
  18716. {
  18717. return $this->suggests;
  18718. }
  18719. public function setAutoload(array $autoload)
  18720. {
  18721. $this->autoload = $autoload;
  18722. }
  18723. public function getAutoload()
  18724. {
  18725. return $this->autoload;
  18726. }
  18727. public function setDevAutoload(array $devAutoload)
  18728. {
  18729. $this->devAutoload = $devAutoload;
  18730. }
  18731. public function getDevAutoload()
  18732. {
  18733. return $this->devAutoload;
  18734. }
  18735. public function setIncludePaths(array $includePaths)
  18736. {
  18737. $this->includePaths = $includePaths;
  18738. }
  18739. public function getIncludePaths()
  18740. {
  18741. return $this->includePaths;
  18742. }
  18743. public function setNotificationUrl($notificationUrl)
  18744. {
  18745. $this->notificationUrl = $notificationUrl;
  18746. }
  18747. public function getNotificationUrl()
  18748. {
  18749. return $this->notificationUrl;
  18750. }
  18751. public function setArchiveExcludes(array $excludes)
  18752. {
  18753. $this->archiveExcludes = $excludes;
  18754. }
  18755. public function getArchiveExcludes()
  18756. {
  18757. return $this->archiveExcludes;
  18758. }
  18759. public function replaceVersion($version, $prettyVersion)
  18760. {
  18761. $this->version = $version;
  18762. $this->prettyVersion = $prettyVersion;
  18763. $this->stability = VersionParser::parseStability($version);
  18764. $this->dev = $this->stability === 'dev';
  18765. }
  18766. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18767. {
  18768. if (!$url) {
  18769. return array();
  18770. }
  18771. $urls = array($url);
  18772. if ($mirrors) {
  18773. foreach ($mirrors as $mirror) {
  18774. if ($urlType === 'dist') {
  18775. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18776. } elseif ($urlType === 'source' && $type === 'git') {
  18777. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18778. } elseif ($urlType === 'source' && $type === 'hg') {
  18779. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18780. }
  18781. if (!in_array($mirrorUrl, $urls)) {
  18782. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18783. $func($urls, $mirrorUrl);
  18784. }
  18785. }
  18786. }
  18787. return $urls;
  18788. }
  18789. }
  18790. <?php
  18791. namespace Composer\Package;
  18792. use Composer\Repository\RepositoryInterface;
  18793. interface PackageInterface
  18794. {
  18795. public function getName();
  18796. public function getPrettyName();
  18797. public function getNames();
  18798. public function setId($id);
  18799. public function getId();
  18800. public function isDev();
  18801. public function getType();
  18802. public function getTargetDir();
  18803. public function getExtra();
  18804. public function setInstallationSource($type);
  18805. public function getInstallationSource();
  18806. public function getSourceType();
  18807. public function getSourceUrl();
  18808. public function getSourceUrls();
  18809. public function getSourceReference();
  18810. public function getSourceMirrors();
  18811. public function getDistType();
  18812. public function getDistUrl();
  18813. public function getDistUrls();
  18814. public function getDistReference();
  18815. public function getDistSha1Checksum();
  18816. public function getDistMirrors();
  18817. public function getVersion();
  18818. public function getPrettyVersion();
  18819. public function getFullPrettyVersion($truncate = true);
  18820. public function getReleaseDate();
  18821. public function getStability();
  18822. public function getRequires();
  18823. public function getConflicts();
  18824. public function getProvides();
  18825. public function getReplaces();
  18826. public function getDevRequires();
  18827. public function getSuggests();
  18828. public function getAutoload();
  18829. public function getDevAutoload();
  18830. public function getIncludePaths();
  18831. public function setRepository(RepositoryInterface $repository);
  18832. public function getRepository();
  18833. public function getBinaries();
  18834. public function getUniqueName();
  18835. public function getNotificationUrl();
  18836. public function __toString();
  18837. public function getPrettyString();
  18838. public function getArchiveExcludes();
  18839. public function getTransportOptions();
  18840. }
  18841. <?php
  18842. namespace Composer\Package;
  18843. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18844. {
  18845. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18846. {
  18847. parent::__construct($aliasOf, $version, $prettyVersion);
  18848. }
  18849. public function getAliases()
  18850. {
  18851. return $this->aliasOf->getAliases();
  18852. }
  18853. public function getMinimumStability()
  18854. {
  18855. return $this->aliasOf->getMinimumStability();
  18856. }
  18857. public function getStabilityFlags()
  18858. {
  18859. return $this->aliasOf->getStabilityFlags();
  18860. }
  18861. public function getReferences()
  18862. {
  18863. return $this->aliasOf->getReferences();
  18864. }
  18865. public function getPreferStable()
  18866. {
  18867. return $this->aliasOf->getPreferStable();
  18868. }
  18869. public function getConfig()
  18870. {
  18871. return $this->aliasOf->getConfig();
  18872. }
  18873. public function setRequires(array $require)
  18874. {
  18875. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18876. $this->aliasOf->setRequires($require);
  18877. }
  18878. public function setDevRequires(array $devRequire)
  18879. {
  18880. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18881. $this->aliasOf->setDevRequires($devRequire);
  18882. }
  18883. public function setConflicts(array $conflicts)
  18884. {
  18885. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18886. $this->aliasOf->setConflicts($conflicts);
  18887. }
  18888. public function setProvides(array $provides)
  18889. {
  18890. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18891. $this->aliasOf->setProvides($provides);
  18892. }
  18893. public function setReplaces(array $replaces)
  18894. {
  18895. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18896. $this->aliasOf->setReplaces($replaces);
  18897. }
  18898. public function setRepositories($repositories)
  18899. {
  18900. $this->aliasOf->setRepositories($repositories);
  18901. }
  18902. public function setAutoload(array $autoload)
  18903. {
  18904. $this->aliasOf->setAutoload($autoload);
  18905. }
  18906. public function setDevAutoload(array $devAutoload)
  18907. {
  18908. $this->aliasOf->setDevAutoload($devAutoload);
  18909. }
  18910. public function setStabilityFlags(array $stabilityFlags)
  18911. {
  18912. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18913. }
  18914. public function setSuggests(array $suggests)
  18915. {
  18916. $this->aliasOf->setSuggests($suggests);
  18917. }
  18918. public function setExtra(array $extra)
  18919. {
  18920. $this->aliasOf->setExtra($extra);
  18921. }
  18922. public function __clone()
  18923. {
  18924. parent::__clone();
  18925. $this->aliasOf = clone $this->aliasOf;
  18926. }
  18927. }
  18928. <?php
  18929. namespace Composer\Package;
  18930. class RootPackage extends CompletePackage implements RootPackageInterface
  18931. {
  18932. protected $minimumStability = 'stable';
  18933. protected $preferStable = false;
  18934. protected $stabilityFlags = array();
  18935. protected $config = array();
  18936. protected $references = array();
  18937. protected $aliases = array();
  18938. public function setMinimumStability($minimumStability)
  18939. {
  18940. $this->minimumStability = $minimumStability;
  18941. }
  18942. public function getMinimumStability()
  18943. {
  18944. return $this->minimumStability;
  18945. }
  18946. public function setStabilityFlags(array $stabilityFlags)
  18947. {
  18948. $this->stabilityFlags = $stabilityFlags;
  18949. }
  18950. public function getStabilityFlags()
  18951. {
  18952. return $this->stabilityFlags;
  18953. }
  18954. public function setPreferStable($preferStable)
  18955. {
  18956. $this->preferStable = $preferStable;
  18957. }
  18958. public function getPreferStable()
  18959. {
  18960. return $this->preferStable;
  18961. }
  18962. public function setConfig(array $config)
  18963. {
  18964. $this->config = $config;
  18965. }
  18966. public function getConfig()
  18967. {
  18968. return $this->config;
  18969. }
  18970. public function setReferences(array $references)
  18971. {
  18972. $this->references = $references;
  18973. }
  18974. public function getReferences()
  18975. {
  18976. return $this->references;
  18977. }
  18978. public function setAliases(array $aliases)
  18979. {
  18980. $this->aliases = $aliases;
  18981. }
  18982. public function getAliases()
  18983. {
  18984. return $this->aliases;
  18985. }
  18986. }
  18987. <?php
  18988. namespace Composer\Package;
  18989. interface RootPackageInterface extends CompletePackageInterface
  18990. {
  18991. public function getAliases();
  18992. public function getMinimumStability();
  18993. public function getStabilityFlags();
  18994. public function getReferences();
  18995. public function getPreferStable();
  18996. public function getConfig();
  18997. public function setRequires(array $requires);
  18998. public function setDevRequires(array $devRequires);
  18999. public function setConflicts(array $conflicts);
  19000. public function setProvides(array $provides);
  19001. public function setReplaces(array $replaces);
  19002. public function setRepositories($repositories);
  19003. public function setAutoload(array $autoload);
  19004. public function setDevAutoload(array $devAutoload);
  19005. public function setStabilityFlags(array $stabilityFlags);
  19006. public function setSuggests(array $suggests);
  19007. public function setExtra(array $extra);
  19008. }
  19009. <?php
  19010. namespace Composer\Package\Version;
  19011. use Composer\Config;
  19012. use Composer\Repository\Vcs\HgDriver;
  19013. use Composer\IO\NullIO;
  19014. use Composer\Semver\VersionParser as SemverVersionParser;
  19015. use Composer\Util\Git as GitUtil;
  19016. use Composer\Util\ProcessExecutor;
  19017. use Composer\Util\Svn as SvnUtil;
  19018. class VersionGuesser
  19019. {
  19020. private $config;
  19021. private $process;
  19022. private $versionParser;
  19023. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19024. {
  19025. $this->config = $config;
  19026. $this->process = $process;
  19027. $this->versionParser = $versionParser;
  19028. }
  19029. public function guessVersion(array $packageConfig, $path)
  19030. {
  19031. if (function_exists('proc_open')) {
  19032. $versionData = $this->guessGitVersion($packageConfig, $path);
  19033. if (null !== $versionData && null !== $versionData['version']) {
  19034. return $this->postprocess($versionData);
  19035. }
  19036. $versionData = $this->guessHgVersion($packageConfig, $path);
  19037. if (null !== $versionData && null !== $versionData['version']) {
  19038. return $this->postprocess($versionData);
  19039. }
  19040. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19041. if (null !== $versionData && null !== $versionData['version']) {
  19042. return $this->postprocess($versionData);
  19043. }
  19044. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19045. if (null !== $versionData && null !== $versionData['version']) {
  19046. return $this->postprocess($versionData);
  19047. }
  19048. }
  19049. }
  19050. private function postprocess(array $versionData)
  19051. {
  19052. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  19053. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  19054. }
  19055. return $versionData;
  19056. }
  19057. private function guessGitVersion(array $packageConfig, $path)
  19058. {
  19059. GitUtil::cleanEnv();
  19060. $commit = null;
  19061. $version = null;
  19062. $prettyVersion = null;
  19063. $isDetached = false;
  19064. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  19065. $branches = array();
  19066. $isFeatureBranch = false;
  19067. foreach ($this->process->splitLines($output) as $branch) {
  19068. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19069. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  19070. $version = 'dev-' . $match[2];
  19071. $prettyVersion = $version;
  19072. $isFeatureBranch = true;
  19073. $isDetached = true;
  19074. } else {
  19075. $version = $this->versionParser->normalizeBranch($match[1]);
  19076. $prettyVersion = 'dev-' . $match[1];
  19077. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19078. }
  19079. if ($match[2]) {
  19080. $commit = $match[2];
  19081. }
  19082. }
  19083. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19084. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19085. $branches[] = $match[1];
  19086. }
  19087. }
  19088. }
  19089. if ($isFeatureBranch) {
  19090. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  19091. $version = $result['version'];
  19092. $prettyVersion = $result['pretty_version'];
  19093. }
  19094. }
  19095. if (!$version || $isDetached) {
  19096. $result = $this->versionFromGitTags($path);
  19097. if ($result) {
  19098. $version = $result['version'];
  19099. $prettyVersion = $result['pretty_version'];
  19100. }
  19101. }
  19102. if (!$commit) {
  19103. $command = 'git log --pretty="%H" -n1 HEAD';
  19104. if (0 === $this->process->execute($command, $output, $path)) {
  19105. $commit = trim($output) ?: null;
  19106. }
  19107. }
  19108. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  19109. }
  19110. private function versionFromGitTags($path)
  19111. {
  19112. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  19113. try {
  19114. $version = $this->versionParser->normalize(trim($output));
  19115. return array('version' => $version, 'pretty_version' => trim($output));
  19116. } catch (\Exception $e) {
  19117. }
  19118. }
  19119. return null;
  19120. }
  19121. private function guessHgVersion(array $packageConfig, $path)
  19122. {
  19123. if (0 === $this->process->execute('hg branch', $output, $path)) {
  19124. $branch = trim($output);
  19125. $version = $this->versionParser->normalizeBranch($branch);
  19126. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19127. if ('9999999-dev' === $version) {
  19128. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  19129. }
  19130. if (!$isFeatureBranch) {
  19131. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  19132. }
  19133. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  19134. $branches = array_keys($driver->getBranches());
  19135. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  19136. $result['commit'] = '';
  19137. return $result;
  19138. }
  19139. }
  19140. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  19141. {
  19142. $prettyVersion = $version;
  19143. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  19144. || strpos(json_encode($packageConfig), '"self.version"')
  19145. ) {
  19146. $branch = preg_replace('{^dev-}', '', $version);
  19147. $length = PHP_INT_MAX;
  19148. $nonFeatureBranches = '';
  19149. if (!empty($packageConfig['non-feature-branches'])) {
  19150. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  19151. }
  19152. foreach ($branches as $candidate) {
  19153. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  19154. break;
  19155. }
  19156. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  19157. continue;
  19158. }
  19159. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  19160. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  19161. continue;
  19162. }
  19163. if (strlen($output) < $length) {
  19164. $length = strlen($output);
  19165. $version = $this->versionParser->normalizeBranch($candidate);
  19166. $prettyVersion = 'dev-' . $match[1];
  19167. }
  19168. }
  19169. }
  19170. return array('version' => $version, 'pretty_version' => $prettyVersion);
  19171. }
  19172. private function guessFossilVersion(array $packageConfig, $path)
  19173. {
  19174. $version = null;
  19175. $prettyVersion = null;
  19176. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  19177. $branch = trim($output);
  19178. $version = $this->versionParser->normalizeBranch($branch);
  19179. $prettyVersion = 'dev-' . $branch;
  19180. }
  19181. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  19182. try {
  19183. $version = $this->versionParser->normalize(trim($output));
  19184. $prettyVersion = trim($output);
  19185. } catch (\Exception $e) {
  19186. }
  19187. }
  19188. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19189. }
  19190. private function guessSvnVersion(array $packageConfig, $path)
  19191. {
  19192. SvnUtil::cleanEnv();
  19193. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  19194. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  19195. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  19196. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  19197. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  19198. if (preg_match($urlPattern, $output, $matches)) {
  19199. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  19200. $version = $this->versionParser->normalizeBranch($matches[3]);
  19201. $prettyVersion = 'dev-' . $matches[3];
  19202. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19203. }
  19204. $prettyVersion = trim($matches[1]);
  19205. $version = $this->versionParser->normalize($prettyVersion);
  19206. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19207. }
  19208. }
  19209. }
  19210. }
  19211. <?php
  19212. namespace Composer\Package\Version;
  19213. use Composer\Repository\PlatformRepository;
  19214. use Composer\Semver\VersionParser as SemverVersionParser;
  19215. use Composer\Semver\Semver;
  19216. class VersionParser extends SemverVersionParser
  19217. {
  19218. private static $constraints = array();
  19219. public function parseConstraints($constraints)
  19220. {
  19221. if (!isset(self::$constraints[$constraints])) {
  19222. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  19223. }
  19224. return self::$constraints[$constraints];
  19225. }
  19226. public function parseNameVersionPairs(array $pairs)
  19227. {
  19228. $pairs = array_values($pairs);
  19229. $result = array();
  19230. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19231. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19232. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19233. $pair .= ' '.$pairs[$i + 1];
  19234. $i++;
  19235. }
  19236. if (strpos($pair, ' ')) {
  19237. list($name, $version) = explode(' ', $pair, 2);
  19238. $result[] = array('name' => $name, 'version' => $version);
  19239. } else {
  19240. $result[] = array('name' => $pair);
  19241. }
  19242. }
  19243. return $result;
  19244. }
  19245. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19246. {
  19247. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19248. return true;
  19249. }
  19250. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19251. return $sorted[0] === $normalizedFrom;
  19252. }
  19253. }
  19254. <?php
  19255. namespace Composer\Package\Version;
  19256. use Composer\DependencyResolver\Pool;
  19257. use Composer\Package\BasePackage;
  19258. use Composer\Package\PackageInterface;
  19259. use Composer\Package\Loader\ArrayLoader;
  19260. use Composer\Package\Dumper\ArrayDumper;
  19261. use Composer\Semver\Constraint\Constraint;
  19262. class VersionSelector
  19263. {
  19264. private $pool;
  19265. private $parser;
  19266. public function __construct(Pool $pool)
  19267. {
  19268. $this->pool = $pool;
  19269. }
  19270. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19271. {
  19272. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19273. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19274. if ($targetPhpVersion) {
  19275. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19276. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19277. $reqs = $pkg->getRequires();
  19278. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19279. });
  19280. }
  19281. if (!$candidates) {
  19282. return false;
  19283. }
  19284. $package = reset($candidates);
  19285. $minPriority = BasePackage::$stabilities[$preferredStability];
  19286. foreach ($candidates as $candidate) {
  19287. $candidatePriority = $candidate->getStabilityPriority();
  19288. $currentPriority = $package->getStabilityPriority();
  19289. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19290. continue;
  19291. }
  19292. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19293. $package = $candidate;
  19294. continue;
  19295. }
  19296. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19297. $package = $candidate;
  19298. continue;
  19299. }
  19300. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19301. $package = $candidate;
  19302. }
  19303. }
  19304. return $package;
  19305. }
  19306. public function findRecommendedRequireVersion(PackageInterface $package)
  19307. {
  19308. $version = $package->getVersion();
  19309. if (!$package->isDev()) {
  19310. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19311. }
  19312. $loader = new ArrayLoader($this->getParser());
  19313. $dumper = new ArrayDumper();
  19314. $extra = $loader->getBranchAlias($dumper->dump($package));
  19315. if ($extra) {
  19316. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19317. if ($count) {
  19318. $extra = str_replace('.9999999', '.0', $extra);
  19319. return $this->transformVersion($extra, $extra, 'dev');
  19320. }
  19321. }
  19322. return $package->getPrettyVersion();
  19323. }
  19324. private function transformVersion($version, $prettyVersion, $stability)
  19325. {
  19326. $semanticVersionParts = explode('.', $version);
  19327. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19328. if ($semanticVersionParts[0] === '0') {
  19329. unset($semanticVersionParts[3]);
  19330. } else {
  19331. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19332. }
  19333. $version = implode('.', $semanticVersionParts);
  19334. } else {
  19335. return $prettyVersion;
  19336. }
  19337. if ($stability != 'stable') {
  19338. $version .= '@'.$stability;
  19339. }
  19340. return '^' . $version;
  19341. }
  19342. private function getParser()
  19343. {
  19344. if ($this->parser === null) {
  19345. $this->parser = new VersionParser();
  19346. }
  19347. return $this->parser;
  19348. }
  19349. }
  19350. <?php
  19351. namespace Composer\Plugin\Capability;
  19352. interface Capability
  19353. {
  19354. }
  19355. <?php
  19356. namespace Composer\Plugin\Capability;
  19357. interface CommandProvider extends Capability
  19358. {
  19359. public function getCommands();
  19360. }
  19361. <?php
  19362. namespace Composer\Plugin;
  19363. interface Capable
  19364. {
  19365. public function getCapabilities();
  19366. }
  19367. <?php
  19368. namespace Composer\Plugin;
  19369. use Composer\EventDispatcher\Event;
  19370. use Symfony\Component\Console\Input\InputInterface;
  19371. use Symfony\Component\Console\Output\OutputInterface;
  19372. class CommandEvent extends Event
  19373. {
  19374. private $commandName;
  19375. private $input;
  19376. private $output;
  19377. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19378. {
  19379. parent::__construct($name, $args, $flags);
  19380. $this->commandName = $commandName;
  19381. $this->input = $input;
  19382. $this->output = $output;
  19383. }
  19384. public function getInput()
  19385. {
  19386. return $this->input;
  19387. }
  19388. public function getOutput()
  19389. {
  19390. return $this->output;
  19391. }
  19392. public function getCommandName()
  19393. {
  19394. return $this->commandName;
  19395. }
  19396. }
  19397. <?php
  19398. namespace Composer\Plugin;
  19399. class PluginEvents
  19400. {
  19401. const INIT = 'init';
  19402. const COMMAND = 'command';
  19403. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19404. const PRE_COMMAND_RUN = 'pre-command-run';
  19405. }
  19406. <?php
  19407. namespace Composer\Plugin;
  19408. use Composer\Composer;
  19409. use Composer\IO\IOInterface;
  19410. interface PluginInterface
  19411. {
  19412. const PLUGIN_API_VERSION = '1.1.0';
  19413. public function activate(Composer $composer, IOInterface $io);
  19414. }
  19415. <?php
  19416. namespace Composer\Plugin;
  19417. use Composer\Composer;
  19418. use Composer\EventDispatcher\EventSubscriberInterface;
  19419. use Composer\IO\IOInterface;
  19420. use Composer\Package\Package;
  19421. use Composer\Package\Version\VersionParser;
  19422. use Composer\Repository\RepositoryInterface;
  19423. use Composer\Package\AliasPackage;
  19424. use Composer\Package\PackageInterface;
  19425. use Composer\Package\Link;
  19426. use Composer\Semver\Constraint\Constraint;
  19427. use Composer\DependencyResolver\Pool;
  19428. use Composer\Plugin\Capability\Capability;
  19429. class PluginManager
  19430. {
  19431. protected $composer;
  19432. protected $io;
  19433. protected $globalComposer;
  19434. protected $versionParser;
  19435. protected $disablePlugins = false;
  19436. protected $plugins = array();
  19437. protected $registeredPlugins = array();
  19438. private static $classCounter = 0;
  19439. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19440. {
  19441. $this->io = $io;
  19442. $this->composer = $composer;
  19443. $this->globalComposer = $globalComposer;
  19444. $this->versionParser = new VersionParser();
  19445. $this->disablePlugins = $disablePlugins;
  19446. }
  19447. public function loadInstalledPlugins()
  19448. {
  19449. if ($this->disablePlugins) {
  19450. return;
  19451. }
  19452. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19453. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19454. if ($repo) {
  19455. $this->loadRepository($repo);
  19456. }
  19457. if ($globalRepo) {
  19458. $this->loadRepository($globalRepo);
  19459. }
  19460. }
  19461. public function getPlugins()
  19462. {
  19463. return $this->plugins;
  19464. }
  19465. public function getGlobalComposer()
  19466. {
  19467. return $this->globalComposer;
  19468. }
  19469. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19470. {
  19471. if ($this->disablePlugins) {
  19472. return;
  19473. }
  19474. if ($package->getType() === 'composer-plugin') {
  19475. $requiresComposer = null;
  19476. foreach ($package->getRequires() as $link) {
  19477. if ('composer-plugin-api' === $link->getTarget()) {
  19478. $requiresComposer = $link->getConstraint();
  19479. break;
  19480. }
  19481. }
  19482. if (!$requiresComposer) {
  19483. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19484. }
  19485. $currentPluginApiVersion = $this->getPluginApiVersion();
  19486. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19487. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19488. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  19489. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19490. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  19491. return;
  19492. }
  19493. }
  19494. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19495. if (in_array($package->getName(), $this->registeredPlugins)) {
  19496. return;
  19497. }
  19498. $extra = $package->getExtra();
  19499. if (empty($extra['class'])) {
  19500. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19501. }
  19502. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19503. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19504. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19505. $pool = new Pool('dev');
  19506. $pool->addRepository($localRepo);
  19507. if ($globalRepo) {
  19508. $pool->addRepository($globalRepo);
  19509. }
  19510. $autoloadPackages = array($package->getName() => $package);
  19511. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19512. $generator = $this->composer->getAutoloadGenerator();
  19513. $autoloads = array();
  19514. foreach ($autoloadPackages as $autoloadPackage) {
  19515. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19516. $autoloads[] = array($autoloadPackage, $downloadPath);
  19517. }
  19518. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19519. $classLoader = $generator->createLoader($map);
  19520. $classLoader->register();
  19521. foreach ($classes as $class) {
  19522. if (class_exists($class, false)) {
  19523. $class = trim($class, '\\');
  19524. $path = $classLoader->findFile($class);
  19525. $code = file_get_contents($path);
  19526. $separatorPos = strrpos($class, '\\');
  19527. $className = $class;
  19528. if ($separatorPos) {
  19529. $className = substr($class, $separatorPos + 1);
  19530. }
  19531. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19532. $code = str_replace('__FILE__', var_export($path, true), $code);
  19533. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19534. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19535. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19536. eval($code);
  19537. $class .= '_composer_tmp'.self::$classCounter;
  19538. self::$classCounter++;
  19539. }
  19540. if ($oldInstallerPlugin) {
  19541. $installer = new $class($this->io, $this->composer);
  19542. $this->composer->getInstallationManager()->addInstaller($installer);
  19543. } elseif (class_exists($class)) {
  19544. $plugin = new $class();
  19545. $this->addPlugin($plugin);
  19546. $this->registeredPlugins[] = $package->getName();
  19547. } elseif ($failOnMissingClasses) {
  19548. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19549. }
  19550. }
  19551. }
  19552. protected function getPluginApiVersion()
  19553. {
  19554. return PluginInterface::PLUGIN_API_VERSION;
  19555. }
  19556. public function addPlugin(PluginInterface $plugin)
  19557. {
  19558. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19559. $this->plugins[] = $plugin;
  19560. $plugin->activate($this->composer, $this->io);
  19561. if ($plugin instanceof EventSubscriberInterface) {
  19562. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19563. }
  19564. }
  19565. private function loadRepository(RepositoryInterface $repo)
  19566. {
  19567. foreach ($repo->getPackages() as $package) {
  19568. if ($package instanceof AliasPackage) {
  19569. continue;
  19570. }
  19571. if ('composer-plugin' === $package->getType()) {
  19572. $this->registerPackage($package);
  19573. } elseif ('composer-installer' === $package->getType()) {
  19574. $this->registerPackage($package);
  19575. }
  19576. }
  19577. }
  19578. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19579. {
  19580. $requires = array_merge(
  19581. $package->getRequires(),
  19582. $package->getDevRequires()
  19583. );
  19584. foreach ($requires as $requireLink) {
  19585. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19586. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19587. $collected[$requiredPackage->getName()] = $requiredPackage;
  19588. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19589. }
  19590. }
  19591. return $collected;
  19592. }
  19593. private function lookupInstalledPackage(Pool $pool, Link $link)
  19594. {
  19595. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19596. return !empty($packages) ? $packages[0] : null;
  19597. }
  19598. private function getInstallPath(PackageInterface $package, $global = false)
  19599. {
  19600. if (!$global) {
  19601. return $this->composer->getInstallationManager()->getInstallPath($package);
  19602. }
  19603. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19604. }
  19605. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19606. {
  19607. if (!($plugin instanceof Capable)) {
  19608. return null;
  19609. }
  19610. $capabilities = (array) $plugin->getCapabilities();
  19611. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19612. return trim($capabilities[$capability]);
  19613. }
  19614. if (
  19615. array_key_exists($capability, $capabilities)
  19616. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19617. ) {
  19618. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19619. }
  19620. }
  19621. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19622. {
  19623. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19624. if (!class_exists($capabilityClass)) {
  19625. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19626. }
  19627. $ctorArgs['plugin'] = $plugin;
  19628. $capabilityObj = new $capabilityClass($ctorArgs);
  19629. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19630. throw new \RuntimeException(
  19631. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19632. );
  19633. }
  19634. return $capabilityObj;
  19635. }
  19636. }
  19637. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19638. {
  19639. $capabilities = array();
  19640. foreach ($this->getPlugins() as $plugin) {
  19641. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19642. $capabilities[] = $capability;
  19643. }
  19644. }
  19645. return $capabilities;
  19646. }
  19647. }
  19648. <?php
  19649. namespace Composer\Plugin;
  19650. use Composer\EventDispatcher\Event;
  19651. use Symfony\Component\Console\Input\InputInterface;
  19652. class PreCommandRunEvent extends Event
  19653. {
  19654. private $input;
  19655. private $command;
  19656. public function __construct($name, InputInterface $input, $command)
  19657. {
  19658. parent::__construct($name);
  19659. $this->input = $input;
  19660. $this->command = $command;
  19661. }
  19662. public function getInput()
  19663. {
  19664. return $this->input;
  19665. }
  19666. public function getCommand()
  19667. {
  19668. return $this->command;
  19669. }
  19670. }
  19671. <?php
  19672. namespace Composer\Plugin;
  19673. use Composer\EventDispatcher\Event;
  19674. use Composer\Util\RemoteFilesystem;
  19675. class PreFileDownloadEvent extends Event
  19676. {
  19677. private $rfs;
  19678. private $processedUrl;
  19679. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19680. {
  19681. parent::__construct($name);
  19682. $this->rfs = $rfs;
  19683. $this->processedUrl = $processedUrl;
  19684. }
  19685. public function getRemoteFilesystem()
  19686. {
  19687. return $this->rfs;
  19688. }
  19689. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19690. {
  19691. $this->rfs = $rfs;
  19692. }
  19693. public function getProcessedUrl()
  19694. {
  19695. return $this->processedUrl;
  19696. }
  19697. }
  19698. <?php
  19699. namespace Composer\Question;
  19700. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19701. use Symfony\Component\Console\Question\Question;
  19702. class StrictConfirmationQuestion extends Question
  19703. {
  19704. private $trueAnswerRegex;
  19705. private $falseAnswerRegex;
  19706. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19707. {
  19708. parent::__construct($question, (bool) $default);
  19709. $this->trueAnswerRegex = $trueAnswerRegex;
  19710. $this->falseAnswerRegex = $falseAnswerRegex;
  19711. $this->setNormalizer($this->getDefaultNormalizer());
  19712. $this->setValidator($this->getDefaultValidator());
  19713. }
  19714. private function getDefaultNormalizer()
  19715. {
  19716. $default = $this->getDefault();
  19717. $trueRegex = $this->trueAnswerRegex;
  19718. $falseRegex = $this->falseAnswerRegex;
  19719. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19720. if (is_bool($answer)) {
  19721. return $answer;
  19722. }
  19723. if (empty($answer) && !empty($default)) {
  19724. return $default;
  19725. }
  19726. if (preg_match($trueRegex, $answer)) {
  19727. return true;
  19728. }
  19729. if (preg_match($falseRegex, $answer)) {
  19730. return false;
  19731. }
  19732. return null;
  19733. };
  19734. }
  19735. private function getDefaultValidator()
  19736. {
  19737. return function ($answer) {
  19738. if (!is_bool($answer)) {
  19739. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19740. }
  19741. return $answer;
  19742. };
  19743. }
  19744. }
  19745. <?php
  19746. namespace Composer\Repository;
  19747. use Composer\Package\AliasPackage;
  19748. use Composer\Package\PackageInterface;
  19749. use Composer\Package\CompletePackageInterface;
  19750. use Composer\Package\Version\VersionParser;
  19751. use Composer\Semver\Constraint\ConstraintInterface;
  19752. use Composer\Semver\Constraint\Constraint;
  19753. class ArrayRepository extends BaseRepository
  19754. {
  19755. protected $packages;
  19756. public function __construct(array $packages = array())
  19757. {
  19758. foreach ($packages as $package) {
  19759. $this->addPackage($package);
  19760. }
  19761. }
  19762. public function findPackage($name, $constraint)
  19763. {
  19764. $name = strtolower($name);
  19765. if (!$constraint instanceof ConstraintInterface) {
  19766. $versionParser = new VersionParser();
  19767. $constraint = $versionParser->parseConstraints($constraint);
  19768. }
  19769. foreach ($this->getPackages() as $package) {
  19770. if ($name === $package->getName()) {
  19771. $pkgConstraint = new Constraint('==', $package->getVersion());
  19772. if ($constraint->matches($pkgConstraint)) {
  19773. return $package;
  19774. }
  19775. }
  19776. }
  19777. return null;
  19778. }
  19779. public function findPackages($name, $constraint = null)
  19780. {
  19781. $name = strtolower($name);
  19782. $packages = array();
  19783. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19784. $versionParser = new VersionParser();
  19785. $constraint = $versionParser->parseConstraints($constraint);
  19786. }
  19787. foreach ($this->getPackages() as $package) {
  19788. if ($name === $package->getName()) {
  19789. $pkgConstraint = new Constraint('==', $package->getVersion());
  19790. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19791. $packages[] = $package;
  19792. }
  19793. }
  19794. }
  19795. return $packages;
  19796. }
  19797. public function search($query, $mode = 0, $type = null)
  19798. {
  19799. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19800. $matches = array();
  19801. foreach ($this->getPackages() as $package) {
  19802. $name = $package->getName();
  19803. if (isset($matches[$name])) {
  19804. continue;
  19805. }
  19806. if (preg_match($regex, $name)
  19807. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19808. ) {
  19809. if (null !== $type && $package->getType() !== $type) {
  19810. continue;
  19811. }
  19812. $matches[$name] = array(
  19813. 'name' => $package->getPrettyName(),
  19814. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19815. );
  19816. }
  19817. }
  19818. return array_values($matches);
  19819. }
  19820. public function hasPackage(PackageInterface $package)
  19821. {
  19822. $packageId = $package->getUniqueName();
  19823. foreach ($this->getPackages() as $repoPackage) {
  19824. if ($packageId === $repoPackage->getUniqueName()) {
  19825. return true;
  19826. }
  19827. }
  19828. return false;
  19829. }
  19830. public function addPackage(PackageInterface $package)
  19831. {
  19832. if (null === $this->packages) {
  19833. $this->initialize();
  19834. }
  19835. $package->setRepository($this);
  19836. $this->packages[] = $package;
  19837. if ($package instanceof AliasPackage) {
  19838. $aliasedPackage = $package->getAliasOf();
  19839. if (null === $aliasedPackage->getRepository()) {
  19840. $this->addPackage($aliasedPackage);
  19841. }
  19842. }
  19843. }
  19844. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19845. {
  19846. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19847. }
  19848. public function removePackage(PackageInterface $package)
  19849. {
  19850. $packageId = $package->getUniqueName();
  19851. foreach ($this->getPackages() as $key => $repoPackage) {
  19852. if ($packageId === $repoPackage->getUniqueName()) {
  19853. array_splice($this->packages, $key, 1);
  19854. return;
  19855. }
  19856. }
  19857. }
  19858. public function getPackages()
  19859. {
  19860. if (null === $this->packages) {
  19861. $this->initialize();
  19862. }
  19863. return $this->packages;
  19864. }
  19865. public function count()
  19866. {
  19867. return count($this->packages);
  19868. }
  19869. protected function initialize()
  19870. {
  19871. $this->packages = array();
  19872. }
  19873. }
  19874. <?php
  19875. namespace Composer\Repository;
  19876. use Composer\IO\IOInterface;
  19877. use Composer\Json\JsonFile;
  19878. use Composer\Package\Loader\ArrayLoader;
  19879. use Composer\Package\Loader\LoaderInterface;
  19880. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19881. {
  19882. protected $loader;
  19883. protected $lookup;
  19884. protected $repoConfig;
  19885. private $io;
  19886. public function __construct(array $repoConfig, IOInterface $io)
  19887. {
  19888. parent::__construct();
  19889. if (!extension_loaded('zip')) {
  19890. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19891. }
  19892. $this->loader = new ArrayLoader();
  19893. $this->lookup = $repoConfig['url'];
  19894. $this->io = $io;
  19895. $this->repoConfig = $repoConfig;
  19896. }
  19897. public function getRepoConfig()
  19898. {
  19899. return $this->repoConfig;
  19900. }
  19901. protected function initialize()
  19902. {
  19903. parent::initialize();
  19904. $this->scanDirectory($this->lookup);
  19905. }
  19906. private function scanDirectory($path)
  19907. {
  19908. $io = $this->io;
  19909. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19910. $iterator = new \RecursiveIteratorIterator($directory);
  19911. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19912. foreach ($regex as $file) {
  19913. if (!$file->isFile()) {
  19914. continue;
  19915. }
  19916. $package = $this->getComposerInformation($file);
  19917. if (!$package) {
  19918. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19919. continue;
  19920. }
  19921. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19922. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19923. $this->addPackage($package);
  19924. }
  19925. }
  19926. private function locateFile(\ZipArchive $zip, $filename)
  19927. {
  19928. $indexOfShortestMatch = false;
  19929. $lengthOfShortestMatch = -1;
  19930. for ($i = 0; $i < $zip->numFiles; $i++) {
  19931. $stat = $zip->statIndex($i);
  19932. if (strcmp(basename($stat['name']), $filename) === 0) {
  19933. $directoryName = dirname($stat['name']);
  19934. if ($directoryName == '.') {
  19935. return $i;
  19936. }
  19937. if (strpos($directoryName, '\\') !== false ||
  19938. strpos($directoryName, '/') !== false) {
  19939. continue;
  19940. }
  19941. $length = strlen($stat['name']);
  19942. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19943. $contents = $zip->getFromIndex($i);
  19944. if ($contents !== false) {
  19945. $indexOfShortestMatch = $i;
  19946. $lengthOfShortestMatch = $length;
  19947. }
  19948. }
  19949. }
  19950. }
  19951. return $indexOfShortestMatch;
  19952. }
  19953. private function getComposerInformation(\SplFileInfo $file)
  19954. {
  19955. $zip = new \ZipArchive();
  19956. if ($zip->open($file->getPathname()) !== true) {
  19957. return false;
  19958. }
  19959. if (0 == $zip->numFiles) {
  19960. $zip->close();
  19961. return false;
  19962. }
  19963. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19964. if (false === $foundFileIndex) {
  19965. $zip->close();
  19966. return false;
  19967. }
  19968. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19969. $zip->close();
  19970. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19971. $json = file_get_contents($composerFile);
  19972. $package = JsonFile::parseJson($json, $composerFile);
  19973. $package['dist'] = array(
  19974. 'type' => 'zip',
  19975. 'url' => strtr($file->getPathname(), '\\', '/'),
  19976. 'shasum' => sha1_file($file->getRealPath()),
  19977. );
  19978. try {
  19979. $package = $this->loader->load($package);
  19980. } catch (\UnexpectedValueException $e) {
  19981. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19982. }
  19983. return $package;
  19984. }
  19985. }
  19986. <?php
  19987. namespace Composer\Repository;
  19988. use Composer\Package\RootPackageInterface;
  19989. use Composer\Semver\Constraint\ConstraintInterface;
  19990. use Composer\Semver\Constraint\Constraint;
  19991. use Composer\Package\Link;
  19992. abstract class BaseRepository implements RepositoryInterface
  19993. {
  19994. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19995. {
  19996. $needles = array_map('strtolower', (array) $needle);
  19997. $results = array();
  19998. if (null === $packagesFound) {
  19999. $packagesFound = $needles;
  20000. }
  20001. $rootPackage = null;
  20002. foreach ($this->getPackages() as $package) {
  20003. if ($package instanceof RootPackageInterface) {
  20004. $rootPackage = $package;
  20005. break;
  20006. }
  20007. }
  20008. foreach ($this->getPackages() as $package) {
  20009. $links = $package->getRequires();
  20010. $packagesInTree = $packagesFound;
  20011. if (!$invert) {
  20012. $links += $package->getReplaces();
  20013. }
  20014. if ($package instanceof RootPackageInterface) {
  20015. $links += $package->getDevRequires();
  20016. }
  20017. foreach ($links as $link) {
  20018. foreach ($needles as $needle) {
  20019. if ($link->getTarget() === $needle) {
  20020. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20021. if (in_array($link->getSource(), $packagesInTree)) {
  20022. $results[$link->getSource()] = array($package, $link, false);
  20023. continue;
  20024. }
  20025. $packagesInTree[] = $link->getSource();
  20026. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20027. $results[$link->getSource()] = array($package, $link, $dependents);
  20028. }
  20029. }
  20030. }
  20031. }
  20032. if ($invert && in_array($package->getName(), $needles)) {
  20033. foreach ($package->getConflicts() as $link) {
  20034. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20035. $version = new Constraint('=', $pkg->getVersion());
  20036. if ($link->getConstraint()->matches($version) === $invert) {
  20037. $results[] = array($package, $link, false);
  20038. }
  20039. }
  20040. }
  20041. }
  20042. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  20043. foreach ($package->getRequires() as $link) {
  20044. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  20045. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  20046. continue;
  20047. }
  20048. $platformPkg = $this->findPackage($link->getTarget(), '*');
  20049. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  20050. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  20051. continue;
  20052. }
  20053. foreach ($this->getPackages() as $pkg) {
  20054. if (!in_array($link->getTarget(), $pkg->getNames())) {
  20055. continue;
  20056. }
  20057. $version = new Constraint('=', $pkg->getVersion());
  20058. if (!$link->getConstraint()->matches($version)) {
  20059. if ($rootPackage) {
  20060. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  20061. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  20062. $results[] = array($package, $link, false);
  20063. $results[] = array($rootPackage, $rootReq, false);
  20064. continue 3;
  20065. }
  20066. }
  20067. $results[] = array($package, $link, false);
  20068. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  20069. } else {
  20070. $results[] = array($package, $link, false);
  20071. }
  20072. }
  20073. continue 2;
  20074. }
  20075. }
  20076. }
  20077. }
  20078. ksort($results);
  20079. return $results;
  20080. }
  20081. }
  20082. <?php
  20083. namespace Composer\Repository;
  20084. use Composer\Package\Loader\ArrayLoader;
  20085. use Composer\Package\PackageInterface;
  20086. use Composer\Package\AliasPackage;
  20087. use Composer\Package\Version\VersionParser;
  20088. use Composer\DependencyResolver\Pool;
  20089. use Composer\Json\JsonFile;
  20090. use Composer\Cache;
  20091. use Composer\Config;
  20092. use Composer\Factory;
  20093. use Composer\IO\IOInterface;
  20094. use Composer\Util\RemoteFilesystem;
  20095. use Composer\Plugin\PluginEvents;
  20096. use Composer\Plugin\PreFileDownloadEvent;
  20097. use Composer\EventDispatcher\EventDispatcher;
  20098. use Composer\Downloader\TransportException;
  20099. use Composer\Semver\Constraint\ConstraintInterface;
  20100. use Composer\Semver\Constraint\Constraint;
  20101. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20102. {
  20103. protected $config;
  20104. protected $repoConfig;
  20105. protected $options;
  20106. protected $url;
  20107. protected $baseUrl;
  20108. protected $io;
  20109. protected $rfs;
  20110. protected $cache;
  20111. protected $notifyUrl;
  20112. protected $searchUrl;
  20113. protected $hasProviders = false;
  20114. protected $providersUrl;
  20115. protected $lazyProvidersUrl;
  20116. protected $providerListing;
  20117. protected $providers = array();
  20118. protected $providersByUid = array();
  20119. protected $loader;
  20120. protected $rootAliases;
  20121. protected $allowSslDowngrade = false;
  20122. protected $eventDispatcher;
  20123. protected $sourceMirrors;
  20124. protected $distMirrors;
  20125. private $degradedMode = false;
  20126. private $rootData;
  20127. private $hasPartialPackages;
  20128. private $partialPackagesByName;
  20129. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20130. {
  20131. parent::__construct();
  20132. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  20133. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20134. }
  20135. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  20136. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  20137. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  20138. }
  20139. $urlBits = parse_url($repoConfig['url']);
  20140. if ($urlBits === false || empty($urlBits['scheme'])) {
  20141. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  20142. }
  20143. if (!isset($repoConfig['options'])) {
  20144. $repoConfig['options'] = array();
  20145. }
  20146. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  20147. $this->allowSslDowngrade = true;
  20148. }
  20149. $this->config = $config;
  20150. $this->options = $repoConfig['options'];
  20151. $this->url = $repoConfig['url'];
  20152. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  20153. $this->url = $match['proto'].'://repo.packagist.org';
  20154. }
  20155. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  20156. $this->io = $io;
  20157. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  20158. $this->loader = new ArrayLoader();
  20159. if ($rfs && $this->options) {
  20160. $rfs = clone $rfs;
  20161. $rfs->setOptions($this->options);
  20162. }
  20163. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  20164. $this->eventDispatcher = $eventDispatcher;
  20165. $this->repoConfig = $repoConfig;
  20166. }
  20167. public function getRepoConfig()
  20168. {
  20169. return $this->repoConfig;
  20170. }
  20171. public function setRootAliases(array $rootAliases)
  20172. {
  20173. $this->rootAliases = $rootAliases;
  20174. }
  20175. public function findPackage($name, $constraint)
  20176. {
  20177. if (!$this->hasProviders()) {
  20178. return parent::findPackage($name, $constraint);
  20179. }
  20180. $name = strtolower($name);
  20181. if (!$constraint instanceof ConstraintInterface) {
  20182. $versionParser = new VersionParser();
  20183. $constraint = $versionParser->parseConstraints($constraint);
  20184. }
  20185. foreach ($this->getProviderNames() as $providerName) {
  20186. if ($name === $providerName) {
  20187. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  20188. foreach ($packages as $package) {
  20189. if ($name === $package->getName()) {
  20190. $pkgConstraint = new Constraint('==', $package->getVersion());
  20191. if ($constraint->matches($pkgConstraint)) {
  20192. return $package;
  20193. }
  20194. }
  20195. }
  20196. break;
  20197. }
  20198. }
  20199. }
  20200. public function findPackages($name, $constraint = null)
  20201. {
  20202. if (!$this->hasProviders()) {
  20203. return parent::findPackages($name, $constraint);
  20204. }
  20205. $name = strtolower($name);
  20206. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20207. $versionParser = new VersionParser();
  20208. $constraint = $versionParser->parseConstraints($constraint);
  20209. }
  20210. $packages = array();
  20211. foreach ($this->getProviderNames() as $providerName) {
  20212. if ($name === $providerName) {
  20213. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  20214. foreach ($candidates as $package) {
  20215. if ($name === $package->getName()) {
  20216. $pkgConstraint = new Constraint('==', $package->getVersion());
  20217. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20218. $packages[] = $package;
  20219. }
  20220. }
  20221. }
  20222. break;
  20223. }
  20224. }
  20225. return $packages;
  20226. }
  20227. public function getPackages()
  20228. {
  20229. if ($this->hasProviders()) {
  20230. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20231. }
  20232. return parent::getPackages();
  20233. }
  20234. public function search($query, $mode = 0, $type = null)
  20235. {
  20236. $this->loadRootServerFile();
  20237. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20238. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20239. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  20240. $json = $this->rfs->getContents($hostname, $url, false);
  20241. $search = JsonFile::parseJson($json, $url);
  20242. if (empty($search['results'])) {
  20243. return array();
  20244. }
  20245. $results = array();
  20246. foreach ($search['results'] as $result) {
  20247. if (empty($result['virtual'])) {
  20248. $results[] = $result;
  20249. }
  20250. }
  20251. return $results;
  20252. }
  20253. if ($this->hasProviders()) {
  20254. $results = array();
  20255. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20256. foreach ($this->getProviderNames() as $name) {
  20257. if (preg_match($regex, $name)) {
  20258. $results[] = array('name' => $name);
  20259. }
  20260. }
  20261. return $results;
  20262. }
  20263. return parent::search($query, $mode);
  20264. }
  20265. public function getProviderNames()
  20266. {
  20267. $this->loadRootServerFile();
  20268. if (null === $this->providerListing) {
  20269. $this->loadProviderListings($this->loadRootServerFile());
  20270. }
  20271. if ($this->lazyProvidersUrl) {
  20272. return array();
  20273. }
  20274. if ($this->providersUrl) {
  20275. return array_keys($this->providerListing);
  20276. }
  20277. return array();
  20278. }
  20279. protected function configurePackageTransportOptions(PackageInterface $package)
  20280. {
  20281. foreach ($package->getDistUrls() as $url) {
  20282. if (strpos($url, $this->baseUrl) === 0) {
  20283. $package->setTransportOptions($this->options);
  20284. return;
  20285. }
  20286. }
  20287. }
  20288. public function hasProviders()
  20289. {
  20290. $this->loadRootServerFile();
  20291. return $this->hasProviders;
  20292. }
  20293. public function resetPackageIds()
  20294. {
  20295. foreach ($this->providersByUid as $package) {
  20296. if ($package instanceof AliasPackage) {
  20297. $package->getAliasOf()->setId(-1);
  20298. }
  20299. $package->setId(-1);
  20300. }
  20301. }
  20302. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20303. {
  20304. if (isset($this->providers[$name]) && !$bypassFilters) {
  20305. return $this->providers[$name];
  20306. }
  20307. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20308. $this->initializePartialPackages();
  20309. }
  20310. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20311. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20312. return array();
  20313. }
  20314. if (null === $this->providerListing) {
  20315. $this->loadProviderListings($this->loadRootServerFile());
  20316. }
  20317. $useLastModifiedCheck = false;
  20318. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20319. $hash = null;
  20320. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20321. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20322. $useLastModifiedCheck = true;
  20323. } elseif ($this->providersUrl) {
  20324. if (!isset($this->providerListing[$name])) {
  20325. return array();
  20326. }
  20327. $hash = $this->providerListing[$name]['sha256'];
  20328. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20329. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20330. } else {
  20331. return array();
  20332. }
  20333. $packages = null;
  20334. if ($cacheKey) {
  20335. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20336. $packages = json_decode($this->cache->read($cacheKey), true);
  20337. } elseif ($useLastModifiedCheck) {
  20338. if ($contents = $this->cache->read($cacheKey)) {
  20339. $contents = json_decode($contents, true);
  20340. if (isset($contents['last-modified'])) {
  20341. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20342. if (true === $response) {
  20343. $packages = $contents;
  20344. } elseif ($response) {
  20345. $packages = $response;
  20346. }
  20347. }
  20348. }
  20349. }
  20350. }
  20351. if (!$packages) {
  20352. try {
  20353. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20354. } catch (TransportException $e) {
  20355. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20356. $packages = array('packages' => array());
  20357. } else {
  20358. throw $e;
  20359. }
  20360. }
  20361. }
  20362. $loadingPartialPackage = false;
  20363. } else {
  20364. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20365. $loadingPartialPackage = true;
  20366. }
  20367. $this->providers[$name] = array();
  20368. foreach ($packages['packages'] as $versions) {
  20369. foreach ($versions as $version) {
  20370. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20371. continue;
  20372. }
  20373. if (isset($this->providersByUid[$version['uid']])) {
  20374. if (!isset($this->providers[$name][$version['uid']])) {
  20375. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20376. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20377. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20378. } else {
  20379. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20380. }
  20381. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20382. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20383. }
  20384. }
  20385. } else {
  20386. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20387. continue;
  20388. }
  20389. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20390. $package->setRepository($this);
  20391. if ($package instanceof AliasPackage) {
  20392. $aliased = $package->getAliasOf();
  20393. $aliased->setRepository($this);
  20394. $this->providers[$name][$version['uid']] = $aliased;
  20395. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20396. $this->providersByUid[$version['uid']] = $package;
  20397. } else {
  20398. $this->providers[$name][$version['uid']] = $package;
  20399. $this->providersByUid[$version['uid']] = $package;
  20400. }
  20401. unset($rootAliasData);
  20402. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20403. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20404. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20405. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20406. }
  20407. if (isset($rootAliasData)) {
  20408. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20409. $alias->setRepository($this);
  20410. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20411. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20412. }
  20413. }
  20414. }
  20415. }
  20416. $result = $this->providers[$name];
  20417. if ($bypassFilters) {
  20418. foreach ($this->providers[$name] as $uid => $provider) {
  20419. unset($this->providersByUid[$uid]);
  20420. }
  20421. unset($this->providers[$name]);
  20422. }
  20423. return $result;
  20424. }
  20425. protected function initialize()
  20426. {
  20427. parent::initialize();
  20428. $repoData = $this->loadDataFromServer();
  20429. foreach ($repoData as $package) {
  20430. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20431. }
  20432. }
  20433. public function addPackage(PackageInterface $package)
  20434. {
  20435. parent::addPackage($package);
  20436. $this->configurePackageTransportOptions($package);
  20437. }
  20438. protected function loadRootServerFile()
  20439. {
  20440. if (null !== $this->rootData) {
  20441. return $this->rootData;
  20442. }
  20443. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20444. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20445. }
  20446. $jsonUrlParts = parse_url($this->url);
  20447. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20448. $jsonUrl = $this->url;
  20449. } else {
  20450. $jsonUrl = $this->url . '/packages.json';
  20451. }
  20452. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20453. if (!empty($data['notify-batch'])) {
  20454. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20455. } elseif (!empty($data['notify'])) {
  20456. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20457. }
  20458. if (!empty($data['search'])) {
  20459. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20460. }
  20461. if (!empty($data['mirrors'])) {
  20462. foreach ($data['mirrors'] as $mirror) {
  20463. if (!empty($mirror['git-url'])) {
  20464. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20465. }
  20466. if (!empty($mirror['hg-url'])) {
  20467. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20468. }
  20469. if (!empty($mirror['dist-url'])) {
  20470. $this->distMirrors[] = array(
  20471. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20472. 'preferred' => !empty($mirror['preferred']),
  20473. );
  20474. }
  20475. }
  20476. }
  20477. if (!empty($data['providers-lazy-url'])) {
  20478. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20479. $this->hasProviders = true;
  20480. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20481. }
  20482. if ($this->allowSslDowngrade) {
  20483. $this->url = str_replace('https://', 'http://', $this->url);
  20484. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20485. }
  20486. if (!empty($data['providers-url'])) {
  20487. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20488. $this->hasProviders = true;
  20489. }
  20490. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20491. $this->hasProviders = true;
  20492. }
  20493. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20494. $this->url = 'https://repo.packagist.org';
  20495. $this->baseUrl = 'https://repo.packagist.org';
  20496. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20497. $this->providersUrl = null;
  20498. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20499. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20500. $this->providersUrl = null;
  20501. }
  20502. return $this->rootData = $data;
  20503. }
  20504. protected function canonicalizeUrl($url)
  20505. {
  20506. if ('/' === $url[0]) {
  20507. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  20508. }
  20509. return $url;
  20510. }
  20511. protected function loadDataFromServer()
  20512. {
  20513. $data = $this->loadRootServerFile();
  20514. return $this->loadIncludes($data);
  20515. }
  20516. protected function loadProviderListings($data)
  20517. {
  20518. if (isset($data['providers'])) {
  20519. if (!is_array($this->providerListing)) {
  20520. $this->providerListing = array();
  20521. }
  20522. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20523. }
  20524. if ($this->providersUrl && isset($data['provider-includes'])) {
  20525. $includes = $data['provider-includes'];
  20526. foreach ($includes as $include => $metadata) {
  20527. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20528. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20529. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20530. $includedData = json_decode($this->cache->read($cacheKey), true);
  20531. } else {
  20532. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20533. }
  20534. $this->loadProviderListings($includedData);
  20535. }
  20536. }
  20537. }
  20538. protected function loadIncludes($data)
  20539. {
  20540. $packages = array();
  20541. if (!isset($data['packages']) && !isset($data['includes'])) {
  20542. foreach ($data as $pkg) {
  20543. foreach ($pkg['versions'] as $metadata) {
  20544. $packages[] = $metadata;
  20545. }
  20546. }
  20547. return $packages;
  20548. }
  20549. if (isset($data['packages'])) {
  20550. foreach ($data['packages'] as $package => $versions) {
  20551. foreach ($versions as $version => $metadata) {
  20552. $packages[] = $metadata;
  20553. }
  20554. }
  20555. }
  20556. if (isset($data['includes'])) {
  20557. foreach ($data['includes'] as $include => $metadata) {
  20558. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20559. $includedData = json_decode($this->cache->read($include), true);
  20560. } else {
  20561. $includedData = $this->fetchFile($include);
  20562. }
  20563. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20564. }
  20565. }
  20566. return $packages;
  20567. }
  20568. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20569. {
  20570. try {
  20571. if (!isset($data['notification-url'])) {
  20572. $data['notification-url'] = $this->notifyUrl;
  20573. }
  20574. $package = $this->loader->load($data, $class);
  20575. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20576. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20577. }
  20578. $package->setDistMirrors($this->distMirrors);
  20579. $this->configurePackageTransportOptions($package);
  20580. return $package;
  20581. } catch (\Exception $e) {
  20582. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  20583. }
  20584. }
  20585. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20586. {
  20587. if (null === $cacheKey) {
  20588. $cacheKey = $filename;
  20589. $filename = $this->baseUrl.'/'.$filename;
  20590. }
  20591. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20592. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20593. }
  20594. $retries = 3;
  20595. while ($retries--) {
  20596. try {
  20597. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20598. if ($this->eventDispatcher) {
  20599. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20600. }
  20601. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20602. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20603. $json = $rfs->getContents($hostname, $filename, false);
  20604. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20605. if ($this->allowSslDowngrade) {
  20606. $this->url = str_replace('http://', 'https://', $this->url);
  20607. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20608. $filename = str_replace('http://', 'https://', $filename);
  20609. }
  20610. if ($retries) {
  20611. usleep(100000);
  20612. continue;
  20613. }
  20614. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  20615. }
  20616. $data = JsonFile::parseJson($json, $filename);
  20617. if (!empty($data['warning'])) {
  20618. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20619. }
  20620. if (!empty($data['info'])) {
  20621. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20622. }
  20623. if ($cacheKey) {
  20624. if ($storeLastModifiedTime) {
  20625. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20626. if ($lastModifiedDate) {
  20627. $data['last-modified'] = $lastModifiedDate;
  20628. $json = json_encode($data);
  20629. }
  20630. }
  20631. $this->cache->write($cacheKey, $json);
  20632. }
  20633. break;
  20634. } catch (\Exception $e) {
  20635. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20636. throw $e;
  20637. }
  20638. if ($retries) {
  20639. usleep(100000);
  20640. continue;
  20641. }
  20642. if ($e instanceof RepositorySecurityException) {
  20643. throw $e;
  20644. }
  20645. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20646. if (!$this->degradedMode) {
  20647. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20648. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20649. }
  20650. $this->degradedMode = true;
  20651. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20652. break;
  20653. }
  20654. throw $e;
  20655. }
  20656. }
  20657. return $data;
  20658. }
  20659. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20660. {
  20661. $retries = 3;
  20662. while ($retries--) {
  20663. try {
  20664. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20665. if ($this->eventDispatcher) {
  20666. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20667. }
  20668. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20669. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20670. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20671. $json = $rfs->getContents($hostname, $filename, false, $options);
  20672. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20673. return true;
  20674. }
  20675. $data = JsonFile::parseJson($json, $filename);
  20676. if (!empty($data['warning'])) {
  20677. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20678. }
  20679. if (!empty($data['info'])) {
  20680. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20681. }
  20682. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20683. if ($lastModifiedDate) {
  20684. $data['last-modified'] = $lastModifiedDate;
  20685. $json = json_encode($data);
  20686. }
  20687. $this->cache->write($cacheKey, $json);
  20688. return $data;
  20689. } catch (\Exception $e) {
  20690. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20691. throw $e;
  20692. }
  20693. if ($retries) {
  20694. usleep(100000);
  20695. continue;
  20696. }
  20697. if (!$this->degradedMode) {
  20698. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20699. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20700. }
  20701. $this->degradedMode = true;
  20702. return true;
  20703. }
  20704. }
  20705. }
  20706. private function initializePartialPackages()
  20707. {
  20708. $rootData = $this->loadRootServerFile();
  20709. $this->partialPackagesByName = array();
  20710. foreach ($rootData['packages'] as $package => $versions) {
  20711. $package = strtolower($package);
  20712. foreach ($versions as $version) {
  20713. $this->partialPackagesByName[$package][] = $version;
  20714. if (!empty($version['provide']) && is_array($version['provide'])) {
  20715. foreach ($version['provide'] as $provided => $providedVersion) {
  20716. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20717. }
  20718. }
  20719. if (!empty($version['replace']) && is_array($version['replace'])) {
  20720. foreach ($version['replace'] as $provided => $providedVersion) {
  20721. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20722. }
  20723. }
  20724. }
  20725. }
  20726. $this->rootData = true;
  20727. }
  20728. }
  20729. <?php
  20730. namespace Composer\Repository;
  20731. use Composer\Package\PackageInterface;
  20732. class CompositeRepository extends BaseRepository
  20733. {
  20734. private $repositories;
  20735. public function __construct(array $repositories)
  20736. {
  20737. $this->repositories = array();
  20738. foreach ($repositories as $repo) {
  20739. $this->addRepository($repo);
  20740. }
  20741. }
  20742. public function getRepositories()
  20743. {
  20744. return $this->repositories;
  20745. }
  20746. public function hasPackage(PackageInterface $package)
  20747. {
  20748. foreach ($this->repositories as $repository) {
  20749. if ($repository->hasPackage($package)) {
  20750. return true;
  20751. }
  20752. }
  20753. return false;
  20754. }
  20755. public function findPackage($name, $constraint)
  20756. {
  20757. foreach ($this->repositories as $repository) {
  20758. $package = $repository->findPackage($name, $constraint);
  20759. if (null !== $package) {
  20760. return $package;
  20761. }
  20762. }
  20763. return null;
  20764. }
  20765. public function findPackages($name, $constraint = null)
  20766. {
  20767. $packages = array();
  20768. foreach ($this->repositories as $repository) {
  20769. $packages[] = $repository->findPackages($name, $constraint);
  20770. }
  20771. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20772. }
  20773. public function search($query, $mode = 0, $type = null)
  20774. {
  20775. $matches = array();
  20776. foreach ($this->repositories as $repository) {
  20777. $matches[] = $repository->search($query, $mode, $type);
  20778. }
  20779. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20780. }
  20781. public function getPackages()
  20782. {
  20783. $packages = array();
  20784. foreach ($this->repositories as $repository) {
  20785. $packages[] = $repository->getPackages();
  20786. }
  20787. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20788. }
  20789. public function removePackage(PackageInterface $package)
  20790. {
  20791. foreach ($this->repositories as $repository) {
  20792. $repository->removePackage($package);
  20793. }
  20794. }
  20795. public function count()
  20796. {
  20797. $total = 0;
  20798. foreach ($this->repositories as $repository) {
  20799. $total += $repository->count();
  20800. }
  20801. return $total;
  20802. }
  20803. public function addRepository(RepositoryInterface $repository)
  20804. {
  20805. if ($repository instanceof self) {
  20806. foreach ($repository->getRepositories() as $repo) {
  20807. $this->addRepository($repo);
  20808. }
  20809. } else {
  20810. $this->repositories[] = $repository;
  20811. }
  20812. }
  20813. }
  20814. <?php
  20815. namespace Composer\Repository;
  20816. interface ConfigurableRepositoryInterface
  20817. {
  20818. public function getRepoConfig();
  20819. }
  20820. <?php
  20821. namespace Composer\Repository;
  20822. use Composer\Json\JsonFile;
  20823. use Composer\Package\Loader\ArrayLoader;
  20824. use Composer\Package\Dumper\ArrayDumper;
  20825. class FilesystemRepository extends WritableArrayRepository
  20826. {
  20827. private $file;
  20828. public function __construct(JsonFile $repositoryFile)
  20829. {
  20830. parent::__construct();
  20831. $this->file = $repositoryFile;
  20832. }
  20833. protected function initialize()
  20834. {
  20835. parent::initialize();
  20836. if (!$this->file->exists()) {
  20837. return;
  20838. }
  20839. try {
  20840. $packages = $this->file->read();
  20841. if (!is_array($packages)) {
  20842. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20843. }
  20844. } catch (\Exception $e) {
  20845. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20846. }
  20847. $loader = new ArrayLoader(null, true);
  20848. foreach ($packages as $packageData) {
  20849. $package = $loader->load($packageData);
  20850. $this->addPackage($package);
  20851. }
  20852. }
  20853. public function reload()
  20854. {
  20855. $this->packages = null;
  20856. $this->initialize();
  20857. }
  20858. public function write()
  20859. {
  20860. $data = array();
  20861. $dumper = new ArrayDumper();
  20862. foreach ($this->getCanonicalPackages() as $package) {
  20863. $data[] = $dumper->dump($package);
  20864. }
  20865. usort($data, function ($a, $b) {
  20866. return strcmp($a['name'], $b['name']);
  20867. });
  20868. $this->file->write($data);
  20869. }
  20870. }
  20871. <?php
  20872. namespace Composer\Repository;
  20873. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20874. {
  20875. }
  20876. <?php
  20877. namespace Composer\Repository;
  20878. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20879. {
  20880. }
  20881. <?php
  20882. namespace Composer\Repository;
  20883. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20884. {
  20885. }
  20886. <?php
  20887. namespace Composer\Repository;
  20888. class InvalidRepositoryException extends \Exception
  20889. {
  20890. }
  20891. <?php
  20892. namespace Composer\Repository;
  20893. use Composer\Package\Loader\ArrayLoader;
  20894. use Composer\Package\Loader\ValidatingArrayLoader;
  20895. class PackageRepository extends ArrayRepository
  20896. {
  20897. private $config;
  20898. public function __construct(array $config)
  20899. {
  20900. parent::__construct();
  20901. $this->config = $config['package'];
  20902. if (!is_numeric(key($this->config))) {
  20903. $this->config = array($this->config);
  20904. }
  20905. }
  20906. protected function initialize()
  20907. {
  20908. parent::initialize();
  20909. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20910. foreach ($this->config as $package) {
  20911. try {
  20912. $package = $loader->load($package);
  20913. } catch (\Exception $e) {
  20914. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20915. }
  20916. $this->addPackage($package);
  20917. }
  20918. }
  20919. }
  20920. <?php
  20921. namespace Composer\Repository;
  20922. use Composer\Config;
  20923. use Composer\IO\IOInterface;
  20924. use Composer\Json\JsonFile;
  20925. use Composer\Package\Loader\ArrayLoader;
  20926. use Composer\Package\Version\VersionGuesser;
  20927. use Composer\Package\Version\VersionParser;
  20928. use Composer\Util\Platform;
  20929. use Composer\Util\ProcessExecutor;
  20930. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20931. {
  20932. private $loader;
  20933. private $versionGuesser;
  20934. private $url;
  20935. private $repoConfig;
  20936. private $process;
  20937. private $options;
  20938. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20939. {
  20940. if (!isset($repoConfig['url'])) {
  20941. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20942. }
  20943. $this->loader = new ArrayLoader(null, true);
  20944. $this->url = Platform::expandPath($repoConfig['url']);
  20945. $this->process = new ProcessExecutor($io);
  20946. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20947. $this->repoConfig = $repoConfig;
  20948. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20949. parent::__construct();
  20950. }
  20951. public function getRepoConfig()
  20952. {
  20953. return $this->repoConfig;
  20954. }
  20955. protected function initialize()
  20956. {
  20957. parent::initialize();
  20958. foreach ($this->getUrlMatches() as $url) {
  20959. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20960. $composerFilePath = $path.'composer.json';
  20961. if (!file_exists($composerFilePath)) {
  20962. continue;
  20963. }
  20964. $json = file_get_contents($composerFilePath);
  20965. $package = JsonFile::parseJson($json, $composerFilePath);
  20966. $package['dist'] = array(
  20967. 'type' => 'path',
  20968. 'url' => $url,
  20969. 'reference' => sha1($json . serialize($this->options)),
  20970. );
  20971. $package['transport-options'] = $this->options;
  20972. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20973. if (
  20974. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20975. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20976. && $ref1 === $ref2
  20977. ) {
  20978. $package['version'] = $rootVersion;
  20979. }
  20980. }
  20981. if (!isset($package['version'])) {
  20982. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20983. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  20984. }
  20985. $output = '';
  20986. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20987. $package['dist']['reference'] = trim($output);
  20988. }
  20989. $package = $this->loader->load($package);
  20990. $this->addPackage($package);
  20991. }
  20992. }
  20993. private function getUrlMatches()
  20994. {
  20995. $flags = GLOB_MARK | GLOB_ONLYDIR;
  20996. if (defined('GLOB_BRACE')) {
  20997. $flags |= GLOB_BRACE;
  20998. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  20999. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21000. }
  21001. return array_map(function ($val) {
  21002. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21003. }, glob($this->url, $flags));
  21004. }
  21005. }
  21006. <?php
  21007. namespace Composer\Repository\Pear;
  21008. use Composer\Util\RemoteFilesystem;
  21009. abstract class BaseChannelReader
  21010. {
  21011. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  21012. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  21013. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  21014. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  21015. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  21016. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  21017. private $rfs;
  21018. protected function __construct(RemoteFilesystem $rfs)
  21019. {
  21020. $this->rfs = $rfs;
  21021. }
  21022. protected function requestContent($origin, $path)
  21023. {
  21024. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  21025. $content = $this->rfs->getContents($origin, $url, false);
  21026. if (!$content) {
  21027. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  21028. }
  21029. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  21030. }
  21031. protected function requestXml($origin, $path)
  21032. {
  21033. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  21034. if (false === $xml) {
  21035. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  21036. }
  21037. return $xml;
  21038. }
  21039. }
  21040. <?php
  21041. namespace Composer\Repository\Pear;
  21042. class ChannelInfo
  21043. {
  21044. private $name;
  21045. private $alias;
  21046. private $packages;
  21047. public function __construct($name, $alias, array $packages)
  21048. {
  21049. $this->name = $name;
  21050. $this->alias = $alias;
  21051. $this->packages = $packages;
  21052. }
  21053. public function getName()
  21054. {
  21055. return $this->name;
  21056. }
  21057. public function getAlias()
  21058. {
  21059. return $this->alias;
  21060. }
  21061. public function getPackages()
  21062. {
  21063. return $this->packages;
  21064. }
  21065. }
  21066. <?php
  21067. namespace Composer\Repository\Pear;
  21068. use Composer\Util\RemoteFilesystem;
  21069. class ChannelReader extends BaseChannelReader
  21070. {
  21071. private $readerMap;
  21072. public function __construct(RemoteFilesystem $rfs)
  21073. {
  21074. parent::__construct($rfs);
  21075. $rest10reader = new ChannelRest10Reader($rfs);
  21076. $rest11reader = new ChannelRest11Reader($rfs);
  21077. $this->readerMap = array(
  21078. 'REST1.3' => $rest11reader,
  21079. 'REST1.2' => $rest11reader,
  21080. 'REST1.1' => $rest11reader,
  21081. 'REST1.0' => $rest10reader,
  21082. );
  21083. }
  21084. public function read($url)
  21085. {
  21086. $xml = $this->requestXml($url, "/channel.xml");
  21087. $channelName = (string) $xml->name;
  21088. $channelAlias = (string) $xml->suggestedalias;
  21089. $supportedVersions = array_keys($this->readerMap);
  21090. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  21091. if (!$selectedRestVersion) {
  21092. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  21093. }
  21094. $reader = $this->readerMap[$selectedRestVersion['version']];
  21095. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  21096. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  21097. }
  21098. private function selectRestVersion($channelXml, $supportedVersions)
  21099. {
  21100. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  21101. foreach ($supportedVersions as $version) {
  21102. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  21103. $testResult = $channelXml->xpath($xpathTest);
  21104. foreach ($testResult as $result) {
  21105. $result = (string) $result;
  21106. if (preg_match('{^https://}i', $result)) {
  21107. return array('version' => $version, 'baseUrl' => $result);
  21108. }
  21109. }
  21110. if (count($testResult) > 0) {
  21111. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  21112. }
  21113. }
  21114. return null;
  21115. }
  21116. }
  21117. <?php
  21118. namespace Composer\Repository\Pear;
  21119. use Composer\Downloader\TransportException;
  21120. class ChannelRest10Reader extends BaseChannelReader
  21121. {
  21122. private $dependencyReader;
  21123. public function __construct($rfs)
  21124. {
  21125. parent::__construct($rfs);
  21126. $this->dependencyReader = new PackageDependencyParser();
  21127. }
  21128. public function read($baseUrl)
  21129. {
  21130. return $this->readPackages($baseUrl);
  21131. }
  21132. private function readPackages($baseUrl)
  21133. {
  21134. $result = array();
  21135. $xmlPath = '/p/packages.xml';
  21136. $xml = $this->requestXml($baseUrl, $xmlPath);
  21137. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  21138. foreach ($xml->xpath('ns:p') as $node) {
  21139. $packageName = (string) $node;
  21140. $packageInfo = $this->readPackage($baseUrl, $packageName);
  21141. $result[] = $packageInfo;
  21142. }
  21143. return $result;
  21144. }
  21145. private function readPackage($baseUrl, $packageName)
  21146. {
  21147. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  21148. $xml = $this->requestXml($baseUrl, $xmlPath);
  21149. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  21150. $channelName = (string) $xml->c;
  21151. $packageName = (string) $xml->n;
  21152. $license = (string) $xml->l;
  21153. $shortDescription = (string) $xml->s;
  21154. $description = (string) $xml->d;
  21155. return new PackageInfo(
  21156. $channelName,
  21157. $packageName,
  21158. $license,
  21159. $shortDescription,
  21160. $description,
  21161. $this->readPackageReleases($baseUrl, $packageName)
  21162. );
  21163. }
  21164. private function readPackageReleases($baseUrl, $packageName)
  21165. {
  21166. $result = array();
  21167. try {
  21168. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  21169. $xml = $this->requestXml($baseUrl, $xmlPath);
  21170. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  21171. foreach ($xml->xpath('ns:r') as $node) {
  21172. $releaseVersion = (string) $node->v;
  21173. $releaseStability = (string) $node->s;
  21174. try {
  21175. $result[$releaseVersion] = new ReleaseInfo(
  21176. $releaseStability,
  21177. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  21178. );
  21179. } catch (TransportException $exception) {
  21180. if ($exception->getCode() != 404) {
  21181. throw $exception;
  21182. }
  21183. }
  21184. }
  21185. } catch (TransportException $exception) {
  21186. if ($exception->getCode() != 404) {
  21187. throw $exception;
  21188. }
  21189. }
  21190. return $result;
  21191. }
  21192. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  21193. {
  21194. $dependencyReader = new PackageDependencyParser();
  21195. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  21196. $content = $this->requestContent($baseUrl, $depthPath);
  21197. $dependencyArray = unserialize($content);
  21198. return $dependencyReader->buildDependencyInfo($dependencyArray);
  21199. }
  21200. }
  21201. <?php
  21202. namespace Composer\Repository\Pear;
  21203. class ChannelRest11Reader extends BaseChannelReader
  21204. {
  21205. private $dependencyReader;
  21206. public function __construct($rfs)
  21207. {
  21208. parent::__construct($rfs);
  21209. $this->dependencyReader = new PackageDependencyParser();
  21210. }
  21211. public function read($baseUrl)
  21212. {
  21213. return $this->readChannelPackages($baseUrl);
  21214. }
  21215. private function readChannelPackages($baseUrl)
  21216. {
  21217. $result = array();
  21218. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  21219. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  21220. foreach ($xml->xpath('ns:c') as $node) {
  21221. $categoryName = (string) $node;
  21222. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  21223. $result = array_merge($result, $categoryPackages);
  21224. }
  21225. return $result;
  21226. }
  21227. private function readCategoryPackages($baseUrl, $categoryName)
  21228. {
  21229. $result = array();
  21230. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21231. $xml = $this->requestXml($baseUrl, $categoryPath);
  21232. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21233. foreach ($xml->xpath('ns:pi') as $node) {
  21234. $packageInfo = $this->parsePackage($node);
  21235. $result[] = $packageInfo;
  21236. }
  21237. return $result;
  21238. }
  21239. private function parsePackage($packageInfo)
  21240. {
  21241. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21242. $channelName = (string) $packageInfo->p->c;
  21243. $packageName = (string) $packageInfo->p->n;
  21244. $license = (string) $packageInfo->p->l;
  21245. $shortDescription = (string) $packageInfo->p->s;
  21246. $description = (string) $packageInfo->p->d;
  21247. $dependencies = array();
  21248. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21249. $dependencyVersion = (string) $node->v;
  21250. $dependencyArray = unserialize((string) $node->d);
  21251. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21252. $dependencies[$dependencyVersion] = $dependencyInfo;
  21253. }
  21254. $releases = array();
  21255. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21256. if ($releasesInfo) {
  21257. foreach ($releasesInfo as $node) {
  21258. $releaseVersion = (string) $node->v;
  21259. $releaseStability = (string) $node->s;
  21260. $releases[$releaseVersion] = new ReleaseInfo(
  21261. $releaseStability,
  21262. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21263. );
  21264. }
  21265. }
  21266. return new PackageInfo(
  21267. $channelName,
  21268. $packageName,
  21269. $license,
  21270. $shortDescription,
  21271. $description,
  21272. $releases
  21273. );
  21274. }
  21275. }
  21276. <?php
  21277. namespace Composer\Repository\Pear;
  21278. class DependencyConstraint
  21279. {
  21280. private $type;
  21281. private $constraint;
  21282. private $channelName;
  21283. private $packageName;
  21284. public function __construct($type, $constraint, $channelName, $packageName)
  21285. {
  21286. $this->type = $type;
  21287. $this->constraint = $constraint;
  21288. $this->channelName = $channelName;
  21289. $this->packageName = $packageName;
  21290. }
  21291. public function getChannelName()
  21292. {
  21293. return $this->channelName;
  21294. }
  21295. public function getConstraint()
  21296. {
  21297. return $this->constraint;
  21298. }
  21299. public function getPackageName()
  21300. {
  21301. return $this->packageName;
  21302. }
  21303. public function getType()
  21304. {
  21305. return $this->type;
  21306. }
  21307. }
  21308. <?php
  21309. namespace Composer\Repository\Pear;
  21310. class DependencyInfo
  21311. {
  21312. private $requires;
  21313. private $optionals;
  21314. public function __construct($requires, $optionals)
  21315. {
  21316. $this->requires = $requires;
  21317. $this->optionals = $optionals;
  21318. }
  21319. public function getRequires()
  21320. {
  21321. return $this->requires;
  21322. }
  21323. public function getOptionals()
  21324. {
  21325. return $this->optionals;
  21326. }
  21327. }
  21328. <?php
  21329. namespace Composer\Repository\Pear;
  21330. class PackageDependencyParser
  21331. {
  21332. public function buildDependencyInfo($depArray)
  21333. {
  21334. if (!is_array($depArray)) {
  21335. return new DependencyInfo(array(), array());
  21336. }
  21337. if (!$this->isHash($depArray)) {
  21338. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21339. }
  21340. return $this->buildDependency20Info($depArray);
  21341. }
  21342. private function buildDependency10Info($depArray)
  21343. {
  21344. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21345. $result = array();
  21346. foreach ($depArray as $depItem) {
  21347. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21348. continue;
  21349. }
  21350. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21351. ? 'optional'
  21352. : 'required';
  21353. $depType = 'not' == $depItem['rel']
  21354. ? 'conflicts'
  21355. : $depType;
  21356. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21357. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21358. ? '*'
  21359. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21360. switch ($depItem['type']) {
  21361. case 'php':
  21362. $depChannelName = 'php';
  21363. $depPackageName = '';
  21364. break;
  21365. case 'pkg':
  21366. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21367. $depPackageName = $depItem['name'];
  21368. break;
  21369. case 'ext':
  21370. $depChannelName = 'ext';
  21371. $depPackageName = $depItem['name'];
  21372. break;
  21373. case 'os':
  21374. case 'sapi':
  21375. $depChannelName = '';
  21376. $depPackageName = '';
  21377. break;
  21378. default:
  21379. $depChannelName = '';
  21380. $depPackageName = '';
  21381. break;
  21382. }
  21383. if ('' != $depChannelName) {
  21384. $result[] = new DependencyConstraint(
  21385. $depType,
  21386. $depVersionConstraint,
  21387. $depChannelName,
  21388. $depPackageName
  21389. );
  21390. }
  21391. }
  21392. return $result;
  21393. }
  21394. private function buildDependency20Info($depArray)
  21395. {
  21396. $result = array();
  21397. $optionals = array();
  21398. $defaultOptionals = array();
  21399. foreach ($depArray as $depType => $depTypeGroup) {
  21400. if (!is_array($depTypeGroup)) {
  21401. continue;
  21402. }
  21403. if ('required' == $depType || 'optional' == $depType) {
  21404. foreach ($depTypeGroup as $depItemType => $depItem) {
  21405. switch ($depItemType) {
  21406. case 'php':
  21407. $result[] = new DependencyConstraint(
  21408. $depType,
  21409. $this->parse20VersionConstraint($depItem),
  21410. 'php',
  21411. ''
  21412. );
  21413. break;
  21414. case 'package':
  21415. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21416. $result = array_merge($result, $deps);
  21417. break;
  21418. case 'extension':
  21419. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21420. $result = array_merge($result, $deps);
  21421. break;
  21422. case 'subpackage':
  21423. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21424. $defaultOptionals += $deps;
  21425. break;
  21426. case 'os':
  21427. case 'pearinstaller':
  21428. break;
  21429. default:
  21430. break;
  21431. }
  21432. }
  21433. } elseif ('group' == $depType) {
  21434. if ($this->isHash($depTypeGroup)) {
  21435. $depTypeGroup = array($depTypeGroup);
  21436. }
  21437. foreach ($depTypeGroup as $depItem) {
  21438. $groupName = $depItem['attribs']['name'];
  21439. if (!isset($optionals[$groupName])) {
  21440. $optionals[$groupName] = array();
  21441. }
  21442. if (isset($depItem['subpackage'])) {
  21443. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21444. } else {
  21445. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21446. }
  21447. }
  21448. }
  21449. }
  21450. if (count($defaultOptionals) > 0) {
  21451. $optionals['*'] = $defaultOptionals;
  21452. }
  21453. return new DependencyInfo($result, $optionals);
  21454. }
  21455. private function buildDepExtensionConstraints($depItem, $depType)
  21456. {
  21457. if ($this->isHash($depItem)) {
  21458. $depItem = array($depItem);
  21459. }
  21460. $result = array();
  21461. foreach ($depItem as $subDepItem) {
  21462. $depChannelName = 'ext';
  21463. $depPackageName = $subDepItem['name'];
  21464. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21465. $result[] = new DependencyConstraint(
  21466. $depType,
  21467. $depVersionConstraint,
  21468. $depChannelName,
  21469. $depPackageName
  21470. );
  21471. }
  21472. return $result;
  21473. }
  21474. private function buildDepPackageConstraints($depItem, $depType)
  21475. {
  21476. if ($this->isHash($depItem)) {
  21477. $depItem = array($depItem);
  21478. }
  21479. $result = array();
  21480. foreach ($depItem as $subDepItem) {
  21481. if (!array_key_exists('channel', $subDepItem)) {
  21482. $subDepItem['channel'] = $subDepItem['uri'];
  21483. }
  21484. $depChannelName = $subDepItem['channel'];
  21485. $depPackageName = $subDepItem['name'];
  21486. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21487. if (isset($subDepItem['conflicts'])) {
  21488. $depType = 'conflicts';
  21489. }
  21490. $result[] = new DependencyConstraint(
  21491. $depType,
  21492. $depVersionConstraint,
  21493. $depChannelName,
  21494. $depPackageName
  21495. );
  21496. }
  21497. return $result;
  21498. }
  21499. private function parse20VersionConstraint(array $data)
  21500. {
  21501. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21502. $versions = array();
  21503. $values = array_intersect_key($data, $dep20toOperatorMap);
  21504. if (0 == count($values)) {
  21505. return '*';
  21506. }
  21507. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21508. $versions[] = '>' . $this->parseVersion($values['min']);
  21509. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21510. $versions[] = '<' . $this->parseVersion($values['max']);
  21511. } else {
  21512. foreach ($values as $op => $version) {
  21513. if ('exclude' == $op && is_array($version)) {
  21514. foreach ($version as $versionPart) {
  21515. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21516. }
  21517. } else {
  21518. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21519. }
  21520. }
  21521. }
  21522. return implode(',', $versions);
  21523. }
  21524. private function parseVersion($version)
  21525. {
  21526. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21527. $version = $matches[1]
  21528. .(!empty($matches[2]) ? $matches[2] : '.0')
  21529. .(!empty($matches[3]) ? $matches[3] : '.0')
  21530. .(!empty($matches[4]) ? $matches[4] : '.0');
  21531. return $version;
  21532. }
  21533. return null;
  21534. }
  21535. private function isHash(array $array)
  21536. {
  21537. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21538. }
  21539. }
  21540. <?php
  21541. namespace Composer\Repository\Pear;
  21542. class PackageInfo
  21543. {
  21544. private $channelName;
  21545. private $packageName;
  21546. private $license;
  21547. private $shortDescription;
  21548. private $description;
  21549. private $releases;
  21550. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21551. {
  21552. $this->channelName = $channelName;
  21553. $this->packageName = $packageName;
  21554. $this->license = $license;
  21555. $this->shortDescription = $shortDescription;
  21556. $this->description = $description;
  21557. $this->releases = $releases;
  21558. }
  21559. public function getChannelName()
  21560. {
  21561. return $this->channelName;
  21562. }
  21563. public function getPackageName()
  21564. {
  21565. return $this->packageName;
  21566. }
  21567. public function getDescription()
  21568. {
  21569. return $this->description;
  21570. }
  21571. public function getShortDescription()
  21572. {
  21573. return $this->shortDescription;
  21574. }
  21575. public function getLicense()
  21576. {
  21577. return $this->license;
  21578. }
  21579. public function getReleases()
  21580. {
  21581. return $this->releases;
  21582. }
  21583. }
  21584. <?php
  21585. namespace Composer\Repository\Pear;
  21586. class ReleaseInfo
  21587. {
  21588. private $stability;
  21589. private $dependencyInfo;
  21590. public function __construct($stability, $dependencyInfo)
  21591. {
  21592. $this->stability = $stability;
  21593. $this->dependencyInfo = $dependencyInfo;
  21594. }
  21595. public function getDependencyInfo()
  21596. {
  21597. return $this->dependencyInfo;
  21598. }
  21599. public function getStability()
  21600. {
  21601. return $this->stability;
  21602. }
  21603. }
  21604. <?php
  21605. namespace Composer\Repository;
  21606. use Composer\IO\IOInterface;
  21607. use Composer\Semver\VersionParser as SemverVersionParser;
  21608. use Composer\Package\Version\VersionParser;
  21609. use Composer\Repository\Pear\ChannelReader;
  21610. use Composer\Package\CompletePackage;
  21611. use Composer\Repository\Pear\ChannelInfo;
  21612. use Composer\EventDispatcher\EventDispatcher;
  21613. use Composer\Package\Link;
  21614. use Composer\Semver\Constraint\Constraint;
  21615. use Composer\Util\RemoteFilesystem;
  21616. use Composer\Config;
  21617. use Composer\Factory;
  21618. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21619. {
  21620. private $url;
  21621. private $io;
  21622. private $rfs;
  21623. private $versionParser;
  21624. private $repoConfig;
  21625. private $vendorAlias;
  21626. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21627. {
  21628. parent::__construct();
  21629. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21630. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21631. }
  21632. $urlBits = parse_url($repoConfig['url']);
  21633. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21634. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21635. }
  21636. $this->url = rtrim($repoConfig['url'], '/');
  21637. $this->io = $io;
  21638. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21639. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21640. $this->versionParser = new VersionParser();
  21641. $this->repoConfig = $repoConfig;
  21642. }
  21643. public function getRepoConfig()
  21644. {
  21645. return $this->repoConfig;
  21646. }
  21647. protected function initialize()
  21648. {
  21649. parent::initialize();
  21650. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21651. $reader = new ChannelReader($this->rfs);
  21652. try {
  21653. $channelInfo = $reader->read($this->url);
  21654. } catch (\Exception $e) {
  21655. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21656. return;
  21657. }
  21658. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21659. foreach ($packages as $package) {
  21660. $this->addPackage($package);
  21661. }
  21662. }
  21663. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21664. {
  21665. $result = array();
  21666. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21667. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21668. try {
  21669. $normalizedVersion = $versionParser->normalize($version);
  21670. } catch (\UnexpectedValueException $e) {
  21671. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21672. continue;
  21673. }
  21674. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21675. $urlBits = parse_url($this->url);
  21676. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21677. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21678. $requires = array();
  21679. $suggests = array();
  21680. $conflicts = array();
  21681. $replaces = array();
  21682. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21683. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21684. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21685. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21686. }
  21687. if (!empty($this->vendorAlias)
  21688. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21689. ) {
  21690. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21691. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21692. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21693. }
  21694. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21695. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21696. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21697. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21698. switch ($dependencyConstraint->getType()) {
  21699. case 'required':
  21700. $requires[] = $link;
  21701. break;
  21702. case 'conflicts':
  21703. $conflicts[] = $link;
  21704. break;
  21705. case 'replaces':
  21706. $replaces[] = $link;
  21707. break;
  21708. }
  21709. }
  21710. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21711. foreach ($dependencyConstraints as $dependencyConstraint) {
  21712. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21713. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21714. }
  21715. }
  21716. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21717. $package->setType('pear-library');
  21718. $package->setDescription($packageDefinition->getDescription());
  21719. $package->setLicense(array($packageDefinition->getLicense()));
  21720. $package->setDistType('file');
  21721. $package->setDistUrl($distUrl);
  21722. $package->setAutoload(array('classmap' => array('')));
  21723. $package->setIncludePaths(array('/'));
  21724. $package->setRequires($requires);
  21725. $package->setConflicts($conflicts);
  21726. $package->setSuggests($suggests);
  21727. $package->setReplaces($replaces);
  21728. $result[] = $package;
  21729. }
  21730. }
  21731. return $result;
  21732. }
  21733. private function buildComposerPackageName($channelName, $packageName)
  21734. {
  21735. if ('php' === $channelName) {
  21736. return "php";
  21737. }
  21738. if ('ext' === $channelName) {
  21739. return "ext-{$packageName}";
  21740. }
  21741. return "pear-{$channelName}/{$packageName}";
  21742. }
  21743. }
  21744. <?php
  21745. namespace Composer\Repository;
  21746. use Composer\Package\CompletePackage;
  21747. use Composer\Package\PackageInterface;
  21748. use Composer\Package\Version\VersionParser;
  21749. use Composer\Plugin\PluginInterface;
  21750. use Composer\Util\ProcessExecutor;
  21751. use Composer\Util\Silencer;
  21752. use Composer\Util\Platform;
  21753. use Composer\XdebugHandler\XdebugHandler;
  21754. use Symfony\Component\Process\ExecutableFinder;
  21755. class PlatformRepository extends ArrayRepository
  21756. {
  21757. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-plugin-api)$}iD';
  21758. private $versionParser;
  21759. private $overrides = array();
  21760. private $process;
  21761. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  21762. {
  21763. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  21764. foreach ($overrides as $name => $version) {
  21765. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21766. }
  21767. parent::__construct($packages);
  21768. }
  21769. protected function initialize()
  21770. {
  21771. parent::initialize();
  21772. $this->versionParser = new VersionParser();
  21773. foreach ($this->overrides as $override) {
  21774. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21775. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21776. }
  21777. $this->addOverriddenPackage($override);
  21778. }
  21779. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21780. $version = $this->versionParser->normalize($prettyVersion);
  21781. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21782. $composerPluginApi->setDescription('The Composer Plugin API');
  21783. $this->addPackage($composerPluginApi);
  21784. try {
  21785. $prettyVersion = PHP_VERSION;
  21786. $version = $this->versionParser->normalize($prettyVersion);
  21787. } catch (\UnexpectedValueException $e) {
  21788. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21789. $version = $this->versionParser->normalize($prettyVersion);
  21790. }
  21791. $php = new CompletePackage('php', $version, $prettyVersion);
  21792. $php->setDescription('The PHP interpreter');
  21793. $this->addPackage($php);
  21794. if (PHP_DEBUG) {
  21795. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21796. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21797. $this->addPackage($phpdebug);
  21798. }
  21799. if (defined('PHP_ZTS') && PHP_ZTS) {
  21800. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21801. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21802. $this->addPackage($phpzts);
  21803. }
  21804. if (PHP_INT_SIZE === 8) {
  21805. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21806. $php64->setDescription('The PHP interpreter, 64bit');
  21807. $this->addPackage($php64);
  21808. }
  21809. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21810. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21811. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21812. $this->addPackage($phpIpv6);
  21813. }
  21814. $loadedExtensions = get_loaded_extensions();
  21815. foreach ($loadedExtensions as $name) {
  21816. if (in_array($name, array('standard', 'Core'))) {
  21817. continue;
  21818. }
  21819. $reflExt = new \ReflectionExtension($name);
  21820. $prettyVersion = $reflExt->getVersion();
  21821. $this->addExtension($name, $prettyVersion);
  21822. }
  21823. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  21824. $this->addExtension('xdebug', $prettyVersion);
  21825. }
  21826. foreach ($loadedExtensions as $name) {
  21827. $prettyVersion = null;
  21828. $description = 'The '.$name.' PHP library';
  21829. switch ($name) {
  21830. case 'curl':
  21831. $curlVersion = curl_version();
  21832. $prettyVersion = $curlVersion['version'];
  21833. break;
  21834. case 'iconv':
  21835. $prettyVersion = ICONV_VERSION;
  21836. break;
  21837. case 'intl':
  21838. $name = 'ICU';
  21839. if (defined('INTL_ICU_VERSION')) {
  21840. $prettyVersion = INTL_ICU_VERSION;
  21841. } else {
  21842. $reflector = new \ReflectionExtension('intl');
  21843. ob_start();
  21844. $reflector->info();
  21845. $output = ob_get_clean();
  21846. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21847. $prettyVersion = $matches[1];
  21848. }
  21849. break;
  21850. case 'imagick':
  21851. $imagick = new \Imagick();
  21852. $imageMagickVersion = $imagick->getVersion();
  21853. preg_match('/^ImageMagick ([\d.]+)-(\d+)/', $imageMagickVersion['versionString'], $matches);
  21854. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  21855. break;
  21856. case 'libxml':
  21857. $prettyVersion = LIBXML_DOTTED_VERSION;
  21858. break;
  21859. case 'openssl':
  21860. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21861. if (empty($match[2])) {
  21862. return $match[1];
  21863. }
  21864. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21865. return 0;
  21866. }
  21867. $len = strlen($match[2]);
  21868. $patchVersion = ($len - 1) * 26;
  21869. $patchVersion += ord($match[2][$len - 1]) - 96;
  21870. return $match[1].'.'.$patchVersion;
  21871. }, OPENSSL_VERSION_TEXT);
  21872. $description = OPENSSL_VERSION_TEXT;
  21873. break;
  21874. case 'pcre':
  21875. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21876. break;
  21877. case 'uuid':
  21878. $prettyVersion = phpversion('uuid');
  21879. break;
  21880. case 'xsl':
  21881. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21882. break;
  21883. default:
  21884. continue 2;
  21885. }
  21886. try {
  21887. $version = $this->versionParser->normalize($prettyVersion);
  21888. } catch (\UnexpectedValueException $e) {
  21889. continue;
  21890. }
  21891. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21892. $lib->setDescription($description);
  21893. $this->addPackage($lib);
  21894. }
  21895. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  21896. if ($hhvmVersion === null && !Platform::isWindows()) {
  21897. $finder = new ExecutableFinder();
  21898. $hhvm = $finder->find('hhvm');
  21899. if ($hhvm !== null) {
  21900. $exitCode = $this->process->execute(
  21901. ProcessExecutor::escape($hhvm).
  21902. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  21903. $hhvmVersion
  21904. );
  21905. if ($exitCode !== 0) {
  21906. $hhvmVersion = null;
  21907. }
  21908. }
  21909. }
  21910. if ($hhvmVersion) {
  21911. try {
  21912. $prettyVersion = $hhvmVersion;
  21913. $version = $this->versionParser->normalize($prettyVersion);
  21914. } catch (\UnexpectedValueException $e) {
  21915. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  21916. $version = $this->versionParser->normalize($prettyVersion);
  21917. }
  21918. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21919. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21920. $this->addPackage($hhvm);
  21921. }
  21922. }
  21923. public function addPackage(PackageInterface $package)
  21924. {
  21925. if (isset($this->overrides[$package->getName()])) {
  21926. $overrider = $this->findPackage($package->getName(), '*');
  21927. if ($package->getVersion() === $overrider->getVersion()) {
  21928. $actualText = 'same as actual';
  21929. } else {
  21930. $actualText = 'actual: '.$package->getPrettyVersion();
  21931. }
  21932. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  21933. return;
  21934. }
  21935. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21936. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21937. if ($package->getVersion() === $overrider->getVersion()) {
  21938. $actualText = 'same as actual';
  21939. } else {
  21940. $actualText = 'actual: '.$package->getPrettyVersion();
  21941. }
  21942. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  21943. return;
  21944. }
  21945. parent::addPackage($package);
  21946. }
  21947. private function addOverriddenPackage(array $override, $name = null)
  21948. {
  21949. $version = $this->versionParser->normalize($override['version']);
  21950. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21951. $package->setDescription('Package overridden via config.platform');
  21952. $package->setExtra(array('config.platform' => true));
  21953. parent::addPackage($package);
  21954. return $package;
  21955. }
  21956. private function addExtension($name, $prettyVersion)
  21957. {
  21958. $extraDescription = null;
  21959. try {
  21960. $version = $this->versionParser->normalize($prettyVersion);
  21961. } catch (\UnexpectedValueException $e) {
  21962. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21963. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21964. $prettyVersion = $match[1];
  21965. } else {
  21966. $prettyVersion = '0';
  21967. }
  21968. $version = $this->versionParser->normalize($prettyVersion);
  21969. }
  21970. $packageName = $this->buildPackageName($name);
  21971. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21972. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21973. $this->addPackage($ext);
  21974. }
  21975. private function buildPackageName($name)
  21976. {
  21977. return 'ext-' . str_replace(' ', '-', $name);
  21978. }
  21979. }
  21980. <?php
  21981. namespace Composer\Repository;
  21982. use Composer\Factory;
  21983. use Composer\IO\IOInterface;
  21984. use Composer\Config;
  21985. use Composer\EventDispatcher\EventDispatcher;
  21986. use Composer\Util\RemoteFilesystem;
  21987. use Composer\Json\JsonFile;
  21988. class RepositoryFactory
  21989. {
  21990. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21991. {
  21992. if (0 === strpos($repository, 'http')) {
  21993. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21994. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21995. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21996. $data = $json->read();
  21997. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21998. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21999. } elseif ($allowFilesystem) {
  22000. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22001. } else {
  22002. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  22003. }
  22004. } elseif ('{' === substr($repository, 0, 1)) {
  22005. $repoConfig = JsonFile::parseJson($repository);
  22006. } else {
  22007. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  22008. }
  22009. return $repoConfig;
  22010. }
  22011. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22012. {
  22013. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  22014. return static::createRepo($io, $config, $repoConfig);
  22015. }
  22016. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  22017. {
  22018. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22019. $repos = static::createRepos($rm, array($repoConfig));
  22020. return reset($repos);
  22021. }
  22022. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  22023. {
  22024. if (!$config) {
  22025. $config = Factory::createConfig($io);
  22026. }
  22027. if ($io) {
  22028. $io->loadConfiguration($config);
  22029. }
  22030. if (!$rm) {
  22031. if (!$io) {
  22032. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  22033. }
  22034. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22035. }
  22036. return static::createRepos($rm, $config->getRepositories());
  22037. }
  22038. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22039. {
  22040. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  22041. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  22042. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  22043. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  22044. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  22045. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  22046. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  22047. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  22048. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  22049. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  22050. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  22051. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  22052. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  22053. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  22054. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  22055. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  22056. return $rm;
  22057. }
  22058. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  22059. {
  22060. $repos = array();
  22061. foreach ($repoConfigs as $index => $repo) {
  22062. if (is_string($repo)) {
  22063. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  22064. }
  22065. if (!is_array($repo)) {
  22066. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  22067. }
  22068. if (!isset($repo['type'])) {
  22069. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  22070. }
  22071. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  22072. while (isset($repos[$name])) {
  22073. $name .= '2';
  22074. }
  22075. if ($repo['type'] === 'filesystem') {
  22076. $repos[$name] = new FilesystemRepository($repo['json']);
  22077. } else {
  22078. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  22079. }
  22080. }
  22081. return $repos;
  22082. }
  22083. }
  22084. <?php
  22085. namespace Composer\Repository;
  22086. use Composer\Package\PackageInterface;
  22087. interface RepositoryInterface extends \Countable
  22088. {
  22089. const SEARCH_FULLTEXT = 0;
  22090. const SEARCH_NAME = 1;
  22091. public function hasPackage(PackageInterface $package);
  22092. public function findPackage($name, $constraint);
  22093. public function findPackages($name, $constraint = null);
  22094. public function getPackages();
  22095. public function search($query, $mode = 0);
  22096. }
  22097. <?php
  22098. namespace Composer\Repository;
  22099. use Composer\IO\IOInterface;
  22100. use Composer\Config;
  22101. use Composer\EventDispatcher\EventDispatcher;
  22102. use Composer\Package\PackageInterface;
  22103. use Composer\Util\RemoteFilesystem;
  22104. class RepositoryManager
  22105. {
  22106. private $localRepository;
  22107. private $repositories = array();
  22108. private $repositoryClasses = array();
  22109. private $io;
  22110. private $config;
  22111. private $eventDispatcher;
  22112. private $rfs;
  22113. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22114. {
  22115. $this->io = $io;
  22116. $this->config = $config;
  22117. $this->eventDispatcher = $eventDispatcher;
  22118. $this->rfs = $rfs;
  22119. }
  22120. public function findPackage($name, $constraint)
  22121. {
  22122. foreach ($this->repositories as $repository) {
  22123. if ($package = $repository->findPackage($name, $constraint)) {
  22124. return $package;
  22125. }
  22126. }
  22127. return null;
  22128. }
  22129. public function findPackages($name, $constraint)
  22130. {
  22131. $packages = array();
  22132. foreach ($this->getRepositories() as $repository) {
  22133. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  22134. }
  22135. return $packages;
  22136. }
  22137. public function addRepository(RepositoryInterface $repository)
  22138. {
  22139. $this->repositories[] = $repository;
  22140. }
  22141. public function prependRepository(RepositoryInterface $repository)
  22142. {
  22143. array_unshift($this->repositories, $repository);
  22144. }
  22145. public function createRepository($type, $config, $name = null)
  22146. {
  22147. if (!isset($this->repositoryClasses[$type])) {
  22148. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  22149. }
  22150. if (isset($config['packagist']) && false === $config['packagist']) {
  22151. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  22152. }
  22153. $class = $this->repositoryClasses[$type];
  22154. $reflMethod = new \ReflectionMethod($class, '__construct');
  22155. $params = $reflMethod->getParameters();
  22156. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  22157. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  22158. }
  22159. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  22160. }
  22161. public function setRepositoryClass($type, $class)
  22162. {
  22163. $this->repositoryClasses[$type] = $class;
  22164. }
  22165. public function getRepositories()
  22166. {
  22167. return $this->repositories;
  22168. }
  22169. public function setLocalRepository(WritableRepositoryInterface $repository)
  22170. {
  22171. $this->localRepository = $repository;
  22172. }
  22173. public function getLocalRepository()
  22174. {
  22175. return $this->localRepository;
  22176. }
  22177. }
  22178. <?php
  22179. namespace Composer\Repository;
  22180. class RepositorySecurityException extends \Exception
  22181. {
  22182. }
  22183. <?php
  22184. namespace Composer\Repository\Vcs;
  22185. use Composer\Cache;
  22186. use Composer\Downloader\TransportException;
  22187. use Composer\Json\JsonFile;
  22188. use Composer\Util\Bitbucket;
  22189. abstract class BitbucketDriver extends VcsDriver
  22190. {
  22191. protected $cache;
  22192. protected $owner;
  22193. protected $repository;
  22194. protected $hasIssues;
  22195. protected $rootIdentifier;
  22196. protected $tags;
  22197. protected $branches;
  22198. protected $infoCache = array();
  22199. protected $branchesUrl = '';
  22200. protected $tagsUrl = '';
  22201. protected $homeUrl = '';
  22202. protected $website = '';
  22203. protected $cloneHttpsUrl = '';
  22204. protected $fallbackDriver;
  22205. protected $vcsType;
  22206. public function initialize()
  22207. {
  22208. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  22209. $this->owner = $match[1];
  22210. $this->repository = $match[2];
  22211. $this->originUrl = 'bitbucket.org';
  22212. $this->cache = new Cache(
  22213. $this->io,
  22214. implode('/', array(
  22215. $this->config->get('cache-repo-dir'),
  22216. $this->originUrl,
  22217. $this->owner,
  22218. $this->repository,
  22219. ))
  22220. );
  22221. }
  22222. public function getUrl()
  22223. {
  22224. if ($this->fallbackDriver) {
  22225. return $this->fallbackDriver->getUrl();
  22226. }
  22227. return $this->cloneHttpsUrl;
  22228. }
  22229. protected function getRepoData()
  22230. {
  22231. $resource = sprintf(
  22232. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  22233. $this->owner,
  22234. $this->repository,
  22235. http_build_query(
  22236. array('fields' => '-project,-owner'),
  22237. null,
  22238. '&'
  22239. )
  22240. );
  22241. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  22242. if ($this->fallbackDriver) {
  22243. return false;
  22244. }
  22245. $this->parseCloneUrls($repoData['links']['clone']);
  22246. $this->hasIssues = !empty($repoData['has_issues']);
  22247. $this->branchesUrl = $repoData['links']['branches']['href'];
  22248. $this->tagsUrl = $repoData['links']['tags']['href'];
  22249. $this->homeUrl = $repoData['links']['html']['href'];
  22250. $this->website = $repoData['website'];
  22251. $this->vcsType = $repoData['scm'];
  22252. return true;
  22253. }
  22254. public function getComposerInformation($identifier)
  22255. {
  22256. if ($this->fallbackDriver) {
  22257. return $this->fallbackDriver->getComposerInformation($identifier);
  22258. }
  22259. if (!isset($this->infoCache[$identifier])) {
  22260. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22261. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22262. }
  22263. $composer = $this->getBaseComposerInformation($identifier);
  22264. if (!isset($composer['support']['source'])) {
  22265. $label = array_search(
  22266. $identifier,
  22267. $this->getTags()
  22268. ) ?: array_search(
  22269. $identifier,
  22270. $this->getBranches()
  22271. ) ?: $identifier;
  22272. if (array_key_exists($label, $tags = $this->getTags())) {
  22273. $hash = $tags[$label];
  22274. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22275. $hash = $branches[$label];
  22276. }
  22277. if (! isset($hash)) {
  22278. $composer['support']['source'] = sprintf(
  22279. 'https://%s/%s/%s/src',
  22280. $this->originUrl,
  22281. $this->owner,
  22282. $this->repository
  22283. );
  22284. } else {
  22285. $composer['support']['source'] = sprintf(
  22286. 'https://%s/%s/%s/src/%s/?at=%s',
  22287. $this->originUrl,
  22288. $this->owner,
  22289. $this->repository,
  22290. $hash,
  22291. $label
  22292. );
  22293. }
  22294. }
  22295. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22296. $composer['support']['issues'] = sprintf(
  22297. 'https://%s/%s/%s/issues',
  22298. $this->originUrl,
  22299. $this->owner,
  22300. $this->repository
  22301. );
  22302. }
  22303. if (!isset($composer['homepage'])) {
  22304. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22305. }
  22306. $this->infoCache[$identifier] = $composer;
  22307. if ($this->shouldCache($identifier)) {
  22308. $this->cache->write($identifier, json_encode($composer));
  22309. }
  22310. }
  22311. return $this->infoCache[$identifier];
  22312. }
  22313. public function getFileContent($file, $identifier)
  22314. {
  22315. if ($this->fallbackDriver) {
  22316. return $this->fallbackDriver->getFileContent($file, $identifier);
  22317. }
  22318. if (strpos($identifier, '/') !== false) {
  22319. $branches = $this->getBranches();
  22320. if (isset($branches[$identifier])) {
  22321. $identifier = $branches[$identifier];
  22322. }
  22323. }
  22324. $resource = sprintf(
  22325. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22326. $this->owner,
  22327. $this->repository,
  22328. $identifier,
  22329. $file
  22330. );
  22331. return $this->getContentsWithOAuthCredentials($resource);
  22332. }
  22333. public function getChangeDate($identifier)
  22334. {
  22335. if ($this->fallbackDriver) {
  22336. return $this->fallbackDriver->getChangeDate($identifier);
  22337. }
  22338. $resource = sprintf(
  22339. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22340. $this->owner,
  22341. $this->repository,
  22342. $identifier
  22343. );
  22344. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22345. return new \DateTime($commit['date']);
  22346. }
  22347. public function getSource($identifier)
  22348. {
  22349. if ($this->fallbackDriver) {
  22350. return $this->fallbackDriver->getSource($identifier);
  22351. }
  22352. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22353. }
  22354. public function getDist($identifier)
  22355. {
  22356. if ($this->fallbackDriver) {
  22357. return $this->fallbackDriver->getDist($identifier);
  22358. }
  22359. $url = sprintf(
  22360. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22361. $this->owner,
  22362. $this->repository,
  22363. $identifier
  22364. );
  22365. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22366. }
  22367. public function getTags()
  22368. {
  22369. if ($this->fallbackDriver) {
  22370. return $this->fallbackDriver->getTags();
  22371. }
  22372. if (null === $this->tags) {
  22373. $this->tags = array();
  22374. $resource = sprintf(
  22375. '%s?%s',
  22376. $this->tagsUrl,
  22377. http_build_query(
  22378. array(
  22379. 'pagelen' => 100,
  22380. 'fields' => 'values.name,values.target.hash,next',
  22381. 'sort' => '-target.date',
  22382. ),
  22383. null,
  22384. '&'
  22385. )
  22386. );
  22387. $hasNext = true;
  22388. while ($hasNext) {
  22389. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22390. foreach ($tagsData['values'] as $data) {
  22391. $this->tags[$data['name']] = $data['target']['hash'];
  22392. }
  22393. if (empty($tagsData['next'])) {
  22394. $hasNext = false;
  22395. } else {
  22396. $resource = $tagsData['next'];
  22397. }
  22398. }
  22399. if ($this->vcsType === 'hg') {
  22400. unset($this->tags['tip']);
  22401. }
  22402. }
  22403. return $this->tags;
  22404. }
  22405. public function getBranches()
  22406. {
  22407. if ($this->fallbackDriver) {
  22408. return $this->fallbackDriver->getBranches();
  22409. }
  22410. if (null === $this->branches) {
  22411. $this->branches = array();
  22412. $resource = sprintf(
  22413. '%s?%s',
  22414. $this->branchesUrl,
  22415. http_build_query(
  22416. array(
  22417. 'pagelen' => 100,
  22418. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22419. 'sort' => '-target.date',
  22420. ),
  22421. null,
  22422. '&'
  22423. )
  22424. );
  22425. $hasNext = true;
  22426. while ($hasNext) {
  22427. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22428. foreach ($branchData['values'] as $data) {
  22429. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22430. continue;
  22431. }
  22432. $this->branches[$data['name']] = $data['target']['hash'];
  22433. }
  22434. if (empty($branchData['next'])) {
  22435. $hasNext = false;
  22436. } else {
  22437. $resource = $branchData['next'];
  22438. }
  22439. }
  22440. }
  22441. return $this->branches;
  22442. }
  22443. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22444. {
  22445. try {
  22446. return parent::getContents($url);
  22447. } catch (TransportException $e) {
  22448. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22449. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22450. if (!$this->io->hasAuthentication($this->originUrl)
  22451. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22452. ) {
  22453. return parent::getContents($url);
  22454. }
  22455. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22456. return $this->attemptCloneFallback();
  22457. }
  22458. }
  22459. throw $e;
  22460. }
  22461. }
  22462. abstract protected function generateSshUrl();
  22463. protected function attemptCloneFallback()
  22464. {
  22465. try {
  22466. $this->setupFallbackDriver($this->generateSshUrl());
  22467. } catch (\RuntimeException $e) {
  22468. $this->fallbackDriver = null;
  22469. $this->io->writeError(
  22470. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22471. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22472. );
  22473. throw $e;
  22474. }
  22475. }
  22476. abstract protected function setupFallbackDriver($url);
  22477. protected function parseCloneUrls(array $cloneLinks)
  22478. {
  22479. foreach ($cloneLinks as $cloneLink) {
  22480. if ($cloneLink['name'] === 'https') {
  22481. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22482. }
  22483. }
  22484. }
  22485. protected function getMainBranchData()
  22486. {
  22487. $resource = sprintf(
  22488. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22489. $this->owner,
  22490. $this->repository
  22491. );
  22492. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22493. if (isset($data['mainbranch'])) {
  22494. return $data['mainbranch'];
  22495. }
  22496. return null;
  22497. }
  22498. }
  22499. <?php
  22500. namespace Composer\Repository\Vcs;
  22501. use Composer\Config;
  22502. use Composer\Util\ProcessExecutor;
  22503. use Composer\Util\Filesystem;
  22504. use Composer\IO\IOInterface;
  22505. class FossilDriver extends VcsDriver
  22506. {
  22507. protected $tags;
  22508. protected $branches;
  22509. protected $rootIdentifier;
  22510. protected $repoFile;
  22511. protected $checkoutDir;
  22512. protected $infoCache = array();
  22513. public function initialize()
  22514. {
  22515. $this->checkFossil();
  22516. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22517. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22518. $this->checkoutDir = $this->url;
  22519. } else {
  22520. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22521. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22522. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22523. $this->updateLocalRepo();
  22524. }
  22525. $this->getTags();
  22526. $this->getBranches();
  22527. }
  22528. protected function checkFossil()
  22529. {
  22530. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22531. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22532. }
  22533. }
  22534. protected function updateLocalRepo()
  22535. {
  22536. $fs = new Filesystem();
  22537. $fs->ensureDirectoryExists($this->checkoutDir);
  22538. if (!is_writable(dirname($this->checkoutDir))) {
  22539. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22540. }
  22541. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22542. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22543. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22544. }
  22545. } else {
  22546. $fs->removeDirectory($this->checkoutDir);
  22547. $fs->remove($this->repoFile);
  22548. $fs->ensureDirectoryExists($this->checkoutDir);
  22549. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22550. $output = $this->process->getErrorOutput();
  22551. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22552. }
  22553. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22554. $output = $this->process->getErrorOutput();
  22555. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22556. }
  22557. }
  22558. }
  22559. public function getRootIdentifier()
  22560. {
  22561. if (null === $this->rootIdentifier) {
  22562. $this->rootIdentifier = 'trunk';
  22563. }
  22564. return $this->rootIdentifier;
  22565. }
  22566. public function getUrl()
  22567. {
  22568. return $this->url;
  22569. }
  22570. public function getSource($identifier)
  22571. {
  22572. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22573. }
  22574. public function getDist($identifier)
  22575. {
  22576. return null;
  22577. }
  22578. public function getFileContent($file, $identifier)
  22579. {
  22580. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22581. $this->process->execute($command, $content, $this->checkoutDir);
  22582. if (!trim($content)) {
  22583. return null;
  22584. }
  22585. return $content;
  22586. }
  22587. public function getChangeDate($identifier)
  22588. {
  22589. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22590. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22591. return new \DateTime($date, new \DateTimeZone('UTC'));
  22592. }
  22593. public function getTags()
  22594. {
  22595. if (null === $this->tags) {
  22596. $tags = array();
  22597. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22598. foreach ($this->process->splitLines($output) as $tag) {
  22599. $tags[$tag] = $tag;
  22600. }
  22601. $this->tags = $tags;
  22602. }
  22603. return $this->tags;
  22604. }
  22605. public function getBranches()
  22606. {
  22607. if (null === $this->branches) {
  22608. $branches = array();
  22609. $bookmarks = array();
  22610. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22611. foreach ($this->process->splitLines($output) as $branch) {
  22612. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22613. $branches[$branch] = $branch;
  22614. }
  22615. $this->branches = $branches;
  22616. }
  22617. return $this->branches;
  22618. }
  22619. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22620. {
  22621. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22622. return true;
  22623. }
  22624. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22625. return true;
  22626. }
  22627. if (Filesystem::isLocalPath($url)) {
  22628. $url = Filesystem::getPlatformPath($url);
  22629. if (!is_dir($url)) {
  22630. return false;
  22631. }
  22632. $process = new ProcessExecutor($io);
  22633. if ($process->execute('fossil info', $output, $url) === 0) {
  22634. return true;
  22635. }
  22636. }
  22637. return false;
  22638. }
  22639. }
  22640. <?php
  22641. namespace Composer\Repository\Vcs;
  22642. use Composer\Config;
  22643. use Composer\IO\IOInterface;
  22644. class GitBitbucketDriver extends BitbucketDriver
  22645. {
  22646. public function getRootIdentifier()
  22647. {
  22648. if ($this->fallbackDriver) {
  22649. return $this->fallbackDriver->getRootIdentifier();
  22650. }
  22651. if (null === $this->rootIdentifier) {
  22652. if (! $this->getRepoData()) {
  22653. return $this->fallbackDriver->getRootIdentifier();
  22654. }
  22655. if ($this->vcsType !== 'git') {
  22656. throw new \RuntimeException(
  22657. $this->url.' does not appear to be a git repository, use '.
  22658. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22659. );
  22660. }
  22661. $mainBranchData = $this->getMainBranchData();
  22662. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22663. }
  22664. return $this->rootIdentifier;
  22665. }
  22666. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22667. {
  22668. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  22669. return false;
  22670. }
  22671. if (!extension_loaded('openssl')) {
  22672. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22673. return false;
  22674. }
  22675. return true;
  22676. }
  22677. protected function setupFallbackDriver($url)
  22678. {
  22679. $this->fallbackDriver = new GitDriver(
  22680. array('url' => $url),
  22681. $this->io,
  22682. $this->config,
  22683. $this->process,
  22684. $this->remoteFilesystem
  22685. );
  22686. $this->fallbackDriver->initialize();
  22687. }
  22688. protected function generateSshUrl()
  22689. {
  22690. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22691. }
  22692. }
  22693. <?php
  22694. namespace Composer\Repository\Vcs;
  22695. use Composer\Util\ProcessExecutor;
  22696. use Composer\Util\Filesystem;
  22697. use Composer\Util\Git as GitUtil;
  22698. use Composer\IO\IOInterface;
  22699. use Composer\Cache;
  22700. use Composer\Config;
  22701. class GitDriver extends VcsDriver
  22702. {
  22703. protected $cache;
  22704. protected $tags;
  22705. protected $branches;
  22706. protected $rootIdentifier;
  22707. protected $repoDir;
  22708. protected $infoCache = array();
  22709. public function initialize()
  22710. {
  22711. if (Filesystem::isLocalPath($this->url)) {
  22712. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22713. $this->repoDir = $this->url;
  22714. $cacheUrl = realpath($this->url);
  22715. } else {
  22716. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22717. GitUtil::cleanEnv();
  22718. $fs = new Filesystem();
  22719. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22720. if (!is_writable(dirname($this->repoDir))) {
  22721. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22722. }
  22723. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22724. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  22725. }
  22726. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22727. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22728. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22729. }
  22730. $cacheUrl = $this->url;
  22731. }
  22732. $this->getTags();
  22733. $this->getBranches();
  22734. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22735. }
  22736. public function getRootIdentifier()
  22737. {
  22738. if (null === $this->rootIdentifier) {
  22739. $this->rootIdentifier = 'master';
  22740. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22741. $branches = $this->process->splitLines($output);
  22742. if (!in_array('* master', $branches)) {
  22743. foreach ($branches as $branch) {
  22744. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22745. $this->rootIdentifier = $match[1];
  22746. break;
  22747. }
  22748. }
  22749. }
  22750. }
  22751. return $this->rootIdentifier;
  22752. }
  22753. public function getUrl()
  22754. {
  22755. return $this->url;
  22756. }
  22757. public function getSource($identifier)
  22758. {
  22759. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22760. }
  22761. public function getDist($identifier)
  22762. {
  22763. return null;
  22764. }
  22765. public function getFileContent($file, $identifier)
  22766. {
  22767. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22768. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22769. if (!trim($content)) {
  22770. return null;
  22771. }
  22772. return $content;
  22773. }
  22774. public function getChangeDate($identifier)
  22775. {
  22776. $this->process->execute(sprintf(
  22777. 'git log -1 --format=%%at %s',
  22778. ProcessExecutor::escape($identifier)
  22779. ), $output, $this->repoDir);
  22780. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22781. }
  22782. public function getTags()
  22783. {
  22784. if (null === $this->tags) {
  22785. $this->tags = array();
  22786. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22787. foreach ($output = $this->process->splitLines($output) as $tag) {
  22788. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22789. $this->tags[$match[2]] = $match[1];
  22790. }
  22791. }
  22792. }
  22793. return $this->tags;
  22794. }
  22795. public function getBranches()
  22796. {
  22797. if (null === $this->branches) {
  22798. $branches = array();
  22799. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22800. foreach ($this->process->splitLines($output) as $branch) {
  22801. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22802. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22803. $branches[$match[1]] = $match[2];
  22804. }
  22805. }
  22806. }
  22807. $this->branches = $branches;
  22808. }
  22809. return $this->branches;
  22810. }
  22811. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22812. {
  22813. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22814. return true;
  22815. }
  22816. if (Filesystem::isLocalPath($url)) {
  22817. $url = Filesystem::getPlatformPath($url);
  22818. if (!is_dir($url)) {
  22819. return false;
  22820. }
  22821. $process = new ProcessExecutor($io);
  22822. if ($process->execute('git tag', $output, $url) === 0) {
  22823. return true;
  22824. }
  22825. }
  22826. if (!$deep) {
  22827. return false;
  22828. }
  22829. $process = new ProcessExecutor($io);
  22830. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22831. }
  22832. }
  22833. <?php
  22834. namespace Composer\Repository\Vcs;
  22835. use Composer\Config;
  22836. use Composer\Downloader\TransportException;
  22837. use Composer\Json\JsonFile;
  22838. use Composer\Cache;
  22839. use Composer\IO\IOInterface;
  22840. use Composer\Util\GitHub;
  22841. class GitHubDriver extends VcsDriver
  22842. {
  22843. protected $cache;
  22844. protected $owner;
  22845. protected $repository;
  22846. protected $tags;
  22847. protected $branches;
  22848. protected $rootIdentifier;
  22849. protected $repoData;
  22850. protected $hasIssues;
  22851. protected $infoCache = array();
  22852. protected $isPrivate = false;
  22853. protected $gitDriver;
  22854. public function initialize()
  22855. {
  22856. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22857. $this->owner = $match[3];
  22858. $this->repository = $match[4];
  22859. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22860. if ($this->originUrl === 'www.github.com') {
  22861. $this->originUrl = 'github.com';
  22862. }
  22863. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22864. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22865. $this->setupGitDriver($this->url);
  22866. return;
  22867. }
  22868. $this->fetchRootIdentifier();
  22869. }
  22870. public function getRepositoryUrl()
  22871. {
  22872. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22873. }
  22874. public function getRootIdentifier()
  22875. {
  22876. if ($this->gitDriver) {
  22877. return $this->gitDriver->getRootIdentifier();
  22878. }
  22879. return $this->rootIdentifier;
  22880. }
  22881. public function getUrl()
  22882. {
  22883. if ($this->gitDriver) {
  22884. return $this->gitDriver->getUrl();
  22885. }
  22886. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22887. }
  22888. protected function getApiUrl()
  22889. {
  22890. if ('github.com' === $this->originUrl) {
  22891. $apiUrl = 'api.github.com';
  22892. } else {
  22893. $apiUrl = $this->originUrl . '/api/v3';
  22894. }
  22895. return 'https://' . $apiUrl;
  22896. }
  22897. public function getSource($identifier)
  22898. {
  22899. if ($this->gitDriver) {
  22900. return $this->gitDriver->getSource($identifier);
  22901. }
  22902. if ($this->isPrivate) {
  22903. $url = $this->generateSshUrl();
  22904. } else {
  22905. $url = $this->getUrl();
  22906. }
  22907. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22908. }
  22909. public function getDist($identifier)
  22910. {
  22911. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22912. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22913. }
  22914. public function getComposerInformation($identifier)
  22915. {
  22916. if ($this->gitDriver) {
  22917. return $this->gitDriver->getComposerInformation($identifier);
  22918. }
  22919. if (!isset($this->infoCache[$identifier])) {
  22920. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22921. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22922. }
  22923. $composer = $this->getBaseComposerInformation($identifier);
  22924. if ($composer) {
  22925. if (!isset($composer['support']['source'])) {
  22926. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22927. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22928. }
  22929. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22930. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22931. }
  22932. }
  22933. if ($this->shouldCache($identifier)) {
  22934. $this->cache->write($identifier, json_encode($composer));
  22935. }
  22936. $this->infoCache[$identifier] = $composer;
  22937. }
  22938. return $this->infoCache[$identifier];
  22939. }
  22940. public function getFileContent($file, $identifier)
  22941. {
  22942. if ($this->gitDriver) {
  22943. return $this->gitDriver->getFileContent($file, $identifier);
  22944. }
  22945. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22946. $resource = JsonFile::parseJson($this->getContents($resource));
  22947. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22948. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22949. }
  22950. return $content;
  22951. }
  22952. public function getChangeDate($identifier)
  22953. {
  22954. if ($this->gitDriver) {
  22955. return $this->gitDriver->getChangeDate($identifier);
  22956. }
  22957. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22958. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22959. return new \DateTime($commit['commit']['committer']['date']);
  22960. }
  22961. public function getTags()
  22962. {
  22963. if ($this->gitDriver) {
  22964. return $this->gitDriver->getTags();
  22965. }
  22966. if (null === $this->tags) {
  22967. $this->tags = array();
  22968. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22969. do {
  22970. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22971. foreach ($tagsData as $tag) {
  22972. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22973. }
  22974. $resource = $this->getNextPage();
  22975. } while ($resource);
  22976. }
  22977. return $this->tags;
  22978. }
  22979. public function getBranches()
  22980. {
  22981. if ($this->gitDriver) {
  22982. return $this->gitDriver->getBranches();
  22983. }
  22984. if (null === $this->branches) {
  22985. $this->branches = array();
  22986. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22987. $branchBlacklist = array('gh-pages');
  22988. do {
  22989. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22990. foreach ($branchData as $branch) {
  22991. $name = substr($branch['ref'], 11);
  22992. if (!in_array($name, $branchBlacklist)) {
  22993. $this->branches[$name] = $branch['object']['sha'];
  22994. }
  22995. }
  22996. $resource = $this->getNextPage();
  22997. } while ($resource);
  22998. }
  22999. return $this->branches;
  23000. }
  23001. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23002. {
  23003. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  23004. return false;
  23005. }
  23006. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  23007. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  23008. return false;
  23009. }
  23010. if (!extension_loaded('openssl')) {
  23011. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23012. return false;
  23013. }
  23014. return true;
  23015. }
  23016. public function getRepoData()
  23017. {
  23018. $this->fetchRootIdentifier();
  23019. return $this->repoData;
  23020. }
  23021. protected function generateSshUrl()
  23022. {
  23023. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  23024. }
  23025. protected function getContents($url, $fetchingRepoData = false)
  23026. {
  23027. try {
  23028. return parent::getContents($url);
  23029. } catch (TransportException $e) {
  23030. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23031. switch ($e->getCode()) {
  23032. case 401:
  23033. case 404:
  23034. if (!$fetchingRepoData) {
  23035. throw $e;
  23036. }
  23037. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  23038. return parent::getContents($url);
  23039. }
  23040. if (!$this->io->isInteractive()) {
  23041. return $this->attemptCloneFallback();
  23042. }
  23043. $scopesIssued = array();
  23044. $scopesNeeded = array();
  23045. if ($headers = $e->getHeaders()) {
  23046. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  23047. $scopesIssued = explode(' ', $scopes);
  23048. }
  23049. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  23050. $scopesNeeded = explode(' ', $scopes);
  23051. }
  23052. }
  23053. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  23054. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  23055. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23056. }
  23057. return parent::getContents($url);
  23058. case 403:
  23059. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  23060. return parent::getContents($url);
  23061. }
  23062. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23063. return $this->attemptCloneFallback();
  23064. }
  23065. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  23066. if (!$this->io->hasAuthentication($this->originUrl)) {
  23067. if (!$this->io->isInteractive()) {
  23068. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  23069. throw $e;
  23070. }
  23071. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  23072. return parent::getContents($url);
  23073. }
  23074. if ($rateLimited) {
  23075. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  23076. $this->io->writeError(sprintf(
  23077. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  23078. $rateLimit['limit'],
  23079. $rateLimit['reset']
  23080. ));
  23081. }
  23082. throw $e;
  23083. default:
  23084. throw $e;
  23085. }
  23086. }
  23087. }
  23088. protected function fetchRootIdentifier()
  23089. {
  23090. if ($this->repoData) {
  23091. return;
  23092. }
  23093. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  23094. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  23095. if (null === $this->repoData && null !== $this->gitDriver) {
  23096. return;
  23097. }
  23098. $this->owner = $this->repoData['owner']['login'];
  23099. $this->repository = $this->repoData['name'];
  23100. $this->isPrivate = !empty($this->repoData['private']);
  23101. if (isset($this->repoData['default_branch'])) {
  23102. $this->rootIdentifier = $this->repoData['default_branch'];
  23103. } elseif (isset($this->repoData['master_branch'])) {
  23104. $this->rootIdentifier = $this->repoData['master_branch'];
  23105. } else {
  23106. $this->rootIdentifier = 'master';
  23107. }
  23108. $this->hasIssues = !empty($this->repoData['has_issues']);
  23109. }
  23110. protected function attemptCloneFallback()
  23111. {
  23112. $this->isPrivate = true;
  23113. try {
  23114. $this->setupGitDriver($this->generateSshUrl());
  23115. return;
  23116. } catch (\RuntimeException $e) {
  23117. $this->gitDriver = null;
  23118. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  23119. throw $e;
  23120. }
  23121. }
  23122. protected function setupGitDriver($url)
  23123. {
  23124. $this->gitDriver = new GitDriver(
  23125. array('url' => $url),
  23126. $this->io,
  23127. $this->config,
  23128. $this->process,
  23129. $this->remoteFilesystem
  23130. );
  23131. $this->gitDriver->initialize();
  23132. }
  23133. protected function getNextPage()
  23134. {
  23135. $headers = $this->remoteFilesystem->getLastHeaders();
  23136. foreach ($headers as $header) {
  23137. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23138. $links = explode(',', $match[1]);
  23139. foreach ($links as $link) {
  23140. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23141. return $match[1];
  23142. }
  23143. }
  23144. }
  23145. }
  23146. }
  23147. }
  23148. <?php
  23149. namespace Composer\Repository\Vcs;
  23150. use Composer\Config;
  23151. use Composer\Cache;
  23152. use Composer\IO\IOInterface;
  23153. use Composer\Json\JsonFile;
  23154. use Composer\Downloader\TransportException;
  23155. use Composer\Util\RemoteFilesystem;
  23156. use Composer\Util\GitLab;
  23157. class GitLabDriver extends VcsDriver
  23158. {
  23159. private $scheme;
  23160. private $namespace;
  23161. private $repository;
  23162. private $project;
  23163. private $commits = array();
  23164. private $tags;
  23165. private $branches;
  23166. protected $gitDriver;
  23167. private $isPrivate = true;
  23168. protected $portNumber;
  23169. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  23170. public function initialize()
  23171. {
  23172. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  23173. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  23174. }
  23175. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23176. $configuredDomains = $this->config->get('gitlab-domains');
  23177. $urlParts = explode('/', $match['parts']);
  23178. $this->scheme = !empty($match['scheme'])
  23179. ? $match['scheme']
  23180. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  23181. ;
  23182. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  23183. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  23184. $this->portNumber = (int) $match['port'];
  23185. }
  23186. $this->namespace = implode('/', $urlParts);
  23187. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  23188. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  23189. $this->fetchProject();
  23190. }
  23191. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  23192. {
  23193. $this->remoteFilesystem = $remoteFilesystem;
  23194. }
  23195. public function getFileContent($file, $identifier)
  23196. {
  23197. if ($this->gitDriver) {
  23198. return $this->gitDriver->getFileContent($file, $identifier);
  23199. }
  23200. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  23201. $branches = $this->getBranches();
  23202. if (isset($branches[$identifier])) {
  23203. $identifier = $branches[$identifier];
  23204. }
  23205. }
  23206. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  23207. try {
  23208. $content = $this->getContents($resource);
  23209. } catch (TransportException $e) {
  23210. if ($e->getCode() !== 404) {
  23211. throw $e;
  23212. }
  23213. return null;
  23214. }
  23215. return $content;
  23216. }
  23217. public function getChangeDate($identifier)
  23218. {
  23219. if ($this->gitDriver) {
  23220. return $this->gitDriver->getChangeDate($identifier);
  23221. }
  23222. if (isset($this->commits[$identifier])) {
  23223. return new \DateTime($this->commits[$identifier]['committed_date']);
  23224. }
  23225. return new \DateTime();
  23226. }
  23227. public function getRepositoryUrl()
  23228. {
  23229. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  23230. }
  23231. public function getUrl()
  23232. {
  23233. if ($this->gitDriver) {
  23234. return $this->gitDriver->getUrl();
  23235. }
  23236. return $this->project['web_url'];
  23237. }
  23238. public function getDist($identifier)
  23239. {
  23240. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  23241. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23242. }
  23243. public function getSource($identifier)
  23244. {
  23245. if ($this->gitDriver) {
  23246. return $this->gitDriver->getSource($identifier);
  23247. }
  23248. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  23249. }
  23250. public function getRootIdentifier()
  23251. {
  23252. if ($this->gitDriver) {
  23253. return $this->gitDriver->getRootIdentifier();
  23254. }
  23255. return $this->project['default_branch'];
  23256. }
  23257. public function getBranches()
  23258. {
  23259. if ($this->gitDriver) {
  23260. return $this->gitDriver->getBranches();
  23261. }
  23262. if (!$this->branches) {
  23263. $this->branches = $this->getReferences('branches');
  23264. }
  23265. return $this->branches;
  23266. }
  23267. public function getTags()
  23268. {
  23269. if ($this->gitDriver) {
  23270. return $this->gitDriver->getTags();
  23271. }
  23272. if (!$this->tags) {
  23273. $this->tags = $this->getReferences('tags');
  23274. }
  23275. return $this->tags;
  23276. }
  23277. public function getApiUrl()
  23278. {
  23279. $domainName = $this->originUrl;
  23280. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  23281. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23282. }
  23283. private function urlEncodeAll($string)
  23284. {
  23285. $encoded = '';
  23286. for ($i = 0; isset($string[$i]); $i++) {
  23287. $character = $string[$i];
  23288. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23289. $character = '%' . sprintf('%02X', ord($character));
  23290. }
  23291. $encoded .= $character;
  23292. }
  23293. return $encoded;
  23294. }
  23295. protected function getReferences($type)
  23296. {
  23297. $perPage = 100;
  23298. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23299. $references = array();
  23300. do {
  23301. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23302. foreach ($data as $datum) {
  23303. $references[$datum['name']] = $datum['commit']['id'];
  23304. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23305. }
  23306. if (count($data) >= $perPage) {
  23307. $resource = $this->getNextPage();
  23308. } else {
  23309. $resource = false;
  23310. }
  23311. } while ($resource);
  23312. return $references;
  23313. }
  23314. protected function fetchProject()
  23315. {
  23316. $resource = $this->getApiUrl();
  23317. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23318. if (isset($this->project['visibility'])) {
  23319. $this->isPrivate = $this->project['visibility'] !== 'public';
  23320. } else {
  23321. $this->isPrivate = false;
  23322. }
  23323. }
  23324. protected function attemptCloneFallback()
  23325. {
  23326. try {
  23327. if ($this->isPrivate === false) {
  23328. $url = $this->generatePublicUrl();
  23329. } else {
  23330. $url = $this->generateSshUrl();
  23331. }
  23332. $this->setupGitDriver($url);
  23333. return;
  23334. } catch (\RuntimeException $e) {
  23335. $this->gitDriver = null;
  23336. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23337. throw $e;
  23338. }
  23339. }
  23340. protected function generateSshUrl()
  23341. {
  23342. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23343. }
  23344. protected function generatePublicUrl()
  23345. {
  23346. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23347. }
  23348. protected function setupGitDriver($url)
  23349. {
  23350. $this->gitDriver = new GitDriver(
  23351. array('url' => $url),
  23352. $this->io,
  23353. $this->config,
  23354. $this->process,
  23355. $this->remoteFilesystem
  23356. );
  23357. $this->gitDriver->initialize();
  23358. }
  23359. protected function getContents($url, $fetchingRepoData = false)
  23360. {
  23361. try {
  23362. $res = parent::getContents($url);
  23363. if ($fetchingRepoData) {
  23364. $json = JsonFile::parseJson($res, $url);
  23365. if (!isset($json['default_branch'])) {
  23366. if (!empty($json['id'])) {
  23367. $this->isPrivate = false;
  23368. }
  23369. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23370. }
  23371. }
  23372. return $res;
  23373. } catch (TransportException $e) {
  23374. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23375. switch ($e->getCode()) {
  23376. case 401:
  23377. case 404:
  23378. if (!$fetchingRepoData) {
  23379. throw $e;
  23380. }
  23381. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23382. return parent::getContents($url);
  23383. }
  23384. if (!$this->io->isInteractive()) {
  23385. return $this->attemptCloneFallback();
  23386. }
  23387. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23388. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23389. return parent::getContents($url);
  23390. case 403:
  23391. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23392. return parent::getContents($url);
  23393. }
  23394. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23395. return $this->attemptCloneFallback();
  23396. }
  23397. throw $e;
  23398. default:
  23399. throw $e;
  23400. }
  23401. }
  23402. }
  23403. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23404. {
  23405. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23406. return false;
  23407. }
  23408. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23409. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23410. $urlParts = explode('/', $match['parts']);
  23411. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  23412. return false;
  23413. }
  23414. if ('https' === $scheme && !extension_loaded('openssl')) {
  23415. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23416. return false;
  23417. }
  23418. return true;
  23419. }
  23420. private function getNextPage()
  23421. {
  23422. $headers = $this->remoteFilesystem->getLastHeaders();
  23423. foreach ($headers as $header) {
  23424. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23425. $links = explode(',', $match[1]);
  23426. foreach ($links as $link) {
  23427. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23428. return $match[1];
  23429. }
  23430. }
  23431. }
  23432. }
  23433. }
  23434. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  23435. {
  23436. if (in_array($guessedDomain, $configuredDomains)) {
  23437. return $guessedDomain;
  23438. }
  23439. while (null !== ($part = array_shift($urlParts))) {
  23440. $guessedDomain .= '/' . $part;
  23441. if (in_array($guessedDomain, $configuredDomains)) {
  23442. return $guessedDomain;
  23443. }
  23444. }
  23445. return false;
  23446. }
  23447. }
  23448. <?php
  23449. namespace Composer\Repository\Vcs;
  23450. use Composer\Config;
  23451. use Composer\IO\IOInterface;
  23452. class HgBitbucketDriver extends BitbucketDriver
  23453. {
  23454. public function getRootIdentifier()
  23455. {
  23456. if ($this->fallbackDriver) {
  23457. return $this->fallbackDriver->getRootIdentifier();
  23458. }
  23459. if (null === $this->rootIdentifier) {
  23460. if (! $this->getRepoData()) {
  23461. return $this->fallbackDriver->getRootIdentifier();
  23462. }
  23463. if ($this->vcsType !== 'hg') {
  23464. throw new \RuntimeException(
  23465. $this->url.' does not appear to be a mercurial repository, use '.
  23466. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23467. );
  23468. }
  23469. $mainBranchData = $this->getMainBranchData();
  23470. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23471. }
  23472. return $this->rootIdentifier;
  23473. }
  23474. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23475. {
  23476. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  23477. return false;
  23478. }
  23479. if (!extension_loaded('openssl')) {
  23480. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23481. return false;
  23482. }
  23483. return true;
  23484. }
  23485. protected function setupFallbackDriver($url)
  23486. {
  23487. $this->fallbackDriver = new HgDriver(
  23488. array('url' => $url),
  23489. $this->io,
  23490. $this->config,
  23491. $this->process,
  23492. $this->remoteFilesystem
  23493. );
  23494. $this->fallbackDriver->initialize();
  23495. }
  23496. protected function generateSshUrl()
  23497. {
  23498. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23499. }
  23500. }
  23501. <?php
  23502. namespace Composer\Repository\Vcs;
  23503. use Composer\Config;
  23504. use Composer\Util\Hg as HgUtils;
  23505. use Composer\Util\ProcessExecutor;
  23506. use Composer\Util\Filesystem;
  23507. use Composer\IO\IOInterface;
  23508. class HgDriver extends VcsDriver
  23509. {
  23510. protected $tags;
  23511. protected $branches;
  23512. protected $rootIdentifier;
  23513. protected $repoDir;
  23514. protected $infoCache = array();
  23515. public function initialize()
  23516. {
  23517. if (Filesystem::isLocalPath($this->url)) {
  23518. $this->repoDir = $this->url;
  23519. } else {
  23520. $cacheDir = $this->config->get('cache-vcs-dir');
  23521. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23522. $fs = new Filesystem();
  23523. $fs->ensureDirectoryExists($cacheDir);
  23524. if (!is_writable(dirname($this->repoDir))) {
  23525. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23526. }
  23527. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23528. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23529. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23530. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23531. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23532. }
  23533. } else {
  23534. $fs->removeDirectory($this->repoDir);
  23535. $command = function ($url) {
  23536. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir));
  23537. };
  23538. $hgUtils->runCommand($command, $this->url, $this->repoDir);
  23539. }
  23540. }
  23541. $this->getTags();
  23542. $this->getBranches();
  23543. }
  23544. public function getRootIdentifier()
  23545. {
  23546. if (null === $this->rootIdentifier) {
  23547. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23548. $output = $this->process->splitLines($output);
  23549. $this->rootIdentifier = $output[0];
  23550. }
  23551. return $this->rootIdentifier;
  23552. }
  23553. public function getUrl()
  23554. {
  23555. return $this->url;
  23556. }
  23557. public function getSource($identifier)
  23558. {
  23559. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23560. }
  23561. public function getDist($identifier)
  23562. {
  23563. return null;
  23564. }
  23565. public function getFileContent($file, $identifier)
  23566. {
  23567. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23568. $this->process->execute($resource, $content, $this->repoDir);
  23569. if (!trim($content)) {
  23570. return;
  23571. }
  23572. return $content;
  23573. }
  23574. public function getChangeDate($identifier)
  23575. {
  23576. $this->process->execute(
  23577. sprintf(
  23578. 'hg log --template "{date|rfc3339date}" -r %s',
  23579. ProcessExecutor::escape($identifier)
  23580. ),
  23581. $output,
  23582. $this->repoDir
  23583. );
  23584. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23585. }
  23586. public function getTags()
  23587. {
  23588. if (null === $this->tags) {
  23589. $tags = array();
  23590. $this->process->execute('hg tags', $output, $this->repoDir);
  23591. foreach ($this->process->splitLines($output) as $tag) {
  23592. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23593. $tags[$match[1]] = $match[2];
  23594. }
  23595. }
  23596. unset($tags['tip']);
  23597. $this->tags = $tags;
  23598. }
  23599. return $this->tags;
  23600. }
  23601. public function getBranches()
  23602. {
  23603. if (null === $this->branches) {
  23604. $branches = array();
  23605. $bookmarks = array();
  23606. $this->process->execute('hg branches', $output, $this->repoDir);
  23607. foreach ($this->process->splitLines($output) as $branch) {
  23608. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23609. $branches[$match[1]] = $match[2];
  23610. }
  23611. }
  23612. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23613. foreach ($this->process->splitLines($output) as $branch) {
  23614. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23615. $bookmarks[$match[1]] = $match[2];
  23616. }
  23617. }
  23618. $this->branches = array_merge($bookmarks, $branches);
  23619. }
  23620. return $this->branches;
  23621. }
  23622. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23623. {
  23624. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23625. return true;
  23626. }
  23627. if (Filesystem::isLocalPath($url)) {
  23628. $url = Filesystem::getPlatformPath($url);
  23629. if (!is_dir($url)) {
  23630. return false;
  23631. }
  23632. $process = new ProcessExecutor($io);
  23633. if ($process->execute('hg summary', $output, $url) === 0) {
  23634. return true;
  23635. }
  23636. }
  23637. if (!$deep) {
  23638. return false;
  23639. }
  23640. $processExecutor = new ProcessExecutor($io);
  23641. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23642. return $exit === 0;
  23643. }
  23644. }
  23645. <?php
  23646. namespace Composer\Repository\Vcs;
  23647. use Composer\Config;
  23648. use Composer\IO\IOInterface;
  23649. use Composer\Util\ProcessExecutor;
  23650. use Composer\Util\Perforce;
  23651. class PerforceDriver extends VcsDriver
  23652. {
  23653. protected $depot;
  23654. protected $branch;
  23655. protected $perforce;
  23656. public function initialize()
  23657. {
  23658. $this->depot = $this->repoConfig['depot'];
  23659. $this->branch = '';
  23660. if (!empty($this->repoConfig['branch'])) {
  23661. $this->branch = $this->repoConfig['branch'];
  23662. }
  23663. $this->initPerforce($this->repoConfig);
  23664. $this->perforce->p4Login();
  23665. $this->perforce->checkStream();
  23666. $this->perforce->writeP4ClientSpec();
  23667. $this->perforce->connectClient();
  23668. return true;
  23669. }
  23670. private function initPerforce($repoConfig)
  23671. {
  23672. if (!empty($this->perforce)) {
  23673. return;
  23674. }
  23675. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23676. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23677. }
  23678. public function getFileContent($file, $identifier)
  23679. {
  23680. return $this->perforce->getFileContent($file, $identifier);
  23681. }
  23682. public function getChangeDate($identifier)
  23683. {
  23684. return null;
  23685. }
  23686. public function getRootIdentifier()
  23687. {
  23688. return $this->branch;
  23689. }
  23690. public function getBranches()
  23691. {
  23692. return $this->perforce->getBranches();
  23693. }
  23694. public function getTags()
  23695. {
  23696. return $this->perforce->getTags();
  23697. }
  23698. public function getDist($identifier)
  23699. {
  23700. return null;
  23701. }
  23702. public function getSource($identifier)
  23703. {
  23704. $source = array(
  23705. 'type' => 'perforce',
  23706. 'url' => $this->repoConfig['url'],
  23707. 'reference' => $identifier,
  23708. 'p4user' => $this->perforce->getUser(),
  23709. );
  23710. return $source;
  23711. }
  23712. public function getUrl()
  23713. {
  23714. return $this->url;
  23715. }
  23716. public function hasComposerFile($identifier)
  23717. {
  23718. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23719. $composerInfoIdentifier = $identifier;
  23720. return !empty($composerInfo);
  23721. }
  23722. public function getContents($url)
  23723. {
  23724. return false;
  23725. }
  23726. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23727. {
  23728. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23729. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23730. }
  23731. return false;
  23732. }
  23733. public function cleanup()
  23734. {
  23735. $this->perforce->cleanupClientSpec();
  23736. $this->perforce = null;
  23737. }
  23738. public function getDepot()
  23739. {
  23740. return $this->depot;
  23741. }
  23742. public function getBranch()
  23743. {
  23744. return $this->branch;
  23745. }
  23746. }
  23747. <?php
  23748. namespace Composer\Repository\Vcs;
  23749. use Composer\Cache;
  23750. use Composer\Config;
  23751. use Composer\Json\JsonFile;
  23752. use Composer\Util\ProcessExecutor;
  23753. use Composer\Util\Filesystem;
  23754. use Composer\Util\Svn as SvnUtil;
  23755. use Composer\IO\IOInterface;
  23756. use Composer\Downloader\TransportException;
  23757. class SvnDriver extends VcsDriver
  23758. {
  23759. protected $cache;
  23760. protected $baseUrl;
  23761. protected $tags;
  23762. protected $branches;
  23763. protected $rootIdentifier;
  23764. protected $infoCache = array();
  23765. protected $trunkPath = 'trunk';
  23766. protected $branchesPath = 'branches';
  23767. protected $tagsPath = 'tags';
  23768. protected $packagePath = '';
  23769. protected $cacheCredentials = true;
  23770. private $util;
  23771. public function initialize()
  23772. {
  23773. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23774. SvnUtil::cleanEnv();
  23775. if (isset($this->repoConfig['trunk-path'])) {
  23776. $this->trunkPath = $this->repoConfig['trunk-path'];
  23777. }
  23778. if (isset($this->repoConfig['branches-path'])) {
  23779. $this->branchesPath = $this->repoConfig['branches-path'];
  23780. }
  23781. if (isset($this->repoConfig['tags-path'])) {
  23782. $this->tagsPath = $this->repoConfig['tags-path'];
  23783. }
  23784. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23785. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23786. }
  23787. if (isset($this->repoConfig['package-path'])) {
  23788. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23789. }
  23790. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23791. $this->baseUrl = substr($this->url, 0, $pos);
  23792. }
  23793. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23794. $this->getBranches();
  23795. $this->getTags();
  23796. }
  23797. public function getRootIdentifier()
  23798. {
  23799. return $this->rootIdentifier ?: $this->trunkPath;
  23800. }
  23801. public function getUrl()
  23802. {
  23803. return $this->url;
  23804. }
  23805. public function getSource($identifier)
  23806. {
  23807. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23808. }
  23809. public function getDist($identifier)
  23810. {
  23811. return null;
  23812. }
  23813. protected function shouldCache($identifier)
  23814. {
  23815. return $this->cache && preg_match('{@\d+$}', $identifier);
  23816. }
  23817. public function getComposerInformation($identifier)
  23818. {
  23819. if (!isset($this->infoCache[$identifier])) {
  23820. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  23821. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23822. }
  23823. try {
  23824. $composer = $this->getBaseComposerInformation($identifier);
  23825. } catch (TransportException $e) {
  23826. $message = $e->getMessage();
  23827. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  23828. throw $e;
  23829. }
  23830. $composer = '';
  23831. }
  23832. if ($this->shouldCache($identifier)) {
  23833. $this->cache->write($identifier.'.json', json_encode($composer));
  23834. }
  23835. $this->infoCache[$identifier] = $composer;
  23836. }
  23837. return $this->infoCache[$identifier];
  23838. }
  23839. public function getFileContent($file, $identifier)
  23840. {
  23841. $identifier = '/' . trim($identifier, '/') . '/';
  23842. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23843. if (!empty($match[2])) {
  23844. $path = $match[1];
  23845. $rev = $match[2];
  23846. } else {
  23847. $path = $identifier;
  23848. $rev = '';
  23849. }
  23850. try {
  23851. $resource = $path.$file;
  23852. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23853. if (!trim($output)) {
  23854. return null;
  23855. }
  23856. } catch (\RuntimeException $e) {
  23857. throw new TransportException($e->getMessage());
  23858. }
  23859. return $output;
  23860. }
  23861. public function getChangeDate($identifier)
  23862. {
  23863. $identifier = '/' . trim($identifier, '/') . '/';
  23864. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23865. if (!empty($match[2])) {
  23866. $path = $match[1];
  23867. $rev = $match[2];
  23868. } else {
  23869. $path = $identifier;
  23870. $rev = '';
  23871. }
  23872. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23873. foreach ($this->process->splitLines($output) as $line) {
  23874. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23875. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23876. }
  23877. }
  23878. return null;
  23879. }
  23880. public function getTags()
  23881. {
  23882. if (null === $this->tags) {
  23883. $this->tags = array();
  23884. if ($this->tagsPath !== false) {
  23885. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23886. if ($output) {
  23887. foreach ($this->process->splitLines($output) as $line) {
  23888. $line = trim($line);
  23889. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23890. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23891. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23892. '/' . $this->tagsPath . '/' . $match[2],
  23893. $match[1]
  23894. );
  23895. }
  23896. }
  23897. }
  23898. }
  23899. }
  23900. }
  23901. return $this->tags;
  23902. }
  23903. public function getBranches()
  23904. {
  23905. if (null === $this->branches) {
  23906. $this->branches = array();
  23907. if (false === $this->trunkPath) {
  23908. $trunkParent = $this->baseUrl . '/';
  23909. } else {
  23910. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23911. }
  23912. $output = $this->execute('svn ls --verbose', $trunkParent);
  23913. if ($output) {
  23914. foreach ($this->process->splitLines($output) as $line) {
  23915. $line = trim($line);
  23916. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23917. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23918. $this->branches['trunk'] = $this->buildIdentifier(
  23919. '/' . $this->trunkPath,
  23920. $match[1]
  23921. );
  23922. $this->rootIdentifier = $this->branches['trunk'];
  23923. break;
  23924. }
  23925. }
  23926. }
  23927. }
  23928. unset($output);
  23929. if ($this->branchesPath !== false) {
  23930. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23931. if ($output) {
  23932. foreach ($this->process->splitLines(trim($output)) as $line) {
  23933. $line = trim($line);
  23934. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23935. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23936. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23937. '/' . $this->branchesPath . '/' . $match[2],
  23938. $match[1]
  23939. );
  23940. }
  23941. }
  23942. }
  23943. }
  23944. }
  23945. }
  23946. return $this->branches;
  23947. }
  23948. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23949. {
  23950. $url = self::normalizeUrl($url);
  23951. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23952. return true;
  23953. }
  23954. if (!$deep && !Filesystem::isLocalPath($url)) {
  23955. return false;
  23956. }
  23957. $processExecutor = new ProcessExecutor($io);
  23958. $exit = $processExecutor->execute(
  23959. "svn info --non-interactive ".ProcessExecutor::escape($url),
  23960. $ignoredOutput
  23961. );
  23962. if ($exit === 0) {
  23963. return true;
  23964. }
  23965. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23966. return true;
  23967. }
  23968. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23969. return true;
  23970. }
  23971. return false;
  23972. }
  23973. protected static function normalizeUrl($url)
  23974. {
  23975. $fs = new Filesystem();
  23976. if ($fs->isAbsolutePath($url)) {
  23977. return 'file://' . strtr($url, '\\', '/');
  23978. }
  23979. return $url;
  23980. }
  23981. protected function execute($command, $url)
  23982. {
  23983. if (null === $this->util) {
  23984. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23985. $this->util->setCacheCredentials($this->cacheCredentials);
  23986. }
  23987. try {
  23988. return $this->util->execute($command, $url);
  23989. } catch (\RuntimeException $e) {
  23990. if (null === $this->util->binaryVersion()) {
  23991. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  23992. }
  23993. throw new \RuntimeException(
  23994. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23995. );
  23996. }
  23997. }
  23998. protected function buildIdentifier($baseDir, $revision)
  23999. {
  24000. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  24001. }
  24002. }
  24003. <?php
  24004. namespace Composer\Repository\Vcs;
  24005. use Composer\Cache;
  24006. use Composer\Downloader\TransportException;
  24007. use Composer\Config;
  24008. use Composer\Factory;
  24009. use Composer\IO\IOInterface;
  24010. use Composer\Json\JsonFile;
  24011. use Composer\Util\ProcessExecutor;
  24012. use Composer\Util\RemoteFilesystem;
  24013. use Composer\Util\Filesystem;
  24014. abstract class VcsDriver implements VcsDriverInterface
  24015. {
  24016. protected $url;
  24017. protected $originUrl;
  24018. protected $repoConfig;
  24019. protected $io;
  24020. protected $config;
  24021. protected $process;
  24022. protected $remoteFilesystem;
  24023. protected $infoCache = array();
  24024. protected $cache;
  24025. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24026. {
  24027. if (Filesystem::isLocalPath($repoConfig['url'])) {
  24028. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  24029. }
  24030. $this->url = $repoConfig['url'];
  24031. $this->originUrl = $repoConfig['url'];
  24032. $this->repoConfig = $repoConfig;
  24033. $this->io = $io;
  24034. $this->config = $config;
  24035. $this->process = $process ?: new ProcessExecutor($io);
  24036. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24037. }
  24038. protected function shouldCache($identifier)
  24039. {
  24040. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  24041. }
  24042. public function getComposerInformation($identifier)
  24043. {
  24044. if (!isset($this->infoCache[$identifier])) {
  24045. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24046. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24047. }
  24048. $composer = $this->getBaseComposerInformation($identifier);
  24049. if ($this->shouldCache($identifier)) {
  24050. $this->cache->write($identifier, json_encode($composer));
  24051. }
  24052. $this->infoCache[$identifier] = $composer;
  24053. }
  24054. return $this->infoCache[$identifier];
  24055. }
  24056. protected function getBaseComposerInformation($identifier)
  24057. {
  24058. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24059. if (!$composerFileContent) {
  24060. return null;
  24061. }
  24062. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  24063. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  24064. $composer['time'] = $changeDate->format(DATE_RFC3339);
  24065. }
  24066. return $composer;
  24067. }
  24068. public function hasComposerFile($identifier)
  24069. {
  24070. try {
  24071. return (bool) $this->getComposerInformation($identifier);
  24072. } catch (TransportException $e) {
  24073. }
  24074. return false;
  24075. }
  24076. protected function getScheme()
  24077. {
  24078. if (extension_loaded('openssl')) {
  24079. return 'https';
  24080. }
  24081. return 'http';
  24082. }
  24083. protected function getContents($url)
  24084. {
  24085. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  24086. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  24087. }
  24088. public function cleanup()
  24089. {
  24090. return;
  24091. }
  24092. }
  24093. <?php
  24094. namespace Composer\Repository\Vcs;
  24095. use Composer\Config;
  24096. use Composer\IO\IOInterface;
  24097. interface VcsDriverInterface
  24098. {
  24099. public function initialize();
  24100. public function getComposerInformation($identifier);
  24101. public function getFileContent($file, $identifier);
  24102. public function getChangeDate($identifier);
  24103. public function getRootIdentifier();
  24104. public function getBranches();
  24105. public function getTags();
  24106. public function getDist($identifier);
  24107. public function getSource($identifier);
  24108. public function getUrl();
  24109. public function hasComposerFile($identifier);
  24110. public function cleanup();
  24111. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  24112. }
  24113. <?php
  24114. namespace Composer\Repository;
  24115. use Composer\Downloader\TransportException;
  24116. use Composer\Repository\Vcs\VcsDriverInterface;
  24117. use Composer\Package\Version\VersionParser;
  24118. use Composer\Package\Loader\ArrayLoader;
  24119. use Composer\Package\Loader\ValidatingArrayLoader;
  24120. use Composer\Package\Loader\InvalidPackageException;
  24121. use Composer\Package\Loader\LoaderInterface;
  24122. use Composer\EventDispatcher\EventDispatcher;
  24123. use Composer\IO\IOInterface;
  24124. use Composer\Config;
  24125. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  24126. {
  24127. protected $url;
  24128. protected $packageName;
  24129. protected $verbose;
  24130. protected $io;
  24131. protected $config;
  24132. protected $versionParser;
  24133. protected $type;
  24134. protected $loader;
  24135. protected $repoConfig;
  24136. protected $branchErrorOccurred = false;
  24137. private $drivers;
  24138. private $driver;
  24139. private $versionCache;
  24140. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  24141. {
  24142. parent::__construct();
  24143. $this->drivers = $drivers ?: array(
  24144. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  24145. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  24146. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  24147. 'git' => 'Composer\Repository\Vcs\GitDriver',
  24148. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  24149. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  24150. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  24151. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  24152. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  24153. );
  24154. $this->url = $repoConfig['url'];
  24155. $this->io = $io;
  24156. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  24157. $this->verbose = $io->isVeryVerbose();
  24158. $this->config = $config;
  24159. $this->repoConfig = $repoConfig;
  24160. $this->versionCache = $versionCache;
  24161. }
  24162. public function getRepoConfig()
  24163. {
  24164. return $this->repoConfig;
  24165. }
  24166. public function setLoader(LoaderInterface $loader)
  24167. {
  24168. $this->loader = $loader;
  24169. }
  24170. public function getDriver()
  24171. {
  24172. if ($this->driver) {
  24173. return $this->driver;
  24174. }
  24175. if (isset($this->drivers[$this->type])) {
  24176. $class = $this->drivers[$this->type];
  24177. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  24178. $this->driver->initialize();
  24179. return $this->driver;
  24180. }
  24181. foreach ($this->drivers as $driver) {
  24182. if ($driver::supports($this->io, $this->config, $this->url)) {
  24183. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24184. $this->driver->initialize();
  24185. return $this->driver;
  24186. }
  24187. }
  24188. foreach ($this->drivers as $driver) {
  24189. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  24190. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24191. $this->driver->initialize();
  24192. return $this->driver;
  24193. }
  24194. }
  24195. }
  24196. public function hadInvalidBranches()
  24197. {
  24198. return $this->branchErrorOccurred;
  24199. }
  24200. protected function initialize()
  24201. {
  24202. parent::initialize();
  24203. $verbose = $this->verbose;
  24204. $driver = $this->getDriver();
  24205. if (!$driver) {
  24206. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  24207. }
  24208. $this->versionParser = new VersionParser;
  24209. if (!$this->loader) {
  24210. $this->loader = new ArrayLoader($this->versionParser);
  24211. }
  24212. try {
  24213. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  24214. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  24215. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  24216. }
  24217. } catch (\Exception $e) {
  24218. if ($verbose) {
  24219. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  24220. }
  24221. }
  24222. foreach ($driver->getTags() as $tag => $identifier) {
  24223. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  24224. if ($verbose) {
  24225. $this->io->writeError($msg);
  24226. } else {
  24227. $this->io->overwriteError($msg, false);
  24228. }
  24229. $tag = str_replace('release-', '', $tag);
  24230. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $verbose);
  24231. if ($cachedPackage) {
  24232. $this->addPackage($cachedPackage);
  24233. continue;
  24234. }
  24235. if (!$parsedTag = $this->validateTag($tag)) {
  24236. if ($verbose) {
  24237. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  24238. }
  24239. continue;
  24240. }
  24241. try {
  24242. if (!$data = $driver->getComposerInformation($identifier)) {
  24243. if ($verbose) {
  24244. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  24245. }
  24246. continue;
  24247. }
  24248. if (isset($data['version'])) {
  24249. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  24250. } else {
  24251. $data['version'] = $tag;
  24252. $data['version_normalized'] = $parsedTag;
  24253. }
  24254. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  24255. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  24256. if ($data['version_normalized'] !== $parsedTag) {
  24257. if ($verbose) {
  24258. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24259. }
  24260. continue;
  24261. }
  24262. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24263. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24264. if ($verbose) {
  24265. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24266. }
  24267. continue;
  24268. }
  24269. if ($verbose) {
  24270. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24271. }
  24272. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24273. } catch (\Exception $e) {
  24274. if ($verbose) {
  24275. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24276. }
  24277. continue;
  24278. }
  24279. }
  24280. if (!$verbose) {
  24281. $this->io->overwriteError('', false);
  24282. }
  24283. $branches = $driver->getBranches();
  24284. foreach ($branches as $branch => $identifier) {
  24285. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24286. if ($verbose) {
  24287. $this->io->writeError($msg);
  24288. } else {
  24289. $this->io->overwriteError($msg, false);
  24290. }
  24291. if ($branch === 'trunk' && isset($branches['master'])) {
  24292. if ($verbose) {
  24293. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24294. }
  24295. continue;
  24296. }
  24297. if (!$parsedBranch = $this->validateBranch($branch)) {
  24298. if ($verbose) {
  24299. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24300. }
  24301. continue;
  24302. }
  24303. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24304. $version = 'dev-' . $branch;
  24305. } else {
  24306. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24307. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24308. }
  24309. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $verbose);
  24310. if ($cachedPackage) {
  24311. $this->addPackage($cachedPackage);
  24312. continue;
  24313. }
  24314. try {
  24315. if (!$data = $driver->getComposerInformation($identifier)) {
  24316. if ($verbose) {
  24317. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24318. }
  24319. continue;
  24320. }
  24321. $data['version'] = $version;
  24322. $data['version_normalized'] = $parsedBranch;
  24323. if ($verbose) {
  24324. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24325. }
  24326. $packageData = $this->preProcess($driver, $data, $identifier);
  24327. $package = $this->loader->load($packageData);
  24328. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24329. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24330. }
  24331. $this->addPackage($package);
  24332. } catch (TransportException $e) {
  24333. if ($verbose) {
  24334. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24335. }
  24336. continue;
  24337. } catch (\Exception $e) {
  24338. if (!$verbose) {
  24339. $this->io->writeError('');
  24340. }
  24341. $this->branchErrorOccurred = true;
  24342. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24343. $this->io->writeError('');
  24344. continue;
  24345. }
  24346. }
  24347. $driver->cleanup();
  24348. if (!$verbose) {
  24349. $this->io->overwriteError('', false);
  24350. }
  24351. if (!$this->getPackages()) {
  24352. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24353. }
  24354. }
  24355. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24356. {
  24357. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24358. $data['name'] = $this->packageName ?: $dataPackageName;
  24359. if (!isset($data['dist'])) {
  24360. $data['dist'] = $driver->getDist($identifier);
  24361. }
  24362. if (!isset($data['source'])) {
  24363. $data['source'] = $driver->getSource($identifier);
  24364. }
  24365. return $data;
  24366. }
  24367. private function validateBranch($branch)
  24368. {
  24369. try {
  24370. return $this->versionParser->normalizeBranch($branch);
  24371. } catch (\Exception $e) {
  24372. }
  24373. return false;
  24374. }
  24375. private function validateTag($version)
  24376. {
  24377. try {
  24378. return $this->versionParser->normalize($version);
  24379. } catch (\Exception $e) {
  24380. }
  24381. return false;
  24382. }
  24383. private function getCachedPackageVersion($version, $identifier, $verbose)
  24384. {
  24385. if (!$this->versionCache) {
  24386. return;
  24387. }
  24388. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24389. if ($cachedPackage) {
  24390. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24391. if ($verbose) {
  24392. $this->io->writeError($msg);
  24393. } else {
  24394. $this->io->overwriteError($msg, false);
  24395. }
  24396. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24397. if ($verbose) {
  24398. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  24399. }
  24400. $cachedPackage = null;
  24401. }
  24402. }
  24403. if ($cachedPackage) {
  24404. return $this->loader->load($cachedPackage);
  24405. }
  24406. return null;
  24407. }
  24408. }
  24409. <?php
  24410. namespace Composer\Repository;
  24411. interface VersionCacheInterface
  24412. {
  24413. public function getVersionPackage($version, $identifier);
  24414. }
  24415. <?php
  24416. namespace Composer\Repository;
  24417. use Composer\Package\AliasPackage;
  24418. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24419. {
  24420. public function write()
  24421. {
  24422. }
  24423. public function reload()
  24424. {
  24425. }
  24426. public function getCanonicalPackages()
  24427. {
  24428. $packages = $this->getPackages();
  24429. $packagesByName = array();
  24430. foreach ($packages as $package) {
  24431. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24432. $packagesByName[$package->getName()] = $package;
  24433. }
  24434. }
  24435. $canonicalPackages = array();
  24436. foreach ($packagesByName as $package) {
  24437. while ($package instanceof AliasPackage) {
  24438. $package = $package->getAliasOf();
  24439. }
  24440. $canonicalPackages[] = $package;
  24441. }
  24442. return $canonicalPackages;
  24443. }
  24444. }
  24445. <?php
  24446. namespace Composer\Repository;
  24447. use Composer\Package\PackageInterface;
  24448. interface WritableRepositoryInterface extends RepositoryInterface
  24449. {
  24450. public function write();
  24451. public function addPackage(PackageInterface $package);
  24452. public function removePackage(PackageInterface $package);
  24453. public function getCanonicalPackages();
  24454. public function reload();
  24455. }
  24456. <?php
  24457. namespace Composer\Script;
  24458. class CommandEvent extends Event
  24459. {
  24460. }
  24461. <?php
  24462. namespace Composer\Script;
  24463. use Composer\Composer;
  24464. use Composer\IO\IOInterface;
  24465. use Composer\EventDispatcher\Event as BaseEvent;
  24466. class Event extends BaseEvent
  24467. {
  24468. private $composer;
  24469. private $io;
  24470. private $devMode;
  24471. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24472. {
  24473. parent::__construct($name, $args, $flags);
  24474. $this->composer = $composer;
  24475. $this->io = $io;
  24476. $this->devMode = $devMode;
  24477. }
  24478. public function getComposer()
  24479. {
  24480. return $this->composer;
  24481. }
  24482. public function getIO()
  24483. {
  24484. return $this->io;
  24485. }
  24486. public function isDevMode()
  24487. {
  24488. return $this->devMode;
  24489. }
  24490. }
  24491. <?php
  24492. namespace Composer\Script;
  24493. use Composer\Installer\PackageEvent as BasePackageEvent;
  24494. class PackageEvent extends BasePackageEvent
  24495. {
  24496. }
  24497. <?php
  24498. namespace Composer\Script;
  24499. class ScriptEvents
  24500. {
  24501. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24502. const POST_INSTALL_CMD = 'post-install-cmd';
  24503. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24504. const POST_UPDATE_CMD = 'post-update-cmd';
  24505. const PRE_STATUS_CMD = 'pre-status-cmd';
  24506. const POST_STATUS_CMD = 'post-status-cmd';
  24507. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24508. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24509. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24510. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24511. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24512. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24513. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24514. const POST_PACKAGE_INSTALL = 'post-package-install';
  24515. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24516. const POST_PACKAGE_UPDATE = 'post-package-update';
  24517. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24518. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24519. }
  24520. <?php
  24521. namespace Composer\SelfUpdate;
  24522. class Keys
  24523. {
  24524. public static function fingerprint($path)
  24525. {
  24526. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24527. return implode(' ', array(
  24528. substr($hash, 0, 8),
  24529. substr($hash, 8, 8),
  24530. substr($hash, 16, 8),
  24531. substr($hash, 24, 8),
  24532. '',
  24533. substr($hash, 32, 8),
  24534. substr($hash, 40, 8),
  24535. substr($hash, 48, 8),
  24536. substr($hash, 56, 8),
  24537. ));
  24538. }
  24539. }
  24540. <?php
  24541. namespace Composer\SelfUpdate;
  24542. use Composer\Util\RemoteFilesystem;
  24543. use Composer\Config;
  24544. use Composer\Json\JsonFile;
  24545. class Versions
  24546. {
  24547. private $rfs;
  24548. private $config;
  24549. private $channel;
  24550. public function __construct(Config $config, RemoteFilesystem $rfs)
  24551. {
  24552. $this->rfs = $rfs;
  24553. $this->config = $config;
  24554. }
  24555. public function getChannel()
  24556. {
  24557. if ($this->channel) {
  24558. return $this->channel;
  24559. }
  24560. $channelFile = $this->config->get('home').'/update-channel';
  24561. if (file_exists($channelFile)) {
  24562. $channel = trim(file_get_contents($channelFile));
  24563. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24564. return $this->channel = $channel;
  24565. }
  24566. }
  24567. return $this->channel = 'stable';
  24568. }
  24569. public function setChannel($channel)
  24570. {
  24571. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24572. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24573. }
  24574. $channelFile = $this->config->get('home').'/update-channel';
  24575. $this->channel = $channel;
  24576. file_put_contents($channelFile, $channel.PHP_EOL);
  24577. }
  24578. public function getLatest()
  24579. {
  24580. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24581. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24582. foreach ($versions[$this->getChannel()] as $version) {
  24583. if ($version['min-php'] <= PHP_VERSION_ID) {
  24584. return $version;
  24585. }
  24586. }
  24587. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24588. }
  24589. }
  24590. <?php
  24591. namespace Composer\Util;
  24592. use Composer\Config;
  24593. use Composer\IO\IOInterface;
  24594. class AuthHelper
  24595. {
  24596. protected $io;
  24597. protected $config;
  24598. public function __construct(IOInterface $io, Config $config)
  24599. {
  24600. $this->io = $io;
  24601. $this->config = $config;
  24602. }
  24603. public function storeAuth($originUrl, $storeAuth)
  24604. {
  24605. $store = false;
  24606. $configSource = $this->config->getAuthConfigSource();
  24607. if ($storeAuth === true) {
  24608. $store = $configSource;
  24609. } elseif ($storeAuth === 'prompt') {
  24610. $answer = $this->io->askAndValidate(
  24611. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24612. function ($value) {
  24613. $input = strtolower(substr(trim($value), 0, 1));
  24614. if (in_array($input, array('y','n'))) {
  24615. return $input;
  24616. }
  24617. throw new \RuntimeException('Please answer (y)es or (n)o');
  24618. },
  24619. null,
  24620. 'y'
  24621. );
  24622. if ($answer === 'y') {
  24623. $store = $configSource;
  24624. }
  24625. }
  24626. if ($store) {
  24627. $store->addConfigSetting(
  24628. 'http-basic.'.$originUrl,
  24629. $this->io->getAuthentication($originUrl)
  24630. );
  24631. }
  24632. }
  24633. }
  24634. <?php
  24635. namespace Composer\Util;
  24636. use Composer\Factory;
  24637. use Composer\IO\IOInterface;
  24638. use Composer\Config;
  24639. use Composer\Downloader\TransportException;
  24640. class Bitbucket
  24641. {
  24642. private $io;
  24643. private $config;
  24644. private $process;
  24645. private $remoteFilesystem;
  24646. private $token = array();
  24647. private $time;
  24648. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24649. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24650. {
  24651. $this->io = $io;
  24652. $this->config = $config;
  24653. $this->process = $process ?: new ProcessExecutor($io);
  24654. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24655. $this->time = $time;
  24656. }
  24657. public function getToken()
  24658. {
  24659. if (!isset($this->token['access_token'])) {
  24660. return '';
  24661. }
  24662. return $this->token['access_token'];
  24663. }
  24664. public function authorizeOAuth($originUrl)
  24665. {
  24666. if ($originUrl !== 'bitbucket.org') {
  24667. return false;
  24668. }
  24669. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24670. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24671. return true;
  24672. }
  24673. return false;
  24674. }
  24675. private function requestAccessToken($originUrl)
  24676. {
  24677. try {
  24678. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24679. 'retry-auth-failure' => false,
  24680. 'http' => array(
  24681. 'method' => 'POST',
  24682. 'content' => 'grant_type=client_credentials',
  24683. ),
  24684. ));
  24685. $this->token = json_decode($json, true);
  24686. } catch (TransportException $e) {
  24687. if ($e->getCode() === 400) {
  24688. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24689. $this->io->writeError('This can have two reasons:');
  24690. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24691. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24692. return false;
  24693. } elseif (in_array($e->getCode(), array(403, 401))) {
  24694. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24695. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24696. return false;
  24697. }
  24698. throw $e;
  24699. }
  24700. return true;
  24701. }
  24702. public function authorizeOAuthInteractively($originUrl, $message = null)
  24703. {
  24704. if ($message) {
  24705. $this->io->writeError($message);
  24706. }
  24707. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24708. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24709. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24710. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  24711. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24712. if (!$consumerKey) {
  24713. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  24714. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24715. return false;
  24716. }
  24717. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  24718. if (!$consumerSecret) {
  24719. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  24720. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24721. return false;
  24722. }
  24723. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24724. if (!$this->requestAccessToken($originUrl)) {
  24725. return false;
  24726. }
  24727. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24728. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  24729. $this->io->writeError('<info>Consumer stored successfully.</info>');
  24730. return true;
  24731. }
  24732. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  24733. {
  24734. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  24735. return $this->token['access_token'];
  24736. }
  24737. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24738. if (!$this->requestAccessToken($originUrl)) {
  24739. return '';
  24740. }
  24741. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24742. return $this->token['access_token'];
  24743. }
  24744. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  24745. {
  24746. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  24747. $time = null === $this->time ? time() : $this->time;
  24748. $consumer = array(
  24749. "consumer-key" => $consumerKey,
  24750. "consumer-secret" => $consumerSecret,
  24751. "access-token" => $this->token['access_token'],
  24752. "access-token-expiration" => $time + $this->token['expires_in'],
  24753. );
  24754. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  24755. }
  24756. private function getTokenFromConfig($originUrl)
  24757. {
  24758. $authConfig = $this->config->get('bitbucket-oauth');
  24759. if (
  24760. !isset($authConfig[$originUrl]['access-token'])
  24761. || !isset($authConfig[$originUrl]['access-token-expiration'])
  24762. || time() > $authConfig[$originUrl]['access-token-expiration']
  24763. ) {
  24764. return false;
  24765. }
  24766. $this->token = array(
  24767. 'access_token' => $authConfig[$originUrl]['access-token'],
  24768. );
  24769. return true;
  24770. }
  24771. }
  24772. <?php
  24773. namespace Composer\Util;
  24774. class ComposerMirror
  24775. {
  24776. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  24777. {
  24778. if ($reference) {
  24779. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  24780. }
  24781. $version = strpos($version, '/') === false ? $version : md5($version);
  24782. return str_replace(
  24783. array('%package%', '%version%', '%reference%', '%type%'),
  24784. array($packageName, $version, $reference, $type),
  24785. $mirrorUrl
  24786. );
  24787. }
  24788. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  24789. {
  24790. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  24791. $url = 'gh-'.$match[1].'/'.$match[2];
  24792. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  24793. $url = 'bb-'.$match[1].'/'.$match[2];
  24794. } else {
  24795. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  24796. }
  24797. return str_replace(
  24798. array('%package%', '%normalizedUrl%', '%type%'),
  24799. array($packageName, $url, $type),
  24800. $mirrorUrl
  24801. );
  24802. }
  24803. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  24804. {
  24805. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  24806. }
  24807. }
  24808. <?php
  24809. namespace Composer\Util;
  24810. use Composer\Package\Loader\ArrayLoader;
  24811. use Composer\Package\Loader\ValidatingArrayLoader;
  24812. use Composer\Package\Loader\InvalidPackageException;
  24813. use Composer\Json\JsonValidationException;
  24814. use Composer\IO\IOInterface;
  24815. use Composer\Json\JsonFile;
  24816. use Composer\Spdx\SpdxLicenses;
  24817. class ConfigValidator
  24818. {
  24819. private $io;
  24820. public function __construct(IOInterface $io)
  24821. {
  24822. $this->io = $io;
  24823. }
  24824. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24825. {
  24826. $errors = array();
  24827. $publishErrors = array();
  24828. $warnings = array();
  24829. $laxValid = false;
  24830. try {
  24831. $json = new JsonFile($file, null, $this->io);
  24832. $manifest = $json->read();
  24833. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24834. $laxValid = true;
  24835. $json->validateSchema();
  24836. } catch (JsonValidationException $e) {
  24837. foreach ($e->getErrors() as $message) {
  24838. if ($laxValid) {
  24839. $publishErrors[] = $message;
  24840. } else {
  24841. $errors[] = $message;
  24842. }
  24843. }
  24844. } catch (\Exception $e) {
  24845. $errors[] = $e->getMessage();
  24846. return array($errors, $publishErrors, $warnings);
  24847. }
  24848. if (empty($manifest['license'])) {
  24849. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24850. } else {
  24851. $licenses = (array) $manifest['license'];
  24852. foreach ($licenses as $key => $license) {
  24853. if ('proprietary' === $license) {
  24854. unset($licenses[$key]);
  24855. }
  24856. }
  24857. $licenseValidator = new SpdxLicenses();
  24858. foreach ($licenses as $license) {
  24859. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24860. if ($spdxLicense && $spdxLicense[3]) {
  24861. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24862. $warnings[] = sprintf(
  24863. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24864. $license
  24865. );
  24866. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24867. $warnings[] = sprintf(
  24868. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24869. $license
  24870. );
  24871. } else {
  24872. $warnings[] = sprintf(
  24873. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24874. $license
  24875. );
  24876. }
  24877. }
  24878. }
  24879. }
  24880. if (isset($manifest['version'])) {
  24881. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24882. }
  24883. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24884. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24885. $suggestName = strtolower($suggestName);
  24886. $publishErrors[] = sprintf(
  24887. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  24888. $manifest['name'],
  24889. $suggestName
  24890. );
  24891. }
  24892. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24893. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  24894. }
  24895. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24896. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24897. if (!empty($requireOverrides)) {
  24898. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24899. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24900. }
  24901. }
  24902. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24903. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24904. $packages = array_merge($require, $requireDev);
  24905. foreach ($packages as $package => $version) {
  24906. if (preg_match('/#/', $version) === 1) {
  24907. $warnings[] = sprintf(
  24908. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24909. $package
  24910. );
  24911. }
  24912. }
  24913. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  24914. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  24915. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  24916. if (!array_key_exists($scriptName, $scripts)) {
  24917. $warnings[] = sprintf(
  24918. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  24919. $scriptName
  24920. );
  24921. }
  24922. }
  24923. if (isset($manifest['autoload']['psr-0'][''])) {
  24924. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24925. }
  24926. if (isset($manifest['autoload']['psr-4'][''])) {
  24927. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24928. }
  24929. try {
  24930. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24931. if (!isset($manifest['version'])) {
  24932. $manifest['version'] = '1.0.0';
  24933. }
  24934. if (!isset($manifest['name'])) {
  24935. $manifest['name'] = 'dummy/dummy';
  24936. }
  24937. $loader->load($manifest);
  24938. } catch (InvalidPackageException $e) {
  24939. $errors = array_merge($errors, $e->getErrors());
  24940. }
  24941. $warnings = array_merge($warnings, $loader->getWarnings());
  24942. return array($errors, $publishErrors, $warnings);
  24943. }
  24944. }
  24945. <?php
  24946. namespace Composer\Util;
  24947. use Composer\IO\IOInterface;
  24948. class ErrorHandler
  24949. {
  24950. private static $io;
  24951. public static function handle($level, $message, $file, $line)
  24952. {
  24953. if (!(error_reporting() & $level)) {
  24954. return;
  24955. }
  24956. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  24957. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24958. "\na legitimately suppressed error that you were not supposed to see.";
  24959. }
  24960. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24961. throw new \ErrorException($message, 0, $level, $file, $line);
  24962. }
  24963. if (self::$io) {
  24964. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24965. if (self::$io->isVerbose()) {
  24966. self::$io->writeError('<warning>Stack trace:</warning>');
  24967. self::$io->writeError(array_filter(array_map(function ($a) {
  24968. if (isset($a['line'], $a['file'])) {
  24969. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24970. }
  24971. return null;
  24972. }, array_slice(debug_backtrace(), 2))));
  24973. }
  24974. }
  24975. }
  24976. public static function register(IOInterface $io = null)
  24977. {
  24978. set_error_handler(array(__CLASS__, 'handle'));
  24979. error_reporting(E_ALL | E_STRICT);
  24980. self::$io = $io;
  24981. }
  24982. }
  24983. <?php
  24984. namespace Composer\Util;
  24985. use RecursiveDirectoryIterator;
  24986. use RecursiveIteratorIterator;
  24987. use Symfony\Component\Filesystem\Exception\IOException;
  24988. use Symfony\Component\Finder\Finder;
  24989. class Filesystem
  24990. {
  24991. private $processExecutor;
  24992. public function __construct(ProcessExecutor $executor = null)
  24993. {
  24994. $this->processExecutor = $executor ?: new ProcessExecutor();
  24995. }
  24996. public function remove($file)
  24997. {
  24998. if (is_dir($file)) {
  24999. return $this->removeDirectory($file);
  25000. }
  25001. if (file_exists($file)) {
  25002. return $this->unlink($file);
  25003. }
  25004. return false;
  25005. }
  25006. public function isDirEmpty($dir)
  25007. {
  25008. $finder = Finder::create()
  25009. ->ignoreVCS(false)
  25010. ->ignoreDotFiles(false)
  25011. ->depth(0)
  25012. ->in($dir);
  25013. return count($finder) === 0;
  25014. }
  25015. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  25016. {
  25017. if (file_exists($dir) && is_link($dir)) {
  25018. $this->unlink($dir);
  25019. }
  25020. if ($ensureDirectoryExists) {
  25021. $this->ensureDirectoryExists($dir);
  25022. }
  25023. if (is_dir($dir)) {
  25024. $finder = Finder::create()
  25025. ->ignoreVCS(false)
  25026. ->ignoreDotFiles(false)
  25027. ->depth(0)
  25028. ->in($dir);
  25029. foreach ($finder as $path) {
  25030. $this->remove((string) $path);
  25031. }
  25032. }
  25033. }
  25034. public function removeDirectory($directory)
  25035. {
  25036. if ($this->isSymlinkedDirectory($directory)) {
  25037. return $this->unlinkSymlinkedDirectory($directory);
  25038. }
  25039. if ($this->isJunction($directory)) {
  25040. return $this->removeJunction($directory);
  25041. }
  25042. if (is_link($directory)) {
  25043. return unlink($directory);
  25044. }
  25045. if (!file_exists($directory) || !is_dir($directory)) {
  25046. return true;
  25047. }
  25048. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  25049. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  25050. }
  25051. if (!function_exists('proc_open')) {
  25052. return $this->removeDirectoryPhp($directory);
  25053. }
  25054. if (Platform::isWindows()) {
  25055. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  25056. } else {
  25057. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  25058. }
  25059. $result = $this->getProcess()->execute($cmd, $output) === 0;
  25060. clearstatcache();
  25061. if ($result && !file_exists($directory)) {
  25062. return true;
  25063. }
  25064. return $this->removeDirectoryPhp($directory);
  25065. }
  25066. public function removeDirectoryPhp($directory)
  25067. {
  25068. try {
  25069. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25070. } catch (\UnexpectedValueException $e) {
  25071. clearstatcache();
  25072. usleep(100000);
  25073. if (!is_dir($directory)) {
  25074. return true;
  25075. }
  25076. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25077. }
  25078. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25079. foreach ($ri as $file) {
  25080. if ($file->isDir()) {
  25081. $this->rmdir($file->getPathname());
  25082. } else {
  25083. $this->unlink($file->getPathname());
  25084. }
  25085. }
  25086. return $this->rmdir($directory);
  25087. }
  25088. public function ensureDirectoryExists($directory)
  25089. {
  25090. if (!is_dir($directory)) {
  25091. if (file_exists($directory)) {
  25092. throw new \RuntimeException(
  25093. $directory.' exists and is not a directory.'
  25094. );
  25095. }
  25096. if (!@mkdir($directory, 0777, true)) {
  25097. throw new \RuntimeException(
  25098. $directory.' does not exist and could not be created.'
  25099. );
  25100. }
  25101. }
  25102. }
  25103. public function unlink($path)
  25104. {
  25105. if (!@$this->unlinkImplementation($path)) {
  25106. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  25107. $error = error_get_last();
  25108. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25109. if (Platform::isWindows()) {
  25110. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25111. }
  25112. throw new \RuntimeException($message);
  25113. }
  25114. }
  25115. return true;
  25116. }
  25117. public function rmdir($path)
  25118. {
  25119. if (!@rmdir($path)) {
  25120. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  25121. $error = error_get_last();
  25122. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25123. if (Platform::isWindows()) {
  25124. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25125. }
  25126. throw new \RuntimeException($message);
  25127. }
  25128. }
  25129. return true;
  25130. }
  25131. public function copyThenRemove($source, $target)
  25132. {
  25133. $this->copy($source, $target);
  25134. if (!is_dir($source)) {
  25135. $this->unlink($source);
  25136. return;
  25137. }
  25138. $this->removeDirectoryPhp($source);
  25139. }
  25140. public function copy($source, $target)
  25141. {
  25142. if (!is_dir($source)) {
  25143. return copy($source, $target);
  25144. }
  25145. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  25146. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  25147. $this->ensureDirectoryExists($target);
  25148. $result = true;
  25149. foreach ($ri as $file) {
  25150. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  25151. if ($file->isDir()) {
  25152. $this->ensureDirectoryExists($targetPath);
  25153. } else {
  25154. $result = $result && copy($file->getPathname(), $targetPath);
  25155. }
  25156. }
  25157. return $result;
  25158. }
  25159. public function rename($source, $target)
  25160. {
  25161. if (true === @rename($source, $target)) {
  25162. return;
  25163. }
  25164. if (!function_exists('proc_open')) {
  25165. return $this->copyThenRemove($source, $target);
  25166. }
  25167. if (Platform::isWindows()) {
  25168. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25169. $result = $this->processExecutor->execute($command, $output);
  25170. clearstatcache();
  25171. if (0 === $result) {
  25172. $this->remove($source);
  25173. return;
  25174. }
  25175. } else {
  25176. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25177. $result = $this->processExecutor->execute($command, $output);
  25178. clearstatcache();
  25179. if (0 === $result) {
  25180. return;
  25181. }
  25182. }
  25183. return $this->copyThenRemove($source, $target);
  25184. }
  25185. public function findShortestPath($from, $to, $directories = false)
  25186. {
  25187. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25188. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25189. }
  25190. $from = lcfirst($this->normalizePath($from));
  25191. $to = lcfirst($this->normalizePath($to));
  25192. if ($directories) {
  25193. $from = rtrim($from, '/') . '/dummy_file';
  25194. }
  25195. if (dirname($from) === dirname($to)) {
  25196. return './'.basename($to);
  25197. }
  25198. $commonPath = $to;
  25199. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  25200. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25201. }
  25202. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  25203. return $to;
  25204. }
  25205. $commonPath = rtrim($commonPath, '/') . '/';
  25206. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  25207. $commonPathCode = str_repeat('../', $sourcePathDepth);
  25208. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  25209. }
  25210. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  25211. {
  25212. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25213. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25214. }
  25215. $from = lcfirst($this->normalizePath($from));
  25216. $to = lcfirst($this->normalizePath($to));
  25217. if ($from === $to) {
  25218. return $directories ? '__DIR__' : '__FILE__';
  25219. }
  25220. $commonPath = $to;
  25221. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  25222. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25223. }
  25224. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  25225. return var_export($to, true);
  25226. }
  25227. $commonPath = rtrim($commonPath, '/') . '/';
  25228. if (strpos($to, $from.'/') === 0) {
  25229. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  25230. }
  25231. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  25232. if ($staticCode) {
  25233. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  25234. } else {
  25235. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  25236. }
  25237. $relTarget = substr($to, strlen($commonPath));
  25238. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  25239. }
  25240. public function isAbsolutePath($path)
  25241. {
  25242. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  25243. }
  25244. public function size($path)
  25245. {
  25246. if (!file_exists($path)) {
  25247. throw new \RuntimeException("$path does not exist.");
  25248. }
  25249. if (is_dir($path)) {
  25250. return $this->directorySize($path);
  25251. }
  25252. return filesize($path);
  25253. }
  25254. public function normalizePath($path)
  25255. {
  25256. $parts = array();
  25257. $path = strtr($path, '\\', '/');
  25258. $prefix = '';
  25259. $absolute = false;
  25260. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25261. $prefix = $match[1];
  25262. $path = substr($path, strlen($prefix));
  25263. }
  25264. if (substr($path, 0, 1) === '/') {
  25265. $absolute = true;
  25266. $path = substr($path, 1);
  25267. }
  25268. $up = false;
  25269. foreach (explode('/', $path) as $chunk) {
  25270. if ('..' === $chunk && ($absolute || $up)) {
  25271. array_pop($parts);
  25272. $up = !(empty($parts) || '..' === end($parts));
  25273. } elseif ('.' !== $chunk && '' !== $chunk) {
  25274. $parts[] = $chunk;
  25275. $up = '..' !== $chunk;
  25276. }
  25277. }
  25278. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25279. }
  25280. public static function isLocalPath($path)
  25281. {
  25282. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25283. }
  25284. public static function getPlatformPath($path)
  25285. {
  25286. if (Platform::isWindows()) {
  25287. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25288. }
  25289. return preg_replace('{^file://}i', '', $path);
  25290. }
  25291. protected function directorySize($directory)
  25292. {
  25293. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25294. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25295. $size = 0;
  25296. foreach ($ri as $file) {
  25297. if ($file->isFile()) {
  25298. $size += $file->getSize();
  25299. }
  25300. }
  25301. return $size;
  25302. }
  25303. protected function getProcess()
  25304. {
  25305. return $this->processExecutor;
  25306. }
  25307. private function unlinkImplementation($path)
  25308. {
  25309. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25310. return rmdir($path);
  25311. }
  25312. return unlink($path);
  25313. }
  25314. public function relativeSymlink($target, $link)
  25315. {
  25316. $cwd = getcwd();
  25317. $relativePath = $this->findShortestPath($link, $target);
  25318. chdir(dirname($link));
  25319. $result = @symlink($relativePath, $link);
  25320. chdir($cwd);
  25321. return $result;
  25322. }
  25323. public function isSymlinkedDirectory($directory)
  25324. {
  25325. if (!is_dir($directory)) {
  25326. return false;
  25327. }
  25328. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25329. return is_link($resolved);
  25330. }
  25331. private function unlinkSymlinkedDirectory($directory)
  25332. {
  25333. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25334. return $this->unlink($resolved);
  25335. }
  25336. private function resolveSymlinkedDirectorySymlink($pathname)
  25337. {
  25338. if (!is_dir($pathname)) {
  25339. return $pathname;
  25340. }
  25341. $resolved = rtrim($pathname, '/');
  25342. if (!strlen($resolved)) {
  25343. return $pathname;
  25344. }
  25345. return $resolved;
  25346. }
  25347. public function junction($target, $junction)
  25348. {
  25349. if (!Platform::isWindows()) {
  25350. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25351. }
  25352. if (!is_dir($target)) {
  25353. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25354. }
  25355. $cmd = sprintf(
  25356. 'mklink /J %s %s',
  25357. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25358. ProcessExecutor::escape(realpath($target))
  25359. );
  25360. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25361. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25362. }
  25363. clearstatcache(true, $junction);
  25364. }
  25365. public function isJunction($junction)
  25366. {
  25367. if (!Platform::isWindows()) {
  25368. return false;
  25369. }
  25370. if (!is_dir($junction) || is_link($junction)) {
  25371. return false;
  25372. }
  25373. clearstatcache(true, $junction);
  25374. $stat = lstat($junction);
  25375. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  25376. }
  25377. public function removeJunction($junction)
  25378. {
  25379. if (!Platform::isWindows()) {
  25380. return false;
  25381. }
  25382. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25383. if (!$this->isJunction($junction)) {
  25384. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25385. }
  25386. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  25387. clearstatcache(true, $junction);
  25388. return ($this->getProcess()->execute($cmd, $output) === 0);
  25389. }
  25390. }
  25391. <?php
  25392. namespace Composer\Util;
  25393. use Composer\Config;
  25394. use Composer\IO\IOInterface;
  25395. class Git
  25396. {
  25397. private static $version;
  25398. protected $io;
  25399. protected $config;
  25400. protected $process;
  25401. protected $filesystem;
  25402. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25403. {
  25404. $this->io = $io;
  25405. $this->config = $config;
  25406. $this->process = $process;
  25407. $this->filesystem = $fs;
  25408. }
  25409. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25410. {
  25411. $this->config->prohibitUrlByConfig($url, $this->io);
  25412. if ($initialClone) {
  25413. $origCwd = $cwd;
  25414. $cwd = null;
  25415. }
  25416. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25417. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  25418. }
  25419. if (!$initialClone) {
  25420. $this->process->execute('git remote -v', $output, $cwd);
  25421. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  25422. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25423. }
  25424. }
  25425. $protocols = $this->config->get('github-protocols');
  25426. if (!is_array($protocols)) {
  25427. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25428. }
  25429. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25430. $messages = array();
  25431. foreach ($protocols as $protocol) {
  25432. if ('ssh' === $protocol) {
  25433. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25434. } else {
  25435. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25436. }
  25437. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25438. return;
  25439. }
  25440. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25441. if ($initialClone) {
  25442. $this->filesystem->removeDirectory($origCwd);
  25443. }
  25444. }
  25445. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25446. }
  25447. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25448. $command = call_user_func($commandCallable, $url);
  25449. $auth = null;
  25450. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25451. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  25452. if (!$this->io->hasAuthentication($match[1])) {
  25453. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25454. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25455. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25456. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25457. }
  25458. }
  25459. if ($this->io->hasAuthentication($match[1])) {
  25460. $auth = $this->io->getAuthentication($match[1]);
  25461. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25462. $command = call_user_func($commandCallable, $authUrl);
  25463. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25464. return;
  25465. }
  25466. }
  25467. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25468. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25469. if (!$this->io->hasAuthentication($match[1])) {
  25470. $message = 'Enter your Bitbucket credentials to access private repos';
  25471. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25472. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25473. $accessToken = $bitbucketUtil->getToken();
  25474. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25475. }
  25476. } else {
  25477. $auth = $this->io->getAuthentication($match[1]);
  25478. if ($auth['username'] !== 'x-token-auth') {
  25479. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25480. if (! empty($accessToken)) {
  25481. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25482. }
  25483. }
  25484. }
  25485. if ($this->io->hasAuthentication($match[1])) {
  25486. $auth = $this->io->getAuthentication($match[1]);
  25487. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25488. $command = call_user_func($commandCallable, $authUrl);
  25489. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25490. return;
  25491. }
  25492. } else {
  25493. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25494. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25495. $command = call_user_func($commandCallable, $sshUrl);
  25496. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25497. return;
  25498. }
  25499. }
  25500. } elseif (preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25501. if (!$this->io->hasAuthentication($match[2])) {
  25502. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  25503. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  25504. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  25505. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  25506. }
  25507. }
  25508. if ($this->io->hasAuthentication($match[2])) {
  25509. $auth = $this->io->getAuthentication($match[2]);
  25510. if($auth['password'] === 'private-token' || $auth['password'] === 'oauth2') {
  25511. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  25512. } else {
  25513. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  25514. }
  25515. $command = call_user_func($commandCallable, $authUrl);
  25516. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25517. return;
  25518. }
  25519. }
  25520. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25521. if (strpos($match[2], '@')) {
  25522. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25523. }
  25524. $storeAuth = false;
  25525. if ($this->io->hasAuthentication($match[2])) {
  25526. $auth = $this->io->getAuthentication($match[2]);
  25527. } elseif ($this->io->isInteractive()) {
  25528. $defaultUsername = null;
  25529. if (isset($authParts) && $authParts) {
  25530. if (false !== strpos($authParts, ':')) {
  25531. list($defaultUsername, ) = explode(':', $authParts, 2);
  25532. } else {
  25533. $defaultUsername = $authParts;
  25534. }
  25535. }
  25536. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  25537. $auth = array(
  25538. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25539. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25540. );
  25541. $storeAuth = $this->config->get('store-auths');
  25542. }
  25543. if ($auth) {
  25544. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25545. $command = call_user_func($commandCallable, $authUrl);
  25546. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25547. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25548. $authHelper = new AuthHelper($this->io, $this->config);
  25549. $authHelper->storeAuth($match[2], $storeAuth);
  25550. return;
  25551. }
  25552. }
  25553. }
  25554. if ($initialClone) {
  25555. $this->filesystem->removeDirectory($origCwd);
  25556. }
  25557. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  25558. }
  25559. }
  25560. public function syncMirror($url, $dir)
  25561. {
  25562. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25563. try {
  25564. $commandCallable = function ($url) {
  25565. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  25566. };
  25567. $this->runCommand($commandCallable, $url, $dir);
  25568. } catch (\Exception $e) {
  25569. return false;
  25570. }
  25571. return true;
  25572. }
  25573. $this->filesystem->removeDirectory($dir);
  25574. $commandCallable = function ($url) use ($dir) {
  25575. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25576. };
  25577. $this->runCommand($commandCallable, $url, $dir, true);
  25578. return true;
  25579. }
  25580. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25581. {
  25582. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25583. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25584. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  25585. if ($exitCode === 0) {
  25586. return true;
  25587. }
  25588. }
  25589. $this->syncMirror($url, $dir);
  25590. return false;
  25591. }
  25592. private function isAuthenticationFailure($url, &$match)
  25593. {
  25594. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25595. return false;
  25596. }
  25597. $authFailures = array(
  25598. 'fatal: Authentication failed',
  25599. 'remote error: Invalid username or password.',
  25600. 'error: 401 Unauthorized',
  25601. 'fatal: unable to access',
  25602. 'fatal: could not read Username',
  25603. );
  25604. $errorOutput = $this->process->getErrorOutput();
  25605. foreach ($authFailures as $authFailure) {
  25606. if (strpos($errorOutput, $authFailure) !== false) {
  25607. return true;
  25608. }
  25609. }
  25610. return false;
  25611. }
  25612. public static function cleanEnv()
  25613. {
  25614. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25615. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  25616. }
  25617. if (getenv('GIT_ASKPASS') !== 'echo') {
  25618. putenv('GIT_ASKPASS=echo');
  25619. unset($_SERVER['GIT_ASKPASS']);
  25620. }
  25621. if (getenv('GIT_DIR')) {
  25622. putenv('GIT_DIR');
  25623. unset($_SERVER['GIT_DIR']);
  25624. }
  25625. if (getenv('GIT_WORK_TREE')) {
  25626. putenv('GIT_WORK_TREE');
  25627. unset($_SERVER['GIT_WORK_TREE']);
  25628. }
  25629. if (getenv('LANGUAGE') !== 'C') {
  25630. putenv('LANGUAGE=C');
  25631. }
  25632. putenv("DYLD_LIBRARY_PATH");
  25633. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25634. }
  25635. public static function getGitHubDomainsRegex(Config $config)
  25636. {
  25637. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25638. }
  25639. public static function getGitLabDomainsRegex(Config $config)
  25640. {
  25641. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  25642. }
  25643. public static function sanitizeUrl($message)
  25644. {
  25645. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25646. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25647. return '://***:***@';
  25648. }
  25649. return '://' . $m[1] . ':***@';
  25650. }, $message);
  25651. }
  25652. private function throwException($message, $url)
  25653. {
  25654. clearstatcache();
  25655. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25656. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  25657. }
  25658. throw new \RuntimeException(self::sanitizeUrl($message));
  25659. }
  25660. public function getVersion()
  25661. {
  25662. if (isset(self::$version)) {
  25663. return self::$version;
  25664. }
  25665. if (0 !== $this->process->execute('git --version', $output)) {
  25666. return;
  25667. }
  25668. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25669. return self::$version = $matches[1];
  25670. }
  25671. }
  25672. }
  25673. <?php
  25674. namespace Composer\Util;
  25675. use Composer\Factory;
  25676. use Composer\IO\IOInterface;
  25677. use Composer\Config;
  25678. use Composer\Downloader\TransportException;
  25679. class GitHub
  25680. {
  25681. protected $io;
  25682. protected $config;
  25683. protected $process;
  25684. protected $remoteFilesystem;
  25685. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25686. {
  25687. $this->io = $io;
  25688. $this->config = $config;
  25689. $this->process = $process ?: new ProcessExecutor($io);
  25690. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25691. }
  25692. public function authorizeOAuth($originUrl)
  25693. {
  25694. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  25695. return false;
  25696. }
  25697. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  25698. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  25699. return true;
  25700. }
  25701. return false;
  25702. }
  25703. public function authorizeOAuthInteractively($originUrl, $message = null)
  25704. {
  25705. if ($message) {
  25706. $this->io->writeError($message);
  25707. }
  25708. $note = 'Composer';
  25709. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  25710. $note .= ' on ' . trim($output);
  25711. }
  25712. $note .= ' ' . date('Y-m-d Hi');
  25713. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  25714. $this->io->writeError(sprintf('Head to %s', $url));
  25715. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25716. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  25717. if (!$token) {
  25718. $this->io->writeError('<warning>No token given, aborting.</warning>');
  25719. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25720. return false;
  25721. }
  25722. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  25723. try {
  25724. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  25725. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  25726. 'retry-auth-failure' => false,
  25727. ));
  25728. } catch (TransportException $e) {
  25729. if (in_array($e->getCode(), array(403, 401))) {
  25730. $this->io->writeError('<error>Invalid token provided.</error>');
  25731. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25732. return false;
  25733. }
  25734. throw $e;
  25735. }
  25736. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  25737. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  25738. $this->io->writeError('<info>Token stored successfully.</info>');
  25739. return true;
  25740. }
  25741. public function getRateLimit(array $headers)
  25742. {
  25743. $rateLimit = array(
  25744. 'limit' => '?',
  25745. 'reset' => '?',
  25746. );
  25747. foreach ($headers as $header) {
  25748. $header = trim($header);
  25749. if (false === strpos($header, 'X-RateLimit-')) {
  25750. continue;
  25751. }
  25752. list($type, $value) = explode(':', $header, 2);
  25753. switch ($type) {
  25754. case 'X-RateLimit-Limit':
  25755. $rateLimit['limit'] = (int) trim($value);
  25756. break;
  25757. case 'X-RateLimit-Reset':
  25758. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  25759. break;
  25760. }
  25761. }
  25762. return $rateLimit;
  25763. }
  25764. public function isRateLimited(array $headers)
  25765. {
  25766. foreach ($headers as $header) {
  25767. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  25768. return true;
  25769. }
  25770. }
  25771. return false;
  25772. }
  25773. }
  25774. <?php
  25775. namespace Composer\Util;
  25776. use Composer\IO\IOInterface;
  25777. use Composer\Config;
  25778. use Composer\Factory;
  25779. use Composer\Downloader\TransportException;
  25780. use Composer\Json\JsonFile;
  25781. class GitLab
  25782. {
  25783. protected $io;
  25784. protected $config;
  25785. protected $process;
  25786. protected $remoteFilesystem;
  25787. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25788. {
  25789. $this->io = $io;
  25790. $this->config = $config;
  25791. $this->process = $process ?: new ProcessExecutor($io);
  25792. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25793. }
  25794. public function authorizeOAuth($originUrl)
  25795. {
  25796. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25797. return false;
  25798. }
  25799. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  25800. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  25801. return true;
  25802. }
  25803. $authTokens = $this->config->get('gitlab-token');
  25804. if (isset($authTokens[$originUrl])) {
  25805. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  25806. return true;
  25807. }
  25808. return false;
  25809. }
  25810. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  25811. {
  25812. if ($message) {
  25813. $this->io->writeError($message);
  25814. }
  25815. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  25816. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  25817. $attemptCounter = 0;
  25818. while ($attemptCounter++ < 5) {
  25819. try {
  25820. $response = $this->createToken($scheme, $originUrl);
  25821. } catch (TransportException $e) {
  25822. if (in_array($e->getCode(), array(403, 401))) {
  25823. if (401 === $e->getCode()) {
  25824. $this->io->writeError('Bad credentials.');
  25825. } else {
  25826. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  25827. }
  25828. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  25829. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  25830. continue;
  25831. }
  25832. throw $e;
  25833. }
  25834. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  25835. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  25836. return true;
  25837. }
  25838. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  25839. }
  25840. private function createToken($scheme, $originUrl)
  25841. {
  25842. $username = $this->io->ask('Username: ');
  25843. $password = $this->io->askAndHideAnswer('Password: ');
  25844. $headers = array('Content-Type: application/x-www-form-urlencoded');
  25845. $apiUrl = $originUrl;
  25846. $data = http_build_query(array(
  25847. 'username' => $username,
  25848. 'password' => $password,
  25849. 'grant_type' => 'password',
  25850. ), null, '&');
  25851. $options = array(
  25852. 'retry-auth-failure' => false,
  25853. 'http' => array(
  25854. 'method' => 'POST',
  25855. 'header' => $headers,
  25856. 'content' => $data,
  25857. ),
  25858. );
  25859. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  25860. $this->io->writeError('Token successfully created');
  25861. return JsonFile::parseJson($json);
  25862. }
  25863. }
  25864. <?php
  25865. namespace Composer\Util;
  25866. use Composer\Config;
  25867. use Composer\IO\IOInterface;
  25868. class Hg
  25869. {
  25870. private $io;
  25871. private $config;
  25872. private $process;
  25873. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  25874. {
  25875. $this->io = $io;
  25876. $this->config = $config;
  25877. $this->process = $process;
  25878. }
  25879. public function runCommand($commandCallable, $url, $cwd)
  25880. {
  25881. $this->config->prohibitUrlByConfig($url, $this->io);
  25882. $command = call_user_func($commandCallable, $url);
  25883. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25884. return;
  25885. }
  25886. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  25887. $auth = $this->io->getAuthentication($match[5]);
  25888. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  25889. $command = call_user_func($commandCallable, $authenticatedUrl);
  25890. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25891. return;
  25892. }
  25893. $error = $this->process->getErrorOutput();
  25894. } else {
  25895. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  25896. }
  25897. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  25898. }
  25899. public static function sanitizeUrl($message)
  25900. {
  25901. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25902. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25903. return '://***:***@';
  25904. }
  25905. return '://' . $m[1] . ':***@';
  25906. }, $message);
  25907. }
  25908. private function throwException($message, $url)
  25909. {
  25910. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  25911. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  25912. }
  25913. throw new \RuntimeException(self::sanitizeUrl($message));
  25914. }
  25915. }
  25916. <?php
  25917. namespace Composer\Util;
  25918. use Composer\XdebugHandler\XdebugHandler;
  25919. class IniHelper
  25920. {
  25921. public static function getAll()
  25922. {
  25923. return XdebugHandler::getAllIniFiles();
  25924. }
  25925. public static function getMessage()
  25926. {
  25927. $paths = self::getAll();
  25928. if (empty($paths[0])) {
  25929. array_shift($paths);
  25930. }
  25931. $ini = array_shift($paths);
  25932. if (empty($ini)) {
  25933. return 'A php.ini file does not exist. You will have to create one.';
  25934. }
  25935. if (!empty($paths)) {
  25936. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  25937. }
  25938. return 'The php.ini used by your command-line PHP is: '.$ini;
  25939. }
  25940. }
  25941. <?php
  25942. namespace Composer\Util;
  25943. class NoProxyPattern
  25944. {
  25945. protected $rules = array();
  25946. public function __construct($pattern)
  25947. {
  25948. $this->rules = preg_split("/[\s,]+/", $pattern);
  25949. }
  25950. public function test($url)
  25951. {
  25952. $host = parse_url($url, PHP_URL_HOST);
  25953. $port = parse_url($url, PHP_URL_PORT);
  25954. if (empty($port)) {
  25955. switch (parse_url($url, PHP_URL_SCHEME)) {
  25956. case 'http':
  25957. $port = 80;
  25958. break;
  25959. case 'https':
  25960. $port = 443;
  25961. break;
  25962. }
  25963. }
  25964. foreach ($this->rules as $rule) {
  25965. if ($rule == '*') {
  25966. return true;
  25967. }
  25968. $match = false;
  25969. list($ruleHost) = explode(':', $rule);
  25970. list($base) = explode('/', $ruleHost);
  25971. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25972. if (!isset($ip)) {
  25973. $ip = gethostbyname($host);
  25974. }
  25975. if (strpos($ruleHost, '/') === false) {
  25976. $match = $ip === $ruleHost;
  25977. } else {
  25978. if ($ip === $host) {
  25979. $match = false;
  25980. } else {
  25981. $match = self::inCIDRBlock($ruleHost, $ip);
  25982. }
  25983. }
  25984. } else {
  25985. $haystack = '.' . trim($host, '.') . '.';
  25986. $needle = '.'. trim($ruleHost, '.') .'.';
  25987. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25988. }
  25989. if ($match && strpos($rule, ':') !== false) {
  25990. list(, $rulePort) = explode(':', $rule);
  25991. if (!empty($rulePort) && $port != $rulePort) {
  25992. $match = false;
  25993. }
  25994. }
  25995. if ($match) {
  25996. return true;
  25997. }
  25998. }
  25999. return false;
  26000. }
  26001. private static function inCIDRBlock($cidr, $ip)
  26002. {
  26003. list($base, $bits) = explode('/', $cidr);
  26004. list($a, $b, $c, $d) = explode('.', $base);
  26005. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26006. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  26007. $low = $i & $mask;
  26008. $high = $i | (~$mask & 0xFFFFFFFF);
  26009. list($a, $b, $c, $d) = explode('.', $ip);
  26010. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26011. return $check >= $low && $check <= $high;
  26012. }
  26013. }
  26014. <?php
  26015. namespace Composer\Util;
  26016. use Composer\IO\IOInterface;
  26017. use Symfony\Component\Process\Process;
  26018. class Perforce
  26019. {
  26020. protected $path;
  26021. protected $p4Depot;
  26022. protected $p4Client;
  26023. protected $p4User;
  26024. protected $p4Password;
  26025. protected $p4Port;
  26026. protected $p4Stream;
  26027. protected $p4ClientSpec;
  26028. protected $p4DepotType;
  26029. protected $p4Branch;
  26030. protected $process;
  26031. protected $uniquePerforceClientName;
  26032. protected $windowsFlag;
  26033. protected $commandResult;
  26034. protected $io;
  26035. protected $filesystem;
  26036. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  26037. {
  26038. $this->windowsFlag = $isWindows;
  26039. $this->p4Port = $port;
  26040. $this->initializePath($path);
  26041. $this->process = $process;
  26042. $this->initialize($repoConfig);
  26043. $this->io = $io;
  26044. }
  26045. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  26046. {
  26047. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  26048. }
  26049. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  26050. {
  26051. $output = null;
  26052. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  26053. }
  26054. public function initialize($repoConfig)
  26055. {
  26056. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  26057. if (!$repoConfig) {
  26058. return;
  26059. }
  26060. if (isset($repoConfig['unique_perforce_client_name'])) {
  26061. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  26062. }
  26063. if (isset($repoConfig['depot'])) {
  26064. $this->p4Depot = $repoConfig['depot'];
  26065. }
  26066. if (isset($repoConfig['branch'])) {
  26067. $this->p4Branch = $repoConfig['branch'];
  26068. }
  26069. if (isset($repoConfig['p4user'])) {
  26070. $this->p4User = $repoConfig['p4user'];
  26071. } else {
  26072. $this->p4User = $this->getP4variable('P4USER');
  26073. }
  26074. if (isset($repoConfig['p4password'])) {
  26075. $this->p4Password = $repoConfig['p4password'];
  26076. }
  26077. }
  26078. public function initializeDepotAndBranch($depot, $branch)
  26079. {
  26080. if (isset($depot)) {
  26081. $this->p4Depot = $depot;
  26082. }
  26083. if (isset($branch)) {
  26084. $this->p4Branch = $branch;
  26085. }
  26086. }
  26087. public function generateUniquePerforceClientName()
  26088. {
  26089. return gethostname() . "_" . time();
  26090. }
  26091. public function cleanupClientSpec()
  26092. {
  26093. $client = $this->getClient();
  26094. $task = 'client -d ' . ProcessExecutor::escape($client);
  26095. $useP4Client = false;
  26096. $command = $this->generateP4Command($task, $useP4Client);
  26097. $this->executeCommand($command);
  26098. $clientSpec = $this->getP4ClientSpec();
  26099. $fileSystem = $this->getFilesystem();
  26100. $fileSystem->remove($clientSpec);
  26101. }
  26102. protected function executeCommand($command)
  26103. {
  26104. $this->commandResult = '';
  26105. return $this->process->execute($command, $this->commandResult);
  26106. }
  26107. public function getClient()
  26108. {
  26109. if (!isset($this->p4Client)) {
  26110. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  26111. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  26112. }
  26113. return $this->p4Client;
  26114. }
  26115. protected function getPath()
  26116. {
  26117. return $this->path;
  26118. }
  26119. public function initializePath($path)
  26120. {
  26121. $this->path = $path;
  26122. $fs = $this->getFilesystem();
  26123. $fs->ensureDirectoryExists($path);
  26124. }
  26125. protected function getPort()
  26126. {
  26127. return $this->p4Port;
  26128. }
  26129. public function setStream($stream)
  26130. {
  26131. $this->p4Stream = $stream;
  26132. $index = strrpos($stream, '/');
  26133. if ($index > 2) {
  26134. $this->p4DepotType = 'stream';
  26135. }
  26136. }
  26137. public function isStream()
  26138. {
  26139. return (strcmp($this->p4DepotType, 'stream') === 0);
  26140. }
  26141. public function getStream()
  26142. {
  26143. if (!isset($this->p4Stream)) {
  26144. if ($this->isStream()) {
  26145. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  26146. } else {
  26147. $this->p4Stream = '//' . $this->p4Depot;
  26148. }
  26149. }
  26150. return $this->p4Stream;
  26151. }
  26152. public function getStreamWithoutLabel($stream)
  26153. {
  26154. $index = strpos($stream, '@');
  26155. if ($index === false) {
  26156. return $stream;
  26157. }
  26158. return substr($stream, 0, $index);
  26159. }
  26160. public function getP4ClientSpec()
  26161. {
  26162. return $this->path . '/' . $this->getClient() . '.p4.spec';
  26163. }
  26164. public function getUser()
  26165. {
  26166. return $this->p4User;
  26167. }
  26168. public function setUser($user)
  26169. {
  26170. $this->p4User = $user;
  26171. }
  26172. public function queryP4User()
  26173. {
  26174. $this->getUser();
  26175. if (strlen($this->p4User) > 0) {
  26176. return;
  26177. }
  26178. $this->p4User = $this->getP4variable('P4USER');
  26179. if (strlen($this->p4User) > 0) {
  26180. return;
  26181. }
  26182. $this->p4User = $this->io->ask('Enter P4 User:');
  26183. if ($this->windowsFlag) {
  26184. $command = 'p4 set P4USER=' . $this->p4User;
  26185. } else {
  26186. $command = 'export P4USER=' . $this->p4User;
  26187. }
  26188. $this->executeCommand($command);
  26189. }
  26190. protected function getP4variable($name)
  26191. {
  26192. if ($this->windowsFlag) {
  26193. $command = 'p4 set';
  26194. $this->executeCommand($command);
  26195. $result = trim($this->commandResult);
  26196. $resArray = explode(PHP_EOL, $result);
  26197. foreach ($resArray as $line) {
  26198. $fields = explode('=', $line);
  26199. if (strcmp($name, $fields[0]) == 0) {
  26200. $index = strpos($fields[1], ' ');
  26201. if ($index === false) {
  26202. $value = $fields[1];
  26203. } else {
  26204. $value = substr($fields[1], 0, $index);
  26205. }
  26206. $value = trim($value);
  26207. return $value;
  26208. }
  26209. }
  26210. return null;
  26211. }
  26212. $command = 'echo $' . $name;
  26213. $this->executeCommand($command);
  26214. $result = trim($this->commandResult);
  26215. return $result;
  26216. }
  26217. public function queryP4Password()
  26218. {
  26219. if (isset($this->p4Password)) {
  26220. return $this->p4Password;
  26221. }
  26222. $password = $this->getP4variable('P4PASSWD');
  26223. if (strlen($password) <= 0) {
  26224. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  26225. }
  26226. $this->p4Password = $password;
  26227. return $password;
  26228. }
  26229. public function generateP4Command($command, $useClient = true)
  26230. {
  26231. $p4Command = 'p4 ';
  26232. $p4Command .= '-u ' . $this->getUser() . ' ';
  26233. if ($useClient) {
  26234. $p4Command .= '-c ' . $this->getClient() . ' ';
  26235. }
  26236. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  26237. return $p4Command;
  26238. }
  26239. public function isLoggedIn()
  26240. {
  26241. $command = $this->generateP4Command('login -s', false);
  26242. $exitCode = $this->executeCommand($command);
  26243. if ($exitCode) {
  26244. $errorOutput = $this->process->getErrorOutput();
  26245. $index = strpos($errorOutput, $this->getUser());
  26246. if ($index === false) {
  26247. $index = strpos($errorOutput, 'p4');
  26248. if ($index === false) {
  26249. return false;
  26250. }
  26251. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  26252. }
  26253. throw new \Exception('Invalid user name: ' . $this->getUser());
  26254. }
  26255. return true;
  26256. }
  26257. public function connectClient()
  26258. {
  26259. $p4CreateClientCommand = $this->generateP4Command(
  26260. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  26261. );
  26262. $this->executeCommand($p4CreateClientCommand);
  26263. }
  26264. public function syncCodeBase($sourceReference)
  26265. {
  26266. $prevDir = getcwd();
  26267. chdir($this->path);
  26268. $p4SyncCommand = $this->generateP4Command('sync -f ');
  26269. if (null !== $sourceReference) {
  26270. $p4SyncCommand .= '@' . $sourceReference;
  26271. }
  26272. $this->executeCommand($p4SyncCommand);
  26273. chdir($prevDir);
  26274. }
  26275. public function writeClientSpecToFile($spec)
  26276. {
  26277. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  26278. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  26279. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  26280. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  26281. fwrite($spec, 'Description:' . PHP_EOL);
  26282. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26283. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26284. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26285. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26286. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26287. if ($this->isStream()) {
  26288. fwrite($spec, 'Stream:' . PHP_EOL);
  26289. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26290. } else {
  26291. fwrite(
  26292. $spec,
  26293. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26294. );
  26295. }
  26296. }
  26297. public function writeP4ClientSpec()
  26298. {
  26299. $clientSpec = $this->getP4ClientSpec();
  26300. $spec = fopen($clientSpec, 'w');
  26301. try {
  26302. $this->writeClientSpecToFile($spec);
  26303. } catch (\Exception $e) {
  26304. fclose($spec);
  26305. throw $e;
  26306. }
  26307. fclose($spec);
  26308. }
  26309. protected function read($pipe, $name)
  26310. {
  26311. if (feof($pipe)) {
  26312. return;
  26313. }
  26314. $line = fgets($pipe);
  26315. while ($line !== false) {
  26316. $line = fgets($pipe);
  26317. }
  26318. return;
  26319. }
  26320. public function windowsLogin($password)
  26321. {
  26322. $command = $this->generateP4Command(' login -a');
  26323. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26324. $process = Process::fromShellCommandline($command, null, null, $password);
  26325. } else {
  26326. $process = new Process($command, null, null, $password);
  26327. }
  26328. return $process->run();
  26329. }
  26330. public function p4Login()
  26331. {
  26332. $this->queryP4User();
  26333. if (!$this->isLoggedIn()) {
  26334. $password = $this->queryP4Password();
  26335. if ($this->windowsFlag) {
  26336. $this->windowsLogin($password);
  26337. } else {
  26338. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26339. $exitCode = $this->executeCommand($command);
  26340. $result = trim($this->commandResult);
  26341. if ($exitCode) {
  26342. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26343. }
  26344. }
  26345. }
  26346. }
  26347. public function getComposerInformation($identifier)
  26348. {
  26349. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26350. if (!$composerFileContent) {
  26351. return;
  26352. }
  26353. return json_decode($composerFileContent, true);
  26354. }
  26355. public function getFileContent($file, $identifier)
  26356. {
  26357. $path = $this->getFilePath($file, $identifier);
  26358. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26359. $this->executeCommand($command);
  26360. $result = $this->commandResult;
  26361. if (!trim($result)) {
  26362. return null;
  26363. }
  26364. return $result;
  26365. }
  26366. public function getFilePath($file, $identifier)
  26367. {
  26368. $index = strpos($identifier, '@');
  26369. if ($index === false) {
  26370. $path = $identifier. '/' . $file;
  26371. return $path;
  26372. }
  26373. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26374. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26375. $this->executeCommand($command);
  26376. $result = $this->commandResult;
  26377. $index2 = strpos($result, 'no such file(s).');
  26378. if ($index2 === false) {
  26379. $index3 = strpos($result, 'change');
  26380. if ($index3 !== false) {
  26381. $phrase = trim(substr($result, $index3));
  26382. $fields = explode(' ', $phrase);
  26383. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26384. }
  26385. }
  26386. return null;
  26387. }
  26388. public function getBranches()
  26389. {
  26390. $possibleBranches = array();
  26391. if (!$this->isStream()) {
  26392. $possibleBranches[$this->p4Branch] = $this->getStream();
  26393. } else {
  26394. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26395. $this->executeCommand($command);
  26396. $result = $this->commandResult;
  26397. $resArray = explode(PHP_EOL, $result);
  26398. foreach ($resArray as $line) {
  26399. $resBits = explode(' ', $line);
  26400. if (count($resBits) > 4) {
  26401. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26402. $possibleBranches[$branch] = $resBits[1];
  26403. }
  26404. }
  26405. }
  26406. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26407. $this->executeCommand($command);
  26408. $result = $this->commandResult;
  26409. $resArray = explode(PHP_EOL, $result);
  26410. $lastCommit = $resArray[0];
  26411. $lastCommitArr = explode(' ', $lastCommit);
  26412. $lastCommitNum = $lastCommitArr[1];
  26413. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26414. return $branches;
  26415. }
  26416. public function getTags()
  26417. {
  26418. $command = $this->generateP4Command('labels');
  26419. $this->executeCommand($command);
  26420. $result = $this->commandResult;
  26421. $resArray = explode(PHP_EOL, $result);
  26422. $tags = array();
  26423. foreach ($resArray as $line) {
  26424. if (strpos($line, 'Label') !== false) {
  26425. $fields = explode(' ', $line);
  26426. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26427. }
  26428. }
  26429. return $tags;
  26430. }
  26431. public function checkStream()
  26432. {
  26433. $command = $this->generateP4Command('depots', false);
  26434. $this->executeCommand($command);
  26435. $result = $this->commandResult;
  26436. $resArray = explode(PHP_EOL, $result);
  26437. foreach ($resArray as $line) {
  26438. if (strpos($line, 'Depot') !== false) {
  26439. $fields = explode(' ', $line);
  26440. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26441. $this->p4DepotType = $fields[3];
  26442. return $this->isStream();
  26443. }
  26444. }
  26445. }
  26446. return false;
  26447. }
  26448. protected function getChangeList($reference)
  26449. {
  26450. $index = strpos($reference, '@');
  26451. if ($index === false) {
  26452. return null;
  26453. }
  26454. $label = substr($reference, $index);
  26455. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26456. $this->executeCommand($command);
  26457. $changes = $this->commandResult;
  26458. if (strpos($changes, 'Change') !== 0) {
  26459. return null;
  26460. }
  26461. $fields = explode(' ', $changes);
  26462. return $fields[1];
  26463. }
  26464. public function getCommitLogs($fromReference, $toReference)
  26465. {
  26466. $fromChangeList = $this->getChangeList($fromReference);
  26467. if ($fromChangeList === null) {
  26468. return null;
  26469. }
  26470. $toChangeList = $this->getChangeList($toReference);
  26471. if ($toChangeList === null) {
  26472. return null;
  26473. }
  26474. $index = strpos($fromReference, '@');
  26475. $main = substr($fromReference, 0, $index) . '/...';
  26476. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26477. $this->executeCommand($command);
  26478. return $this->commandResult;
  26479. }
  26480. public function getFilesystem()
  26481. {
  26482. if (empty($this->filesystem)) {
  26483. $this->filesystem = new Filesystem($this->process);
  26484. }
  26485. return $this->filesystem;
  26486. }
  26487. public function setFilesystem(Filesystem $fs)
  26488. {
  26489. $this->filesystem = $fs;
  26490. }
  26491. }
  26492. <?php
  26493. namespace Composer\Util;
  26494. class Platform
  26495. {
  26496. public static function expandPath($path)
  26497. {
  26498. if (preg_match('#^~[\\/]#', $path)) {
  26499. return self::getUserDirectory() . substr($path, 1);
  26500. }
  26501. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26502. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26503. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26504. }
  26505. return getenv($matches['var']) . $matches['path'];
  26506. }, $path);
  26507. }
  26508. public static function getUserDirectory()
  26509. {
  26510. if (false !== ($home = getenv('HOME'))) {
  26511. return $home;
  26512. }
  26513. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26514. return $home;
  26515. }
  26516. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26517. $info = posix_getpwuid(posix_getuid());
  26518. return $info['dir'];
  26519. }
  26520. throw new \RuntimeException('Could not determine user directory');
  26521. }
  26522. public static function isWindows()
  26523. {
  26524. return defined('PHP_WINDOWS_VERSION_BUILD');
  26525. }
  26526. public static function strlen($str)
  26527. {
  26528. static $useMbString = null;
  26529. if (null === $useMbString) {
  26530. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26531. }
  26532. if ($useMbString) {
  26533. return mb_strlen($str, '8bit');
  26534. }
  26535. return strlen($str);
  26536. }
  26537. }
  26538. <?php
  26539. namespace Composer\Util;
  26540. use Composer\IO\IOInterface;
  26541. use Symfony\Component\Process\Process;
  26542. use Symfony\Component\Process\ProcessUtils;
  26543. class ProcessExecutor
  26544. {
  26545. protected static $timeout = 300;
  26546. protected $captureOutput;
  26547. protected $errorOutput;
  26548. protected $io;
  26549. public function __construct(IOInterface $io = null)
  26550. {
  26551. $this->io = $io;
  26552. }
  26553. public function execute($command, &$output = null, $cwd = null)
  26554. {
  26555. if ($this->io && $this->io->isDebug()) {
  26556. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26557. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26558. return '://***:***@';
  26559. }
  26560. return '://'.$m['user'].':***@';
  26561. }, $command);
  26562. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26563. }
  26564. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26565. $cwd = realpath(getcwd());
  26566. }
  26567. $this->captureOutput = func_num_args() > 1;
  26568. $this->errorOutput = null;
  26569. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26570. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  26571. } else {
  26572. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26573. }
  26574. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26575. $process->run($callback);
  26576. if ($this->captureOutput && !is_callable($output)) {
  26577. $output = $process->getOutput();
  26578. }
  26579. $this->errorOutput = $process->getErrorOutput();
  26580. return $process->getExitCode();
  26581. }
  26582. public function splitLines($output)
  26583. {
  26584. $output = trim($output);
  26585. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26586. }
  26587. public function getErrorOutput()
  26588. {
  26589. return $this->errorOutput;
  26590. }
  26591. public function outputHandler($type, $buffer)
  26592. {
  26593. if ($this->captureOutput) {
  26594. return;
  26595. }
  26596. if (null === $this->io) {
  26597. echo $buffer;
  26598. return;
  26599. }
  26600. if (Process::ERR === $type) {
  26601. $this->io->writeError($buffer, false);
  26602. } else {
  26603. $this->io->write($buffer, false);
  26604. }
  26605. }
  26606. public static function getTimeout()
  26607. {
  26608. return static::$timeout;
  26609. }
  26610. public static function setTimeout($timeout)
  26611. {
  26612. static::$timeout = $timeout;
  26613. }
  26614. public static function escape($argument)
  26615. {
  26616. return self::escapeArgument($argument);
  26617. }
  26618. private static function escapeArgument($argument)
  26619. {
  26620. if ('\\' === DIRECTORY_SEPARATOR) {
  26621. if ('' === $argument) {
  26622. return escapeshellarg($argument);
  26623. }
  26624. $escapedArgument = '';
  26625. $quote = false;
  26626. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  26627. if ('"' === $part) {
  26628. $escapedArgument .= '\\"';
  26629. } elseif (self::isSurroundedBy($part, '%')) {
  26630. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  26631. } else {
  26632. if ('\\' === substr($part, -1)) {
  26633. $part .= '\\';
  26634. }
  26635. $quote = true;
  26636. $escapedArgument .= $part;
  26637. }
  26638. }
  26639. if ($quote) {
  26640. $escapedArgument = '"'.$escapedArgument.'"';
  26641. }
  26642. return $escapedArgument;
  26643. }
  26644. return "'".str_replace("'", "'\\''", $argument)."'";
  26645. }
  26646. private static function isSurroundedBy($arg, $char)
  26647. {
  26648. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  26649. }
  26650. }
  26651. <?php
  26652. namespace Composer\Util;
  26653. use Composer\Config;
  26654. use Composer\IO\IOInterface;
  26655. use Composer\Downloader\TransportException;
  26656. use Composer\CaBundle\CaBundle;
  26657. use Psr\Log\LoggerInterface;
  26658. class RemoteFilesystem
  26659. {
  26660. private $io;
  26661. private $config;
  26662. private $scheme;
  26663. private $bytesMax;
  26664. private $originUrl;
  26665. private $fileUrl;
  26666. private $fileName;
  26667. private $retry;
  26668. private $progress;
  26669. private $lastProgress;
  26670. private $options = array();
  26671. private $peerCertificateMap = array();
  26672. private $disableTls = false;
  26673. private $retryAuthFailure;
  26674. private $lastHeaders;
  26675. private $storeAuth;
  26676. private $degradedMode = false;
  26677. private $redirects;
  26678. private $maxRedirects = 20;
  26679. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  26680. {
  26681. $this->io = $io;
  26682. if ($disableTls === false) {
  26683. $this->options = $this->getTlsDefaults($options);
  26684. } else {
  26685. $this->disableTls = true;
  26686. }
  26687. $this->options = array_replace_recursive($this->options, $options);
  26688. $this->config = $config;
  26689. }
  26690. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  26691. {
  26692. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  26693. }
  26694. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  26695. {
  26696. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  26697. }
  26698. public function getOptions()
  26699. {
  26700. return $this->options;
  26701. }
  26702. public function setOptions(array $options)
  26703. {
  26704. $this->options = array_replace_recursive($this->options, $options);
  26705. }
  26706. public function isTlsDisabled()
  26707. {
  26708. return $this->disableTls === true;
  26709. }
  26710. public function getLastHeaders()
  26711. {
  26712. return $this->lastHeaders;
  26713. }
  26714. public function findHeaderValue(array $headers, $name)
  26715. {
  26716. $value = null;
  26717. foreach ($headers as $header) {
  26718. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  26719. $value = $match[1];
  26720. } elseif (preg_match('{^HTTP/}i', $header)) {
  26721. $value = null;
  26722. }
  26723. }
  26724. return $value;
  26725. }
  26726. public function findStatusCode(array $headers)
  26727. {
  26728. $value = null;
  26729. foreach ($headers as $header) {
  26730. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  26731. $value = (int) $match[1];
  26732. }
  26733. }
  26734. return $value;
  26735. }
  26736. public function findStatusMessage(array $headers)
  26737. {
  26738. $value = null;
  26739. foreach ($headers as $header) {
  26740. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  26741. $value = $header;
  26742. }
  26743. }
  26744. return $value;
  26745. }
  26746. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  26747. {
  26748. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  26749. $originUrl = 'github.com';
  26750. }
  26751. if (
  26752. $this->config
  26753. && is_array($this->config->get('gitlab-domains'))
  26754. && false === strpos($originUrl, '/')
  26755. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  26756. ) {
  26757. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  26758. if (0 === strpos($gitlabDomain, $originUrl)) {
  26759. $originUrl = $gitlabDomain;
  26760. break;
  26761. }
  26762. }
  26763. unset($gitlabDomain);
  26764. }
  26765. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  26766. $this->bytesMax = 0;
  26767. $this->originUrl = $originUrl;
  26768. $this->fileUrl = $fileUrl;
  26769. $this->fileName = $fileName;
  26770. $this->progress = $progress;
  26771. $this->lastProgress = null;
  26772. $this->retryAuthFailure = true;
  26773. $this->lastHeaders = array();
  26774. $this->redirects = 1;
  26775. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  26776. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  26777. }
  26778. $tempAdditionalOptions = $additionalOptions;
  26779. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  26780. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  26781. unset($tempAdditionalOptions['retry-auth-failure']);
  26782. }
  26783. $isRedirect = false;
  26784. if (isset($tempAdditionalOptions['redirects'])) {
  26785. $this->redirects = $tempAdditionalOptions['redirects'];
  26786. $isRedirect = true;
  26787. unset($tempAdditionalOptions['redirects']);
  26788. }
  26789. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  26790. unset($tempAdditionalOptions);
  26791. $origFileUrl = $fileUrl;
  26792. if (isset($options['github-token'])) {
  26793. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  26794. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  26795. }
  26796. unset($options['github-token']);
  26797. }
  26798. if (isset($options['gitlab-token'])) {
  26799. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  26800. unset($options['gitlab-token']);
  26801. }
  26802. if (isset($options['http'])) {
  26803. $options['http']['ignore_errors'] = true;
  26804. }
  26805. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  26806. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  26807. $degradedPackagist = true;
  26808. }
  26809. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  26810. $actualContextOptions = stream_context_get_options($ctx);
  26811. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  26812. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  26813. unset($origFileUrl, $actualContextOptions);
  26814. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  26815. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  26816. }
  26817. if ($this->progress && !$isRedirect) {
  26818. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  26819. }
  26820. $errorMessage = '';
  26821. $errorCode = 0;
  26822. $result = false;
  26823. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26824. if ($errorMessage) {
  26825. $errorMessage .= "\n";
  26826. }
  26827. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  26828. });
  26829. try {
  26830. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  26831. if (!empty($http_response_header[0])) {
  26832. $statusCode = $this->findStatusCode($http_response_header);
  26833. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  26834. $warning = null;
  26835. if ($this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  26836. $data = json_decode($result, true);
  26837. if (!empty($data['warning'])) {
  26838. $warning = $data['warning'];
  26839. }
  26840. }
  26841. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $warning, $http_response_header);
  26842. }
  26843. }
  26844. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  26845. if ($contentLength && Platform::strlen($result) < $contentLength) {
  26846. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  26847. $e->setHeaders($http_response_header);
  26848. $e->setStatusCode($this->findStatusCode($http_response_header));
  26849. $e->setResponse($result);
  26850. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  26851. throw $e;
  26852. }
  26853. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  26854. $params = stream_context_get_params($ctx);
  26855. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  26856. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  26857. if ($expectedPeerFingerprint !== $peerFingerprint) {
  26858. throw new TransportException('Peer fingerprint did not match');
  26859. }
  26860. }
  26861. } catch (\Exception $e) {
  26862. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  26863. $e->setHeaders($http_response_header);
  26864. $e->setStatusCode($this->findStatusCode($http_response_header));
  26865. }
  26866. if ($e instanceof TransportException && $result !== false) {
  26867. $e->setResponse($result);
  26868. }
  26869. $result = false;
  26870. }
  26871. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  26872. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  26873. }
  26874. restore_error_handler();
  26875. if (isset($e) && !$this->retry) {
  26876. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26877. $this->degradedMode = true;
  26878. $this->io->writeError('');
  26879. $this->io->writeError(array(
  26880. '<error>'.$e->getMessage().'</error>',
  26881. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26882. ));
  26883. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26884. }
  26885. throw $e;
  26886. }
  26887. $statusCode = null;
  26888. $contentType = null;
  26889. $locationHeader = null;
  26890. if (!empty($http_response_header[0])) {
  26891. $statusCode = $this->findStatusCode($http_response_header);
  26892. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  26893. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  26894. }
  26895. if ($originUrl === 'bitbucket.org'
  26896. && !$this->isPublicBitBucketDownload($fileUrl)
  26897. && substr($fileUrl, -4) === '.zip'
  26898. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  26899. && $contentType && preg_match('{^text/html\b}i', $contentType)
  26900. ) {
  26901. $result = false;
  26902. if ($this->retryAuthFailure) {
  26903. $this->promptAuthAndRetry(401);
  26904. }
  26905. }
  26906. if ($statusCode === 404
  26907. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  26908. && false !== strpos($fileUrl, 'archive.zip')
  26909. ) {
  26910. $result = false;
  26911. if ($this->retryAuthFailure) {
  26912. $this->promptAuthAndRetry(401);
  26913. }
  26914. }
  26915. $hasFollowedRedirect = false;
  26916. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  26917. $hasFollowedRedirect = true;
  26918. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  26919. }
  26920. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  26921. if (!$this->retry) {
  26922. if ($this->progress && !$this->retry && !$isRedirect) {
  26923. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  26924. }
  26925. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  26926. $e->setHeaders($http_response_header);
  26927. $e->setResponse($result);
  26928. $e->setStatusCode($statusCode);
  26929. throw $e;
  26930. }
  26931. $result = false;
  26932. }
  26933. if ($this->progress && !$this->retry && !$isRedirect) {
  26934. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  26935. }
  26936. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  26937. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  26938. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  26939. if ($decode) {
  26940. try {
  26941. if (PHP_VERSION_ID >= 50400) {
  26942. $result = zlib_decode($result);
  26943. } else {
  26944. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  26945. }
  26946. if (!$result) {
  26947. throw new TransportException('Failed to decode zlib stream');
  26948. }
  26949. } catch (\Exception $e) {
  26950. if ($this->degradedMode) {
  26951. throw $e;
  26952. }
  26953. $this->degradedMode = true;
  26954. $this->io->writeError(array(
  26955. '',
  26956. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  26957. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26958. ));
  26959. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26960. }
  26961. }
  26962. }
  26963. if (false !== $result && null !== $fileName && !$isRedirect) {
  26964. if ('' === $result) {
  26965. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  26966. }
  26967. $errorMessage = '';
  26968. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26969. if ($errorMessage) {
  26970. $errorMessage .= "\n";
  26971. }
  26972. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  26973. });
  26974. $result = (bool) file_put_contents($fileName, $result);
  26975. restore_error_handler();
  26976. if (false === $result) {
  26977. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  26978. }
  26979. }
  26980. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  26981. if (CaBundle::isOpensslParseSafe()) {
  26982. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  26983. if ($certDetails) {
  26984. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  26985. $this->retry = true;
  26986. }
  26987. } else {
  26988. $this->io->writeError('');
  26989. $this->io->writeError(sprintf(
  26990. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  26991. PHP_VERSION
  26992. ));
  26993. }
  26994. }
  26995. if ($this->retry) {
  26996. $this->retry = false;
  26997. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26998. if ($this->storeAuth && $this->config) {
  26999. $authHelper = new AuthHelper($this->io, $this->config);
  27000. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  27001. $this->storeAuth = false;
  27002. }
  27003. return $result;
  27004. }
  27005. if (false === $result) {
  27006. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  27007. if (!empty($http_response_header[0])) {
  27008. $e->setHeaders($http_response_header);
  27009. }
  27010. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27011. $this->degradedMode = true;
  27012. $this->io->writeError('');
  27013. $this->io->writeError(array(
  27014. '<error>'.$e->getMessage().'</error>',
  27015. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27016. ));
  27017. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27018. }
  27019. throw $e;
  27020. }
  27021. if (!empty($http_response_header[0])) {
  27022. $this->lastHeaders = $http_response_header;
  27023. }
  27024. return $result;
  27025. }
  27026. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  27027. {
  27028. try {
  27029. $e = null;
  27030. $result = file_get_contents($fileUrl, false, $context);
  27031. } catch (\Throwable $e) {
  27032. } catch (\Exception $e) {
  27033. }
  27034. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  27035. if (null !== $e) {
  27036. throw $e;
  27037. }
  27038. return $result;
  27039. }
  27040. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  27041. {
  27042. switch ($notificationCode) {
  27043. case STREAM_NOTIFY_FAILURE:
  27044. if (400 === $messageCode) {
  27045. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  27046. }
  27047. break;
  27048. case STREAM_NOTIFY_FILE_SIZE_IS:
  27049. $this->bytesMax = $bytesMax;
  27050. break;
  27051. case STREAM_NOTIFY_PROGRESS:
  27052. if ($this->bytesMax > 0 && $this->progress) {
  27053. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  27054. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  27055. $this->lastProgress = $progression;
  27056. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  27057. }
  27058. }
  27059. break;
  27060. default:
  27061. break;
  27062. }
  27063. }
  27064. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  27065. {
  27066. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  27067. $gitHubUtil = new GitHub($this->io, $this->config, null);
  27068. $message = "\n";
  27069. $rateLimited = $gitHubUtil->isRateLimited($headers);
  27070. if ($rateLimited) {
  27071. $rateLimit = $gitHubUtil->getRateLimit($headers);
  27072. if ($this->io->hasAuthentication($this->originUrl)) {
  27073. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  27074. } else {
  27075. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  27076. }
  27077. $message = sprintf(
  27078. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  27079. $rateLimit['limit'],
  27080. $rateLimit['reset']
  27081. )."\n";
  27082. } else {
  27083. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  27084. if ($this->io->hasAuthentication($this->originUrl)) {
  27085. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  27086. } else {
  27087. $message .= 'create a GitHub OAuth token to access private repos';
  27088. }
  27089. }
  27090. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  27091. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27092. ) {
  27093. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27094. }
  27095. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  27096. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  27097. $gitLabUtil = new GitLab($this->io, $this->config, null);
  27098. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  27099. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27100. }
  27101. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  27102. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  27103. ) {
  27104. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27105. }
  27106. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  27107. $askForOAuthToken = true;
  27108. if ($this->io->hasAuthentication($this->originUrl)) {
  27109. $auth = $this->io->getAuthentication($this->originUrl);
  27110. if ($auth['username'] !== 'x-token-auth') {
  27111. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  27112. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  27113. if (!empty($accessToken)) {
  27114. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  27115. $askForOAuthToken = false;
  27116. }
  27117. } else {
  27118. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27119. }
  27120. }
  27121. if ($askForOAuthToken) {
  27122. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  27123. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  27124. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  27125. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27126. ) {
  27127. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27128. }
  27129. }
  27130. } else {
  27131. if ($httpStatus === 404) {
  27132. return;
  27133. }
  27134. if (!$this->io->isInteractive()) {
  27135. if ($httpStatus === 401) {
  27136. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  27137. }
  27138. if ($httpStatus === 403) {
  27139. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  27140. }
  27141. throw new TransportException($message, $httpStatus);
  27142. }
  27143. if ($this->io->hasAuthentication($this->originUrl)) {
  27144. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27145. }
  27146. $this->io->overwriteError('');
  27147. if ($warning) {
  27148. $this->io->writeError(' <warning>'.$warning.'</warning>');
  27149. }
  27150. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  27151. $username = $this->io->ask(' Username: ');
  27152. $password = $this->io->askAndHideAnswer(' Password: ');
  27153. $this->io->setAuthentication($this->originUrl, $username, $password);
  27154. $this->storeAuth = $this->config->get('store-auths');
  27155. }
  27156. $this->retry = true;
  27157. throw new TransportException('RETRY');
  27158. }
  27159. protected function getOptionsForUrl($originUrl, $additionalOptions)
  27160. {
  27161. $tlsOptions = array();
  27162. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  27163. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  27164. if (PHP_VERSION_ID < 50304) {
  27165. if ($host === 'github.com' || $host === 'api.github.com') {
  27166. $host = '*.github.com';
  27167. }
  27168. }
  27169. $tlsOptions['ssl']['CN_match'] = $host;
  27170. $tlsOptions['ssl']['SNI_server_name'] = $host;
  27171. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  27172. if (isset($this->peerCertificateMap[$urlAuthority])) {
  27173. $certMap = $this->peerCertificateMap[$urlAuthority];
  27174. $this->io->writeError('', true, IOInterface::DEBUG);
  27175. $this->io->writeError(sprintf(
  27176. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  27177. $certMap['cn'],
  27178. $urlAuthority
  27179. ), true, IOInterface::DEBUG);
  27180. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  27181. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  27182. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  27183. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  27184. }
  27185. }
  27186. $headers = array();
  27187. if (extension_loaded('zlib')) {
  27188. $headers[] = 'Accept-Encoding: gzip';
  27189. }
  27190. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  27191. if (!$this->degradedMode) {
  27192. $options['http']['protocol_version'] = 1.1;
  27193. $headers[] = 'Connection: close';
  27194. }
  27195. if ($this->io->hasAuthentication($originUrl)) {
  27196. $auth = $this->io->getAuthentication($originUrl);
  27197. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  27198. $options['github-token'] = $auth['username'];
  27199. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  27200. if ($auth['password'] === 'oauth2') {
  27201. $headers[] = 'Authorization: Bearer '.$auth['username'];
  27202. } elseif ($auth['password'] === 'private-token') {
  27203. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  27204. }
  27205. } elseif ('bitbucket.org' === $originUrl
  27206. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  27207. ) {
  27208. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  27209. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  27210. }
  27211. } else {
  27212. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  27213. $headers[] = 'Authorization: Basic '.$authStr;
  27214. }
  27215. }
  27216. $options['http']['follow_location'] = 0;
  27217. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  27218. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  27219. }
  27220. foreach ($headers as $header) {
  27221. $options['http']['header'][] = $header;
  27222. }
  27223. return $options;
  27224. }
  27225. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  27226. {
  27227. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  27228. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  27229. $targetUrl = $locationHeader;
  27230. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  27231. $targetUrl = $this->scheme.':'.$locationHeader;
  27232. } elseif ('/' === $locationHeader[0]) {
  27233. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  27234. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27235. } else {
  27236. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27237. }
  27238. }
  27239. if (!empty($targetUrl)) {
  27240. $this->redirects++;
  27241. $this->io->writeError('', true, IOInterface::DEBUG);
  27242. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  27243. $additionalOptions['redirects'] = $this->redirects;
  27244. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  27245. }
  27246. if (!$this->retry) {
  27247. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  27248. $e->setHeaders($http_response_header);
  27249. $e->setResponse($result);
  27250. throw $e;
  27251. }
  27252. return false;
  27253. }
  27254. private function getTlsDefaults(array $options)
  27255. {
  27256. $ciphers = implode(':', array(
  27257. 'ECDHE-RSA-AES128-GCM-SHA256',
  27258. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  27259. 'ECDHE-RSA-AES256-GCM-SHA384',
  27260. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  27261. 'DHE-RSA-AES128-GCM-SHA256',
  27262. 'DHE-DSS-AES128-GCM-SHA256',
  27263. 'kEDH+AESGCM',
  27264. 'ECDHE-RSA-AES128-SHA256',
  27265. 'ECDHE-ECDSA-AES128-SHA256',
  27266. 'ECDHE-RSA-AES128-SHA',
  27267. 'ECDHE-ECDSA-AES128-SHA',
  27268. 'ECDHE-RSA-AES256-SHA384',
  27269. 'ECDHE-ECDSA-AES256-SHA384',
  27270. 'ECDHE-RSA-AES256-SHA',
  27271. 'ECDHE-ECDSA-AES256-SHA',
  27272. 'DHE-RSA-AES128-SHA256',
  27273. 'DHE-RSA-AES128-SHA',
  27274. 'DHE-DSS-AES128-SHA256',
  27275. 'DHE-RSA-AES256-SHA256',
  27276. 'DHE-DSS-AES256-SHA',
  27277. 'DHE-RSA-AES256-SHA',
  27278. 'AES128-GCM-SHA256',
  27279. 'AES256-GCM-SHA384',
  27280. 'AES128-SHA256',
  27281. 'AES256-SHA256',
  27282. 'AES128-SHA',
  27283. 'AES256-SHA',
  27284. 'AES',
  27285. 'CAMELLIA',
  27286. 'DES-CBC3-SHA',
  27287. '!aNULL',
  27288. '!eNULL',
  27289. '!EXPORT',
  27290. '!DES',
  27291. '!RC4',
  27292. '!MD5',
  27293. '!PSK',
  27294. '!aECDH',
  27295. '!EDH-DSS-DES-CBC3-SHA',
  27296. '!EDH-RSA-DES-CBC3-SHA',
  27297. '!KRB5-DES-CBC3-SHA',
  27298. ));
  27299. $defaults = array(
  27300. 'ssl' => array(
  27301. 'ciphers' => $ciphers,
  27302. 'verify_peer' => true,
  27303. 'verify_depth' => 7,
  27304. 'SNI_enabled' => true,
  27305. 'capture_peer_cert' => true,
  27306. ),
  27307. );
  27308. if (isset($options['ssl'])) {
  27309. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27310. }
  27311. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27312. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27313. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27314. if (is_dir($result)) {
  27315. $defaults['ssl']['capath'] = $result;
  27316. } else {
  27317. $defaults['ssl']['cafile'] = $result;
  27318. }
  27319. }
  27320. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27321. throw new TransportException('The configured cafile was not valid or could not be read.');
  27322. }
  27323. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27324. throw new TransportException('The configured capath was not valid or could not be read.');
  27325. }
  27326. if (PHP_VERSION_ID >= 50413) {
  27327. $defaults['ssl']['disable_compression'] = true;
  27328. }
  27329. return $defaults;
  27330. }
  27331. private function getCertificateCnAndFp($url, $options)
  27332. {
  27333. if (PHP_VERSION_ID >= 50600) {
  27334. throw new \BadMethodCallException(sprintf(
  27335. '%s must not be used on PHP >= 5.6',
  27336. __METHOD__
  27337. ));
  27338. }
  27339. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27340. 'ssl' => array(
  27341. 'capture_peer_cert' => true,
  27342. 'verify_peer' => false,
  27343. ), ),
  27344. ));
  27345. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27346. return;
  27347. }
  27348. fclose($handle);
  27349. $handle = null;
  27350. $params = stream_context_get_params($context);
  27351. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27352. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27353. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27354. return array(
  27355. 'cn' => $commonName,
  27356. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27357. );
  27358. }
  27359. }
  27360. }
  27361. private function getUrlAuthority($url)
  27362. {
  27363. $defaultPorts = array(
  27364. 'ftp' => 21,
  27365. 'http' => 80,
  27366. 'https' => 443,
  27367. 'ssh2.sftp' => 22,
  27368. 'ssh2.scp' => 22,
  27369. );
  27370. $scheme = parse_url($url, PHP_URL_SCHEME);
  27371. if (!isset($defaultPorts[$scheme])) {
  27372. throw new \InvalidArgumentException(sprintf(
  27373. 'Could not get default port for unknown scheme: %s',
  27374. $scheme
  27375. ));
  27376. }
  27377. $defaultPort = $defaultPorts[$scheme];
  27378. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27379. return parse_url($url, PHP_URL_HOST).':'.$port;
  27380. }
  27381. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27382. {
  27383. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27384. if (strpos($domain, 'bitbucket.org') === false) {
  27385. return true;
  27386. }
  27387. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27388. $pathParts = explode('/', $path);
  27389. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27390. }
  27391. }
  27392. <?php
  27393. namespace Composer\Util;
  27394. class Silencer
  27395. {
  27396. private static $stack = array();
  27397. public static function suppress($mask = null)
  27398. {
  27399. if (!isset($mask)) {
  27400. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27401. }
  27402. $old = error_reporting();
  27403. self::$stack[] = $old;
  27404. error_reporting($old & ~$mask);
  27405. return $old;
  27406. }
  27407. public static function restore()
  27408. {
  27409. if (!empty(self::$stack)) {
  27410. error_reporting(array_pop(self::$stack));
  27411. }
  27412. }
  27413. public static function call($callable )
  27414. {
  27415. try {
  27416. self::suppress();
  27417. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27418. self::restore();
  27419. return $result;
  27420. } catch (\Exception $e) {
  27421. self::restore();
  27422. throw $e;
  27423. }
  27424. }
  27425. }
  27426. <?php
  27427. namespace Composer\Util;
  27428. use Composer\Spdx\SpdxLicenses;
  27429. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27430. class SpdxLicense extends SpdxLicenses
  27431. {
  27432. }
  27433. <?php
  27434. namespace Composer\Util;
  27435. use Composer\Composer;
  27436. final class StreamContextFactory
  27437. {
  27438. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27439. {
  27440. $options = array('http' => array(
  27441. 'follow_location' => 1,
  27442. 'max_redirects' => 20,
  27443. ));
  27444. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27445. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27446. }
  27447. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27448. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27449. }
  27450. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27451. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27452. }
  27453. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27454. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27455. if ($pattern->test($url)) {
  27456. unset($proxy);
  27457. }
  27458. }
  27459. if (!empty($proxy)) {
  27460. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27461. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27462. if (isset($proxy['port'])) {
  27463. $proxyURL .= ":" . $proxy['port'];
  27464. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27465. $proxyURL .= ":80";
  27466. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27467. $proxyURL .= ":443";
  27468. }
  27469. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27470. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27471. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27472. }
  27473. $options['http']['proxy'] = $proxyURL;
  27474. switch (parse_url($url, PHP_URL_SCHEME)) {
  27475. case 'http':
  27476. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27477. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27478. $options['http']['request_fulluri'] = true;
  27479. }
  27480. break;
  27481. case 'https':
  27482. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27483. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27484. $options['http']['request_fulluri'] = true;
  27485. }
  27486. break;
  27487. }
  27488. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27489. $options['ssl']['SNI_enabled'] = true;
  27490. if (PHP_VERSION_ID < 50600) {
  27491. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27492. }
  27493. }
  27494. if (isset($proxy['user'])) {
  27495. $auth = rawurldecode($proxy['user']);
  27496. if (isset($proxy['pass'])) {
  27497. $auth .= ':' . rawurldecode($proxy['pass']);
  27498. }
  27499. $auth = base64_encode($auth);
  27500. if (isset($defaultOptions['http']['header'])) {
  27501. if (is_string($defaultOptions['http']['header'])) {
  27502. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27503. }
  27504. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27505. } else {
  27506. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27507. }
  27508. }
  27509. }
  27510. $options = array_replace_recursive($options, $defaultOptions);
  27511. if (isset($options['http']['header'])) {
  27512. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27513. }
  27514. if (defined('HHVM_VERSION')) {
  27515. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27516. } else {
  27517. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27518. }
  27519. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27520. $options['http']['header'][] = sprintf(
  27521. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27522. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  27523. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27524. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27525. $phpVersion,
  27526. getenv('CI') ? '; CI' : ''
  27527. );
  27528. }
  27529. return stream_context_create($options, $defaultParams);
  27530. }
  27531. private static function fixHttpHeaderField($header)
  27532. {
  27533. if (!is_array($header)) {
  27534. $header = explode("\r\n", $header);
  27535. }
  27536. uasort($header, function ($el) {
  27537. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27538. });
  27539. return $header;
  27540. }
  27541. }
  27542. <?php
  27543. namespace Composer\Util;
  27544. use Composer\Config;
  27545. use Composer\IO\IOInterface;
  27546. class Svn
  27547. {
  27548. const MAX_QTY_AUTH_TRIES = 5;
  27549. protected $credentials;
  27550. protected $hasAuth;
  27551. protected $io;
  27552. protected $url;
  27553. protected $cacheCredentials = true;
  27554. protected $process;
  27555. protected $qtyAuthTries = 0;
  27556. protected $config;
  27557. private static $version;
  27558. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27559. {
  27560. $this->url = $url;
  27561. $this->io = $io;
  27562. $this->config = $config;
  27563. $this->process = $process ?: new ProcessExecutor($io);
  27564. }
  27565. public static function cleanEnv()
  27566. {
  27567. putenv("DYLD_LIBRARY_PATH");
  27568. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27569. }
  27570. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27571. {
  27572. $this->config->prohibitUrlByConfig($url, $this->io);
  27573. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27574. }
  27575. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27576. {
  27577. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27578. }
  27579. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27580. {
  27581. $command = $this->getCommand($svnCommand, $url, $path);
  27582. $output = null;
  27583. $io = $this->io;
  27584. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27585. if ($type !== 'out') {
  27586. return;
  27587. }
  27588. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  27589. return;
  27590. }
  27591. $output .= $buffer;
  27592. if ($verbose) {
  27593. $io->writeError($buffer, false);
  27594. }
  27595. };
  27596. $status = $this->process->execute($command, $handler, $cwd);
  27597. if (0 === $status) {
  27598. return $output;
  27599. }
  27600. $errorOutput = $this->process->getErrorOutput();
  27601. $fullOutput = implode("\n", array($output, $errorOutput));
  27602. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  27603. && false === stripos($fullOutput, 'authorization failed')
  27604. && false === stripos($fullOutput, 'svn: E170001:')
  27605. && false === stripos($fullOutput, 'svn: E215004:')) {
  27606. throw new \RuntimeException($fullOutput);
  27607. }
  27608. if (!$this->hasAuth()) {
  27609. $this->doAuthDance();
  27610. }
  27611. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  27612. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  27613. }
  27614. throw new \RuntimeException(
  27615. 'wrong credentials provided ('.$fullOutput.')'
  27616. );
  27617. }
  27618. public function setCacheCredentials($cacheCredentials)
  27619. {
  27620. $this->cacheCredentials = $cacheCredentials;
  27621. }
  27622. protected function doAuthDance()
  27623. {
  27624. if (!$this->io->isInteractive()) {
  27625. throw new \RuntimeException(
  27626. 'can not ask for authentication in non interactive mode'
  27627. );
  27628. }
  27629. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  27630. $this->hasAuth = true;
  27631. $this->credentials['username'] = $this->io->ask("Username: ");
  27632. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  27633. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  27634. return $this;
  27635. }
  27636. protected function getCommand($cmd, $url, $path = null)
  27637. {
  27638. $cmd = sprintf(
  27639. '%s %s%s %s',
  27640. $cmd,
  27641. '--non-interactive ',
  27642. $this->getCredentialString(),
  27643. ProcessExecutor::escape($url)
  27644. );
  27645. if ($path) {
  27646. $cmd .= ' ' . ProcessExecutor::escape($path);
  27647. }
  27648. return $cmd;
  27649. }
  27650. protected function getCredentialString()
  27651. {
  27652. if (!$this->hasAuth()) {
  27653. return '';
  27654. }
  27655. return sprintf(
  27656. ' %s--username %s --password %s ',
  27657. $this->getAuthCache(),
  27658. ProcessExecutor::escape($this->getUsername()),
  27659. ProcessExecutor::escape($this->getPassword())
  27660. );
  27661. }
  27662. protected function getPassword()
  27663. {
  27664. if ($this->credentials === null) {
  27665. throw new \LogicException("No svn auth detected.");
  27666. }
  27667. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  27668. }
  27669. protected function getUsername()
  27670. {
  27671. if ($this->credentials === null) {
  27672. throw new \LogicException("No svn auth detected.");
  27673. }
  27674. return $this->credentials['username'];
  27675. }
  27676. protected function hasAuth()
  27677. {
  27678. if (null !== $this->hasAuth) {
  27679. return $this->hasAuth;
  27680. }
  27681. if (false === $this->createAuthFromConfig()) {
  27682. $this->createAuthFromUrl();
  27683. }
  27684. return $this->hasAuth;
  27685. }
  27686. protected function getAuthCache()
  27687. {
  27688. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  27689. }
  27690. private function createAuthFromConfig()
  27691. {
  27692. if (!$this->config->has('http-basic')) {
  27693. return $this->hasAuth = false;
  27694. }
  27695. $authConfig = $this->config->get('http-basic');
  27696. $host = parse_url($this->url, PHP_URL_HOST);
  27697. if (isset($authConfig[$host])) {
  27698. $this->credentials['username'] = $authConfig[$host]['username'];
  27699. $this->credentials['password'] = $authConfig[$host]['password'];
  27700. return $this->hasAuth = true;
  27701. }
  27702. return $this->hasAuth = false;
  27703. }
  27704. private function createAuthFromUrl()
  27705. {
  27706. $uri = parse_url($this->url);
  27707. if (empty($uri['user'])) {
  27708. return $this->hasAuth = false;
  27709. }
  27710. $this->credentials['username'] = $uri['user'];
  27711. if (!empty($uri['pass'])) {
  27712. $this->credentials['password'] = $uri['pass'];
  27713. }
  27714. return $this->hasAuth = true;
  27715. }
  27716. public function binaryVersion()
  27717. {
  27718. if (!self::$version) {
  27719. if (0 === $this->process->execute('svn --version', $output)) {
  27720. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  27721. self::$version = $match[1];
  27722. }
  27723. }
  27724. }
  27725. return self::$version;
  27726. }
  27727. }
  27728. <?php
  27729. namespace Composer\Util;
  27730. use Composer\CaBundle\CaBundle;
  27731. final class TlsHelper
  27732. {
  27733. private static $useOpensslParse;
  27734. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  27735. {
  27736. $names = self::getCertificateNames($certificate);
  27737. if (empty($names)) {
  27738. return false;
  27739. }
  27740. $combinedNames = array_merge($names['san'], array($names['cn']));
  27741. $hostname = strtolower($hostname);
  27742. foreach ($combinedNames as $certName) {
  27743. $matcher = self::certNameMatcher($certName);
  27744. if ($matcher && $matcher($hostname)) {
  27745. $cn = $names['cn'];
  27746. return true;
  27747. }
  27748. }
  27749. return false;
  27750. }
  27751. public static function getCertificateNames($certificate)
  27752. {
  27753. if (is_array($certificate)) {
  27754. $info = $certificate;
  27755. } elseif (CaBundle::isOpensslParseSafe()) {
  27756. $info = openssl_x509_parse($certificate, false);
  27757. }
  27758. if (!isset($info['subject']['commonName'])) {
  27759. return null;
  27760. }
  27761. $commonName = strtolower($info['subject']['commonName']);
  27762. $subjectAltNames = array();
  27763. if (isset($info['extensions']['subjectAltName'])) {
  27764. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  27765. $subjectAltNames = array_filter(array_map(function ($name) {
  27766. if (0 === strpos($name, 'DNS:')) {
  27767. return strtolower(ltrim(substr($name, 4)));
  27768. }
  27769. return null;
  27770. }, $subjectAltNames));
  27771. $subjectAltNames = array_values($subjectAltNames);
  27772. }
  27773. return array(
  27774. 'cn' => $commonName,
  27775. 'san' => $subjectAltNames,
  27776. );
  27777. }
  27778. public static function getCertificateFingerprint($certificate)
  27779. {
  27780. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  27781. $pubkeypem = $pubkeydetails['key'];
  27782. $start = '-----BEGIN PUBLIC KEY-----';
  27783. $end = '-----END PUBLIC KEY-----';
  27784. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  27785. $der = base64_decode($pemtrim);
  27786. return sha1($der);
  27787. }
  27788. public static function isOpensslParseSafe()
  27789. {
  27790. return CaBundle::isOpensslParseSafe();
  27791. }
  27792. private static function certNameMatcher($certName)
  27793. {
  27794. $wildcards = substr_count($certName, '*');
  27795. if (0 === $wildcards) {
  27796. return function ($hostname) use ($certName) {
  27797. return $hostname === $certName;
  27798. };
  27799. }
  27800. if (1 === $wildcards) {
  27801. $components = explode('.', $certName);
  27802. if (3 > count($components)) {
  27803. return;
  27804. }
  27805. $firstComponent = $components[0];
  27806. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  27807. return;
  27808. }
  27809. $wildcardRegex = preg_quote($certName);
  27810. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  27811. $wildcardRegex = "{^{$wildcardRegex}$}";
  27812. return function ($hostname) use ($wildcardRegex) {
  27813. return 1 === preg_match($wildcardRegex, $hostname);
  27814. };
  27815. }
  27816. }
  27817. }
  27818. <?php
  27819. namespace Composer\Util;
  27820. use Composer\Config;
  27821. class Url
  27822. {
  27823. public static function updateDistReference(Config $config, $url, $ref)
  27824. {
  27825. $host = parse_url($url, PHP_URL_HOST);
  27826. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  27827. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  27828. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27829. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  27830. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27831. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  27832. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27833. }
  27834. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  27835. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  27836. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  27837. }
  27838. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  27839. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  27840. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  27841. }
  27842. } elseif (in_array($host, $config->get('github-domains'), true)) {
  27843. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  27844. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  27845. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  27846. }
  27847. return $url;
  27848. }
  27849. }
  27850. <?php
  27851. namespace Composer;
  27852. use Symfony\Component\Console\Output\OutputInterface;
  27853. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  27854. class XdebugHandler extends XdebugHandler\XdebugHandler
  27855. {
  27856. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  27857. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  27858. public function __construct(OutputInterface $output)
  27859. {
  27860. parent::__construct('composer', '--ansi');
  27861. }
  27862. }
  27863. <?php
  27864. function includeIfExists($file)
  27865. {
  27866. return file_exists($file) ? include $file : false;
  27867. }
  27868. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27869. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27870. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27871. exit(1);
  27872. }
  27873. return $loader;
  27874. <?php
  27875. /*
  27876. * This file is part of Composer.
  27877. *
  27878. * (c) Nils Adermann <naderman@naderman.de>
  27879. * Jordi Boggiano <j.boggiano@seld.be>
  27880. *
  27881. * For the full copyright and license information, please view the LICENSE
  27882. * file that was distributed with this source code.
  27883. */
  27884. namespace Composer\Autoload;
  27885. /**
  27886. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27887. *
  27888. * $loader = new \Composer\Autoload\ClassLoader();
  27889. *
  27890. * // register classes with namespaces
  27891. * $loader->add('Symfony\Component', __DIR__.'/component');
  27892. * $loader->add('Symfony', __DIR__.'/framework');
  27893. *
  27894. * // activate the autoloader
  27895. * $loader->register();
  27896. *
  27897. * // to enable searching the include path (eg. for PEAR packages)
  27898. * $loader->setUseIncludePath(true);
  27899. *
  27900. * In this example, if you try to use a class in the Symfony\Component
  27901. * namespace or one of its children (Symfony\Component\Console for instance),
  27902. * the autoloader will first look for the class under the component/
  27903. * directory, and it will then fallback to the framework/ directory if not
  27904. * found before giving up.
  27905. *
  27906. * This class is loosely based on the Symfony UniversalClassLoader.
  27907. *
  27908. * @author Fabien Potencier <fabien@symfony.com>
  27909. * @author Jordi Boggiano <j.boggiano@seld.be>
  27910. * @see http://www.php-fig.org/psr/psr-0/
  27911. * @see http://www.php-fig.org/psr/psr-4/
  27912. */
  27913. class ClassLoader
  27914. {
  27915. // PSR-4
  27916. private $prefixLengthsPsr4 = array();
  27917. private $prefixDirsPsr4 = array();
  27918. private $fallbackDirsPsr4 = array();
  27919. // PSR-0
  27920. private $prefixesPsr0 = array();
  27921. private $fallbackDirsPsr0 = array();
  27922. private $useIncludePath = false;
  27923. private $classMap = array();
  27924. private $classMapAuthoritative = false;
  27925. private $missingClasses = array();
  27926. private $apcuPrefix;
  27927. public function getPrefixes()
  27928. {
  27929. if (!empty($this->prefixesPsr0)) {
  27930. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27931. }
  27932. return array();
  27933. }
  27934. public function getPrefixesPsr4()
  27935. {
  27936. return $this->prefixDirsPsr4;
  27937. }
  27938. public function getFallbackDirs()
  27939. {
  27940. return $this->fallbackDirsPsr0;
  27941. }
  27942. public function getFallbackDirsPsr4()
  27943. {
  27944. return $this->fallbackDirsPsr4;
  27945. }
  27946. public function getClassMap()
  27947. {
  27948. return $this->classMap;
  27949. }
  27950. /**
  27951. * @param array $classMap Class to filename map
  27952. */
  27953. public function addClassMap(array $classMap)
  27954. {
  27955. if ($this->classMap) {
  27956. $this->classMap = array_merge($this->classMap, $classMap);
  27957. } else {
  27958. $this->classMap = $classMap;
  27959. }
  27960. }
  27961. /**
  27962. * Registers a set of PSR-0 directories for a given prefix, either
  27963. * appending or prepending to the ones previously set for this prefix.
  27964. *
  27965. * @param string $prefix The prefix
  27966. * @param array|string $paths The PSR-0 root directories
  27967. * @param bool $prepend Whether to prepend the directories
  27968. */
  27969. public function add($prefix, $paths, $prepend = false)
  27970. {
  27971. if (!$prefix) {
  27972. if ($prepend) {
  27973. $this->fallbackDirsPsr0 = array_merge(
  27974. (array) $paths,
  27975. $this->fallbackDirsPsr0
  27976. );
  27977. } else {
  27978. $this->fallbackDirsPsr0 = array_merge(
  27979. $this->fallbackDirsPsr0,
  27980. (array) $paths
  27981. );
  27982. }
  27983. return;
  27984. }
  27985. $first = $prefix[0];
  27986. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27987. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27988. return;
  27989. }
  27990. if ($prepend) {
  27991. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27992. (array) $paths,
  27993. $this->prefixesPsr0[$first][$prefix]
  27994. );
  27995. } else {
  27996. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27997. $this->prefixesPsr0[$first][$prefix],
  27998. (array) $paths
  27999. );
  28000. }
  28001. }
  28002. /**
  28003. * Registers a set of PSR-4 directories for a given namespace, either
  28004. * appending or prepending to the ones previously set for this namespace.
  28005. *
  28006. * @param string $prefix The prefix/namespace, with trailing '\\'
  28007. * @param array|string $paths The PSR-4 base directories
  28008. * @param bool $prepend Whether to prepend the directories
  28009. *
  28010. * @throws \InvalidArgumentException
  28011. */
  28012. public function addPsr4($prefix, $paths, $prepend = false)
  28013. {
  28014. if (!$prefix) {
  28015. // Register directories for the root namespace.
  28016. if ($prepend) {
  28017. $this->fallbackDirsPsr4 = array_merge(
  28018. (array) $paths,
  28019. $this->fallbackDirsPsr4
  28020. );
  28021. } else {
  28022. $this->fallbackDirsPsr4 = array_merge(
  28023. $this->fallbackDirsPsr4,
  28024. (array) $paths
  28025. );
  28026. }
  28027. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  28028. // Register directories for a new namespace.
  28029. $length = strlen($prefix);
  28030. if ('\\' !== $prefix[$length - 1]) {
  28031. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28032. }
  28033. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28034. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28035. } elseif ($prepend) {
  28036. // Prepend directories for an already registered namespace.
  28037. $this->prefixDirsPsr4[$prefix] = array_merge(
  28038. (array) $paths,
  28039. $this->prefixDirsPsr4[$prefix]
  28040. );
  28041. } else {
  28042. // Append directories for an already registered namespace.
  28043. $this->prefixDirsPsr4[$prefix] = array_merge(
  28044. $this->prefixDirsPsr4[$prefix],
  28045. (array) $paths
  28046. );
  28047. }
  28048. }
  28049. /**
  28050. * Registers a set of PSR-0 directories for a given prefix,
  28051. * replacing any others previously set for this prefix.
  28052. *
  28053. * @param string $prefix The prefix
  28054. * @param array|string $paths The PSR-0 base directories
  28055. */
  28056. public function set($prefix, $paths)
  28057. {
  28058. if (!$prefix) {
  28059. $this->fallbackDirsPsr0 = (array) $paths;
  28060. } else {
  28061. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  28062. }
  28063. }
  28064. /**
  28065. * Registers a set of PSR-4 directories for a given namespace,
  28066. * replacing any others previously set for this namespace.
  28067. *
  28068. * @param string $prefix The prefix/namespace, with trailing '\\'
  28069. * @param array|string $paths The PSR-4 base directories
  28070. *
  28071. * @throws \InvalidArgumentException
  28072. */
  28073. public function setPsr4($prefix, $paths)
  28074. {
  28075. if (!$prefix) {
  28076. $this->fallbackDirsPsr4 = (array) $paths;
  28077. } else {
  28078. $length = strlen($prefix);
  28079. if ('\\' !== $prefix[$length - 1]) {
  28080. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28081. }
  28082. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28083. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28084. }
  28085. }
  28086. /**
  28087. * Turns on searching the include path for class files.
  28088. *
  28089. * @param bool $useIncludePath
  28090. */
  28091. public function setUseIncludePath($useIncludePath)
  28092. {
  28093. $this->useIncludePath = $useIncludePath;
  28094. }
  28095. /**
  28096. * Can be used to check if the autoloader uses the include path to check
  28097. * for classes.
  28098. *
  28099. * @return bool
  28100. */
  28101. public function getUseIncludePath()
  28102. {
  28103. return $this->useIncludePath;
  28104. }
  28105. /**
  28106. * Turns off searching the prefix and fallback directories for classes
  28107. * that have not been registered with the class map.
  28108. *
  28109. * @param bool $classMapAuthoritative
  28110. */
  28111. public function setClassMapAuthoritative($classMapAuthoritative)
  28112. {
  28113. $this->classMapAuthoritative = $classMapAuthoritative;
  28114. }
  28115. /**
  28116. * Should class lookup fail if not found in the current class map?
  28117. *
  28118. * @return bool
  28119. */
  28120. public function isClassMapAuthoritative()
  28121. {
  28122. return $this->classMapAuthoritative;
  28123. }
  28124. /**
  28125. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  28126. *
  28127. * @param string|null $apcuPrefix
  28128. */
  28129. public function setApcuPrefix($apcuPrefix)
  28130. {
  28131. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  28132. }
  28133. /**
  28134. * The APCu prefix in use, or null if APCu caching is not enabled.
  28135. *
  28136. * @return string|null
  28137. */
  28138. public function getApcuPrefix()
  28139. {
  28140. return $this->apcuPrefix;
  28141. }
  28142. /**
  28143. * Registers this instance as an autoloader.
  28144. *
  28145. * @param bool $prepend Whether to prepend the autoloader or not
  28146. */
  28147. public function register($prepend = false)
  28148. {
  28149. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  28150. }
  28151. /**
  28152. * Unregisters this instance as an autoloader.
  28153. */
  28154. public function unregister()
  28155. {
  28156. spl_autoload_unregister(array($this, 'loadClass'));
  28157. }
  28158. /**
  28159. * Loads the given class or interface.
  28160. *
  28161. * @param string $class The name of the class
  28162. * @return bool|null True if loaded, null otherwise
  28163. */
  28164. public function loadClass($class)
  28165. {
  28166. if ($file = $this->findFile($class)) {
  28167. includeFile($file);
  28168. return true;
  28169. }
  28170. }
  28171. /**
  28172. * Finds the path to the file where the class is defined.
  28173. *
  28174. * @param string $class The name of the class
  28175. *
  28176. * @return string|false The path if found, false otherwise
  28177. */
  28178. public function findFile($class)
  28179. {
  28180. // class map lookup
  28181. if (isset($this->classMap[$class])) {
  28182. return $this->classMap[$class];
  28183. }
  28184. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  28185. return false;
  28186. }
  28187. if (null !== $this->apcuPrefix) {
  28188. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  28189. if ($hit) {
  28190. return $file;
  28191. }
  28192. }
  28193. $file = $this->findFileWithExtension($class, '.php');
  28194. // Search for Hack files if we are running on HHVM
  28195. if (false === $file && defined('HHVM_VERSION')) {
  28196. $file = $this->findFileWithExtension($class, '.hh');
  28197. }
  28198. if (null !== $this->apcuPrefix) {
  28199. apcu_add($this->apcuPrefix.$class, $file);
  28200. }
  28201. if (false === $file) {
  28202. // Remember that this class does not exist.
  28203. $this->missingClasses[$class] = true;
  28204. }
  28205. return $file;
  28206. }
  28207. private function findFileWithExtension($class, $ext)
  28208. {
  28209. // PSR-4 lookup
  28210. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  28211. $first = $class[0];
  28212. if (isset($this->prefixLengthsPsr4[$first])) {
  28213. $subPath = $class;
  28214. while (false !== $lastPos = strrpos($subPath, '\\')) {
  28215. $subPath = substr($subPath, 0, $lastPos);
  28216. $search = $subPath . '\\';
  28217. if (isset($this->prefixDirsPsr4[$search])) {
  28218. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  28219. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  28220. if (file_exists($file = $dir . $pathEnd)) {
  28221. return $file;
  28222. }
  28223. }
  28224. }
  28225. }
  28226. }
  28227. // PSR-4 fallback dirs
  28228. foreach ($this->fallbackDirsPsr4 as $dir) {
  28229. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  28230. return $file;
  28231. }
  28232. }
  28233. // PSR-0 lookup
  28234. if (false !== $pos = strrpos($class, '\\')) {
  28235. // namespaced class name
  28236. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  28237. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  28238. } else {
  28239. // PEAR-like class name
  28240. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  28241. }
  28242. if (isset($this->prefixesPsr0[$first])) {
  28243. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  28244. if (0 === strpos($class, $prefix)) {
  28245. foreach ($dirs as $dir) {
  28246. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28247. return $file;
  28248. }
  28249. }
  28250. }
  28251. }
  28252. }
  28253. // PSR-0 fallback dirs
  28254. foreach ($this->fallbackDirsPsr0 as $dir) {
  28255. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28256. return $file;
  28257. }
  28258. }
  28259. // PSR-0 include paths.
  28260. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  28261. return $file;
  28262. }
  28263. return false;
  28264. }
  28265. }
  28266. /**
  28267. * Scope isolated include.
  28268. *
  28269. * Prevents access to $this/self from included files.
  28270. */
  28271. function includeFile($file)
  28272. {
  28273. include $file;
  28274. }
  28275. {
  28276. "$schema": "http://json-schema.org/draft-04/schema#",
  28277. "description": "A representation of packages metadata.",
  28278. "type": "object",
  28279. "oneOf": [
  28280. { "required": [ "packages" ] },
  28281. { "required": [ "providers" ] },
  28282. { "required": [ "provider-includes", "providers-url" ] }
  28283. ],
  28284. "properties": {
  28285. "packages": {
  28286. "type": ["object", "array"],
  28287. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28288. "additionalProperties": { "$ref": "#/definitions/versions" }
  28289. },
  28290. "providers-url": {
  28291. "type": "string",
  28292. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28293. },
  28294. "provider-includes": {
  28295. "type": "object",
  28296. "description": "A hashmap of provider listings.",
  28297. "additionalProperties": { "$ref": "#/definitions/provider" }
  28298. },
  28299. "providers": {
  28300. "type": "object",
  28301. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28302. "additionalProperties": { "$ref": "#/definitions/provider" }
  28303. },
  28304. "notify-batch": {
  28305. "type": "string",
  28306. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28307. },
  28308. "search": {
  28309. "type": "string",
  28310. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28311. },
  28312. "warning": {
  28313. "type": "string",
  28314. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28315. }
  28316. },
  28317. "definitions": {
  28318. "versions": {
  28319. "type": "object",
  28320. "description": "A hashmap of versions and their metadata.",
  28321. "additionalProperties": { "$ref": "#/definitions/version" }
  28322. },
  28323. "version": {
  28324. "type": "object",
  28325. "oneOf": [
  28326. { "$ref": "#/definitions/package" },
  28327. { "$ref": "#/definitions/metapackage" }
  28328. ]
  28329. },
  28330. "package-base": {
  28331. "properties": {
  28332. "name": { "type": "string" },
  28333. "type": { "type": "string" },
  28334. "version": { "type": "string" },
  28335. "version_normalized": {
  28336. "type": "string",
  28337. "description": "Normalized version, optional but can save computational time on client side."
  28338. },
  28339. "autoload": { "type": "object" },
  28340. "require": { "type": "object" },
  28341. "replace": { "type": "object" },
  28342. "conflict": { "type": "object" },
  28343. "provide": { "type": "object" },
  28344. "time": { "type": "string" }
  28345. },
  28346. "additionalProperties": true
  28347. },
  28348. "package": {
  28349. "allOf": [
  28350. { "$ref": "#/definitions/package-base" },
  28351. {
  28352. "properties": {
  28353. "dist": { "type": "object" },
  28354. "source": { "type": "object" }
  28355. }
  28356. },
  28357. { "oneOf": [
  28358. { "required": [ "name", "version", "source" ] },
  28359. { "required": [ "name", "version", "dist" ] }
  28360. ] }
  28361. ]
  28362. },
  28363. "metapackage": {
  28364. "allOf": [
  28365. { "$ref": "#/definitions/package-base" },
  28366. {
  28367. "properties": {
  28368. "type": { "type": "string", "enum": [ "metapackage" ] }
  28369. },
  28370. "required": [ "name", "version", "type" ]
  28371. }
  28372. ]
  28373. },
  28374. "provider": {
  28375. "type": "object",
  28376. "properties": {
  28377. "sha256": {
  28378. "type": "string",
  28379. "description": "Hash value that can be used to validate the resource."
  28380. }
  28381. }
  28382. }
  28383. }
  28384. }
  28385. {
  28386. "$schema": "http://json-schema.org/draft-04/schema#",
  28387. "name": "Package",
  28388. "type": "object",
  28389. "additionalProperties": false,
  28390. "required": [ "name", "description" ],
  28391. "properties": {
  28392. "name": {
  28393. "type": "string",
  28394. "description": "Package name, including 'vendor-name/' prefix."
  28395. },
  28396. "type": {
  28397. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  28398. "type": "string"
  28399. },
  28400. "target-dir": {
  28401. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28402. "type": "string"
  28403. },
  28404. "description": {
  28405. "type": "string",
  28406. "description": "Short package description."
  28407. },
  28408. "keywords": {
  28409. "type": "array",
  28410. "items": {
  28411. "type": "string",
  28412. "description": "A tag/keyword that this package relates to."
  28413. }
  28414. },
  28415. "homepage": {
  28416. "type": "string",
  28417. "description": "Homepage URL for the project.",
  28418. "format": "uri"
  28419. },
  28420. "readme": {
  28421. "type": "string",
  28422. "description": "Relative path to the readme document."
  28423. },
  28424. "version": {
  28425. "type": "string",
  28426. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  28427. },
  28428. "time": {
  28429. "type": "string",
  28430. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28431. },
  28432. "license": {
  28433. "type": ["string", "array"],
  28434. "description": "License name. Or an array of license names."
  28435. },
  28436. "authors": {
  28437. "$ref": "#/definitions/authors"
  28438. },
  28439. "require": {
  28440. "type": "object",
  28441. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28442. "additionalProperties": {
  28443. "type": "string"
  28444. }
  28445. },
  28446. "replace": {
  28447. "type": "object",
  28448. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28449. "additionalProperties": {
  28450. "type": "string"
  28451. }
  28452. },
  28453. "conflict": {
  28454. "type": "object",
  28455. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28456. "additionalProperties": {
  28457. "type": "string"
  28458. }
  28459. },
  28460. "provide": {
  28461. "type": "object",
  28462. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28463. "additionalProperties": {
  28464. "type": "string"
  28465. }
  28466. },
  28467. "require-dev": {
  28468. "type": "object",
  28469. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28470. "additionalProperties": {
  28471. "type": "string"
  28472. }
  28473. },
  28474. "suggest": {
  28475. "type": "object",
  28476. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  28477. "additionalProperties": {
  28478. "type": "string"
  28479. }
  28480. },
  28481. "config": {
  28482. "type": "object",
  28483. "description": "Composer options.",
  28484. "properties": {
  28485. "process-timeout": {
  28486. "type": "integer",
  28487. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28488. },
  28489. "use-include-path": {
  28490. "type": "boolean",
  28491. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28492. },
  28493. "preferred-install": {
  28494. "type": ["string", "object"],
  28495. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  28496. },
  28497. "notify-on-install": {
  28498. "type": "boolean",
  28499. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  28500. },
  28501. "github-protocols": {
  28502. "type": "array",
  28503. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28504. "items": {
  28505. "type": "string"
  28506. }
  28507. },
  28508. "github-oauth": {
  28509. "type": "object",
  28510. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28511. "additionalProperties": {
  28512. "type": "string"
  28513. }
  28514. },
  28515. "gitlab-oauth": {
  28516. "type": "object",
  28517. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28518. "additionalProperties": {
  28519. "type": "string"
  28520. }
  28521. },
  28522. "gitlab-token": {
  28523. "type": "object",
  28524. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28525. "additionalProperties": true
  28526. },
  28527. "disable-tls": {
  28528. "type": "boolean",
  28529. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  28530. },
  28531. "secure-http": {
  28532. "type": "boolean",
  28533. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  28534. },
  28535. "cafile": {
  28536. "type": "string",
  28537. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  28538. },
  28539. "capath": {
  28540. "type": "string",
  28541. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  28542. },
  28543. "http-basic": {
  28544. "type": "object",
  28545. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  28546. "additionalProperties": {
  28547. "type": "object",
  28548. "required": ["username", "password"],
  28549. "properties": {
  28550. "username": {
  28551. "type": "string",
  28552. "description": "The username used for HTTP Basic authentication"
  28553. },
  28554. "password": {
  28555. "type": "string",
  28556. "description": "The password used for HTTP Basic authentication"
  28557. }
  28558. }
  28559. }
  28560. },
  28561. "store-auths": {
  28562. "type": ["string", "boolean"],
  28563. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  28564. },
  28565. "platform": {
  28566. "type": "object",
  28567. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  28568. "additionalProperties": {
  28569. "type": "string"
  28570. }
  28571. },
  28572. "vendor-dir": {
  28573. "type": "string",
  28574. "description": "The location where all packages are installed, defaults to \"vendor\"."
  28575. },
  28576. "bin-dir": {
  28577. "type": "string",
  28578. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  28579. },
  28580. "data-dir": {
  28581. "type": "string",
  28582. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  28583. },
  28584. "cache-dir": {
  28585. "type": "string",
  28586. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  28587. },
  28588. "cache-files-dir": {
  28589. "type": "string",
  28590. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  28591. },
  28592. "cache-repo-dir": {
  28593. "type": "string",
  28594. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  28595. },
  28596. "cache-vcs-dir": {
  28597. "type": "string",
  28598. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  28599. },
  28600. "cache-ttl": {
  28601. "type": "integer",
  28602. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  28603. },
  28604. "cache-files-ttl": {
  28605. "type": "integer",
  28606. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  28607. },
  28608. "cache-files-maxsize": {
  28609. "type": ["string", "integer"],
  28610. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  28611. },
  28612. "bin-compat": {
  28613. "enum": ["auto", "full"],
  28614. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  28615. },
  28616. "discard-changes": {
  28617. "type": ["string", "boolean"],
  28618. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  28619. },
  28620. "autoloader-suffix": {
  28621. "type": "string",
  28622. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  28623. },
  28624. "optimize-autoloader": {
  28625. "type": "boolean",
  28626. "description": "Always optimize when dumping the autoloader."
  28627. },
  28628. "prepend-autoloader": {
  28629. "type": "boolean",
  28630. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  28631. },
  28632. "classmap-authoritative": {
  28633. "type": "boolean",
  28634. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  28635. },
  28636. "apcu-autoloader": {
  28637. "type": "boolean",
  28638. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  28639. },
  28640. "github-domains": {
  28641. "type": "array",
  28642. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  28643. "items": {
  28644. "type": "string"
  28645. }
  28646. },
  28647. "github-expose-hostname": {
  28648. "type": "boolean",
  28649. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  28650. },
  28651. "gitlab-domains": {
  28652. "type": "array",
  28653. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  28654. "items": {
  28655. "type": "string"
  28656. }
  28657. },
  28658. "archive-format": {
  28659. "type": "string",
  28660. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  28661. },
  28662. "archive-dir": {
  28663. "type": "string",
  28664. "description": "The default archive path when not provided on cli, defaults to \".\"."
  28665. },
  28666. "htaccess-protect": {
  28667. "type": "boolean",
  28668. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  28669. },
  28670. "sort-packages": {
  28671. "type": "boolean",
  28672. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  28673. }
  28674. }
  28675. },
  28676. "extra": {
  28677. "type": ["object", "array"],
  28678. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  28679. "additionalProperties": true
  28680. },
  28681. "autoload": {
  28682. "$ref": "#/definitions/autoload"
  28683. },
  28684. "autoload-dev": {
  28685. "type": "object",
  28686. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  28687. "properties": {
  28688. "psr-0": {
  28689. "type": "object",
  28690. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  28691. "additionalProperties": {
  28692. "type": ["string", "array"],
  28693. "items": {
  28694. "type": "string"
  28695. }
  28696. }
  28697. },
  28698. "psr-4": {
  28699. "type": "object",
  28700. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28701. "additionalProperties": {
  28702. "type": ["string", "array"],
  28703. "items": {
  28704. "type": "string"
  28705. }
  28706. }
  28707. },
  28708. "classmap": {
  28709. "type": "array",
  28710. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28711. },
  28712. "files": {
  28713. "type": "array",
  28714. "description": "This is an array of files that are always required on every request."
  28715. }
  28716. }
  28717. },
  28718. "archive": {
  28719. "type": ["object"],
  28720. "description": "Options for creating package archives for distribution.",
  28721. "properties": {
  28722. "exclude": {
  28723. "type": "array",
  28724. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  28725. }
  28726. }
  28727. },
  28728. "repositories": {
  28729. "type": ["object", "array"],
  28730. "description": "A set of additional repositories where packages can be found.",
  28731. "additionalProperties": {
  28732. "oneOf": [
  28733. { "$ref": "#/definitions/repository" },
  28734. { "type": "boolean", "enum": [false] }
  28735. ]
  28736. },
  28737. "items": {
  28738. "oneOf": [
  28739. { "$ref": "#/definitions/repository" },
  28740. {
  28741. "type": "object",
  28742. "additionalProperties": { "type": "boolean", "enum": [false] },
  28743. "minProperties": 1,
  28744. "maxProperties": 1
  28745. }
  28746. ]
  28747. }
  28748. },
  28749. "minimum-stability": {
  28750. "type": ["string"],
  28751. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  28752. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  28753. },
  28754. "prefer-stable": {
  28755. "type": ["boolean"],
  28756. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  28757. },
  28758. "bin": {
  28759. "type": ["string", "array"],
  28760. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28761. "items": {
  28762. "type": "string"
  28763. }
  28764. },
  28765. "include-path": {
  28766. "type": ["array"],
  28767. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28768. "items": {
  28769. "type": "string"
  28770. }
  28771. },
  28772. "scripts": {
  28773. "type": ["object"],
  28774. "description": "Script listeners that will be executed before/after some events.",
  28775. "properties": {
  28776. "pre-install-cmd": {
  28777. "type": ["array", "string"],
  28778. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  28779. },
  28780. "post-install-cmd": {
  28781. "type": ["array", "string"],
  28782. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  28783. },
  28784. "pre-update-cmd": {
  28785. "type": ["array", "string"],
  28786. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  28787. },
  28788. "post-update-cmd": {
  28789. "type": ["array", "string"],
  28790. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  28791. },
  28792. "pre-status-cmd": {
  28793. "type": ["array", "string"],
  28794. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  28795. },
  28796. "post-status-cmd": {
  28797. "type": ["array", "string"],
  28798. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  28799. },
  28800. "pre-package-install": {
  28801. "type": ["array", "string"],
  28802. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  28803. },
  28804. "post-package-install": {
  28805. "type": ["array", "string"],
  28806. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  28807. },
  28808. "pre-package-update": {
  28809. "type": ["array", "string"],
  28810. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  28811. },
  28812. "post-package-update": {
  28813. "type": ["array", "string"],
  28814. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  28815. },
  28816. "pre-package-uninstall": {
  28817. "type": ["array", "string"],
  28818. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28819. },
  28820. "post-package-uninstall": {
  28821. "type": ["array", "string"],
  28822. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28823. },
  28824. "pre-autoload-dump": {
  28825. "type": ["array", "string"],
  28826. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28827. },
  28828. "post-autoload-dump": {
  28829. "type": ["array", "string"],
  28830. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28831. },
  28832. "post-root-package-install": {
  28833. "type": ["array", "string"],
  28834. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28835. },
  28836. "post-create-project-cmd": {
  28837. "type": ["array", "string"],
  28838. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28839. }
  28840. }
  28841. },
  28842. "scripts-descriptions": {
  28843. "type": ["object"],
  28844. "description": "Descriptions for custom commands, shown in console help.",
  28845. "additionalProperties": {
  28846. "type": "string"
  28847. }
  28848. },
  28849. "support": {
  28850. "type": "object",
  28851. "properties": {
  28852. "email": {
  28853. "type": "string",
  28854. "description": "Email address for support.",
  28855. "format": "email"
  28856. },
  28857. "issues": {
  28858. "type": "string",
  28859. "description": "URL to the issue tracker.",
  28860. "format": "uri"
  28861. },
  28862. "forum": {
  28863. "type": "string",
  28864. "description": "URL to the forum.",
  28865. "format": "uri"
  28866. },
  28867. "wiki": {
  28868. "type": "string",
  28869. "description": "URL to the wiki.",
  28870. "format": "uri"
  28871. },
  28872. "irc": {
  28873. "type": "string",
  28874. "description": "IRC channel for support, as irc://server/channel.",
  28875. "format": "uri"
  28876. },
  28877. "chat": {
  28878. "type": "string",
  28879. "description": "URL to the support chat.",
  28880. "format": "uri"
  28881. },
  28882. "source": {
  28883. "type": "string",
  28884. "description": "URL to browse or download the sources.",
  28885. "format": "uri"
  28886. },
  28887. "docs": {
  28888. "type": "string",
  28889. "description": "URL to the documentation.",
  28890. "format": "uri"
  28891. },
  28892. "rss": {
  28893. "type": "string",
  28894. "description": "URL to the RSS feed.",
  28895. "format": "uri"
  28896. }
  28897. }
  28898. },
  28899. "non-feature-branches": {
  28900. "type": ["array"],
  28901. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28902. "items": {
  28903. "type": "string"
  28904. }
  28905. },
  28906. "abandoned": {
  28907. "type": ["boolean", "string"],
  28908. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  28909. },
  28910. "_comment": {
  28911. "type": ["array", "string"],
  28912. "description": "A key to store comments in"
  28913. }
  28914. },
  28915. "definitions": {
  28916. "authors": {
  28917. "type": "array",
  28918. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28919. "items": {
  28920. "type": "object",
  28921. "additionalProperties": false,
  28922. "required": [ "name"],
  28923. "properties": {
  28924. "name": {
  28925. "type": "string",
  28926. "description": "Full name of the author."
  28927. },
  28928. "email": {
  28929. "type": "string",
  28930. "description": "Email address of the author.",
  28931. "format": "email"
  28932. },
  28933. "homepage": {
  28934. "type": "string",
  28935. "description": "Homepage URL for the author.",
  28936. "format": "uri"
  28937. },
  28938. "role": {
  28939. "type": "string",
  28940. "description": "Author's role in the project."
  28941. }
  28942. }
  28943. }
  28944. },
  28945. "autoload": {
  28946. "type": "object",
  28947. "description": "Description of how the package can be autoloaded.",
  28948. "properties": {
  28949. "psr-0": {
  28950. "type": "object",
  28951. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  28952. "additionalProperties": {
  28953. "type": ["string", "array"],
  28954. "items": {
  28955. "type": "string"
  28956. }
  28957. }
  28958. },
  28959. "psr-4": {
  28960. "type": "object",
  28961. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28962. "additionalProperties": {
  28963. "type": ["string", "array"],
  28964. "items": {
  28965. "type": "string"
  28966. }
  28967. }
  28968. },
  28969. "classmap": {
  28970. "type": "array",
  28971. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28972. },
  28973. "files": {
  28974. "type": "array",
  28975. "description": "This is an array of files that are always required on every request."
  28976. },
  28977. "exclude-from-classmap": {
  28978. "type": "array",
  28979. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28980. }
  28981. }
  28982. },
  28983. "repository": {
  28984. "type": "object",
  28985. "oneOf": [
  28986. { "$ref": "#/definitions/composer-repository" },
  28987. { "$ref": "#/definitions/vcs-repository" },
  28988. { "$ref": "#/definitions/path-repository" },
  28989. { "$ref": "#/definitions/artifact-repository" },
  28990. { "$ref": "#/definitions/pear-repository" },
  28991. { "$ref": "#/definitions/package-repository" }
  28992. ]
  28993. },
  28994. "composer-repository": {
  28995. "type": "object",
  28996. "required": ["type", "url"],
  28997. "properties": {
  28998. "type": { "type": "string", "enum": ["composer"] },
  28999. "url": { "type": "string" },
  29000. "options": {
  29001. "type": "object",
  29002. "additionalProperties": true
  29003. },
  29004. "allow_ssl_downgrade": { "type": "boolean" },
  29005. "force-lazy-providers": { "type": "boolean" }
  29006. }
  29007. },
  29008. "vcs-repository": {
  29009. "type": "object",
  29010. "required": ["type", "url"],
  29011. "properties": {
  29012. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  29013. "url": { "type": "string" },
  29014. "no-api": { "type": "boolean" },
  29015. "secure-http": { "type": "boolean" },
  29016. "svn-cache-credentials": { "type": "boolean" },
  29017. "trunk-path": { "type": ["string", "boolean"] },
  29018. "branches-path": { "type": ["string", "boolean"] },
  29019. "tags-path": { "type": ["string", "boolean"] },
  29020. "package-path": { "type": "string" },
  29021. "depot": { "type": "string" },
  29022. "branch": { "type": "string" },
  29023. "unique_perforce_client_name": { "type": "string" },
  29024. "p4user": { "type": "string" },
  29025. "p4password": { "type": "string" }
  29026. }
  29027. },
  29028. "path-repository": {
  29029. "type": "object",
  29030. "required": ["type", "url"],
  29031. "properties": {
  29032. "type": { "type": "string", "enum": ["path"] },
  29033. "url": { "type": "string" },
  29034. "options": {
  29035. "type": "object",
  29036. "properties": {
  29037. "symlink": { "type": ["boolean", "null"] }
  29038. },
  29039. "additionalProperties": true
  29040. }
  29041. }
  29042. },
  29043. "artifact-repository": {
  29044. "type": "object",
  29045. "required": ["type", "url"],
  29046. "properties": {
  29047. "type": { "type": "string", "enum": ["artifact"] },
  29048. "url": { "type": "string" }
  29049. }
  29050. },
  29051. "pear-repository": {
  29052. "type": "object",
  29053. "required": ["type", "url"],
  29054. "properties": {
  29055. "type": { "type": "string", "enum": ["pear"] },
  29056. "url": { "type": "string" },
  29057. "vendor-alias": { "type": "string" }
  29058. }
  29059. },
  29060. "package-repository": {
  29061. "type": "object",
  29062. "required": ["type", "package"],
  29063. "properties": {
  29064. "type": { "type": "string", "enum": ["package"] },
  29065. "package": {
  29066. "oneOf": [
  29067. { "$ref": "#/definitions/inline-package" },
  29068. {
  29069. "type": "array",
  29070. "items": { "$ref": "#/definitions/inline-package" }
  29071. }
  29072. ]
  29073. }
  29074. }
  29075. },
  29076. "inline-package": {
  29077. "type": "object",
  29078. "required": ["name", "version"],
  29079. "properties": {
  29080. "name": {
  29081. "type": "string",
  29082. "description": "Package name, including 'vendor-name/' prefix."
  29083. },
  29084. "type": {
  29085. "type": "string"
  29086. },
  29087. "target-dir": {
  29088. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  29089. "type": "string"
  29090. },
  29091. "description": {
  29092. "type": "string"
  29093. },
  29094. "keywords": {
  29095. "type": "array",
  29096. "items": {
  29097. "type": "string"
  29098. }
  29099. },
  29100. "homepage": {
  29101. "type": "string",
  29102. "format": "uri"
  29103. },
  29104. "version": {
  29105. "type": "string"
  29106. },
  29107. "time": {
  29108. "type": "string"
  29109. },
  29110. "license": {
  29111. "type": [
  29112. "string",
  29113. "array"
  29114. ]
  29115. },
  29116. "authors": {
  29117. "$ref": "#/definitions/authors"
  29118. },
  29119. "require": {
  29120. "type": "object",
  29121. "additionalProperties": {
  29122. "type": "string"
  29123. }
  29124. },
  29125. "replace": {
  29126. "type": "object",
  29127. "additionalProperties": {
  29128. "type": "string"
  29129. }
  29130. },
  29131. "conflict": {
  29132. "type": "object",
  29133. "additionalProperties": {
  29134. "type": "string"
  29135. }
  29136. },
  29137. "provide": {
  29138. "type": "object",
  29139. "additionalProperties": {
  29140. "type": "string"
  29141. }
  29142. },
  29143. "require-dev": {
  29144. "type": "object",
  29145. "additionalProperties": {
  29146. "type": "string"
  29147. }
  29148. },
  29149. "suggest": {
  29150. "type": "object",
  29151. "additionalProperties": {
  29152. "type": "string"
  29153. }
  29154. },
  29155. "extra": {
  29156. "type": ["object", "array"],
  29157. "additionalProperties": true
  29158. },
  29159. "autoload": {
  29160. "$ref": "#/definitions/autoload"
  29161. },
  29162. "archive": {
  29163. "type": ["object"],
  29164. "properties": {
  29165. "exclude": {
  29166. "type": "array"
  29167. }
  29168. }
  29169. },
  29170. "bin": {
  29171. "type": ["string", "array"],
  29172. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29173. "items": {
  29174. "type": "string"
  29175. }
  29176. },
  29177. "include-path": {
  29178. "type": ["array"],
  29179. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  29180. "items": {
  29181. "type": "string"
  29182. }
  29183. },
  29184. "source": {
  29185. "type": "object",
  29186. "required": ["type", "url", "reference"],
  29187. "properties": {
  29188. "type": {
  29189. "type": "string"
  29190. },
  29191. "url": {
  29192. "type": "string"
  29193. },
  29194. "reference": {
  29195. "type": "string"
  29196. },
  29197. "mirrors": {
  29198. "type": "array"
  29199. }
  29200. }
  29201. },
  29202. "dist": {
  29203. "type": "object",
  29204. "required": ["type", "url"],
  29205. "properties": {
  29206. "type": {
  29207. "type": "string"
  29208. },
  29209. "url": {
  29210. "type": "string"
  29211. },
  29212. "reference": {
  29213. "type": "string"
  29214. },
  29215. "shasum": {
  29216. "type": "string"
  29217. },
  29218. "mirrors": {
  29219. "type": "array"
  29220. }
  29221. }
  29222. }
  29223. },
  29224. "additionalProperties": true
  29225. }
  29226. }
  29227. }
  29228. {
  29229. "389-exception": [
  29230. "389 Directory Server Exception"
  29231. ],
  29232. "Autoconf-exception-2.0": [
  29233. "Autoconf exception 2.0"
  29234. ],
  29235. "Autoconf-exception-3.0": [
  29236. "Autoconf exception 3.0"
  29237. ],
  29238. "Bison-exception-2.2": [
  29239. "Bison exception 2.2"
  29240. ],
  29241. "Bootloader-exception": [
  29242. "Bootloader Distribution Exception"
  29243. ],
  29244. "Classpath-exception-2.0": [
  29245. "Classpath exception 2.0"
  29246. ],
  29247. "CLISP-exception-2.0": [
  29248. "CLISP exception 2.0"
  29249. ],
  29250. "DigiRule-FOSS-exception": [
  29251. "DigiRule FOSS License Exception"
  29252. ],
  29253. "eCos-exception-2.0": [
  29254. "eCos exception 2.0"
  29255. ],
  29256. "Fawkes-Runtime-exception": [
  29257. "Fawkes Runtime Exception"
  29258. ],
  29259. "FLTK-exception": [
  29260. "FLTK exception"
  29261. ],
  29262. "Font-exception-2.0": [
  29263. "Font exception 2.0"
  29264. ],
  29265. "freertos-exception-2.0": [
  29266. "FreeRTOS Exception 2.0"
  29267. ],
  29268. "GCC-exception-2.0": [
  29269. "GCC Runtime Library exception 2.0"
  29270. ],
  29271. "GCC-exception-3.1": [
  29272. "GCC Runtime Library exception 3.1"
  29273. ],
  29274. "gnu-javamail-exception": [
  29275. "GNU JavaMail exception"
  29276. ],
  29277. "i2p-gpl-java-exception": [
  29278. "i2p GPL+Java Exception"
  29279. ],
  29280. "Libtool-exception": [
  29281. "Libtool Exception"
  29282. ],
  29283. "Linux-syscall-note": [
  29284. "Linux Syscall Note"
  29285. ],
  29286. "LLVM-exception": [
  29287. "LLVM Exception"
  29288. ],
  29289. "LZMA-exception": [
  29290. "LZMA exception"
  29291. ],
  29292. "mif-exception": [
  29293. "Macros and Inline Functions Exception"
  29294. ],
  29295. "Nokia-Qt-exception-1.1": [
  29296. "Nokia Qt LGPL exception 1.1"
  29297. ],
  29298. "OCaml-LGPL-linking-exception": [
  29299. "OCaml LGPL Linking Exception"
  29300. ],
  29301. "OCCT-exception-1.0": [
  29302. "Open CASCADE Exception 1.0"
  29303. ],
  29304. "OpenJDK-assembly-exception-1.0": [
  29305. "OpenJDK Assembly exception 1.0"
  29306. ],
  29307. "openvpn-openssl-exception": [
  29308. "OpenVPN OpenSSL Exception"
  29309. ],
  29310. "PS-or-PDF-font-exception-20170817": [
  29311. "PS/PDF font exception (2017-08-17)"
  29312. ],
  29313. "Qt-GPL-exception-1.0": [
  29314. "Qt GPL exception 1.0"
  29315. ],
  29316. "Qt-LGPL-exception-1.1": [
  29317. "Qt LGPL exception 1.1"
  29318. ],
  29319. "Qwt-exception-1.0": [
  29320. "Qwt exception 1.0"
  29321. ],
  29322. "u-boot-exception-2.0": [
  29323. "U-Boot exception 2.0"
  29324. ],
  29325. "WxWindows-exception-3.1": [
  29326. "WxWindows Library Exception 3.1"
  29327. ]
  29328. }{
  29329. "0BSD": [
  29330. "BSD Zero Clause License",
  29331. false,
  29332. false
  29333. ],
  29334. "AAL": [
  29335. "Attribution Assurance License",
  29336. true,
  29337. false
  29338. ],
  29339. "Abstyles": [
  29340. "Abstyles License",
  29341. false,
  29342. false
  29343. ],
  29344. "Adobe-2006": [
  29345. "Adobe Systems Incorporated Source Code License Agreement",
  29346. false,
  29347. false
  29348. ],
  29349. "Adobe-Glyph": [
  29350. "Adobe Glyph List License",
  29351. false,
  29352. false
  29353. ],
  29354. "ADSL": [
  29355. "Amazon Digital Services License",
  29356. false,
  29357. false
  29358. ],
  29359. "AFL-1.1": [
  29360. "Academic Free License v1.1",
  29361. true,
  29362. false
  29363. ],
  29364. "AFL-1.2": [
  29365. "Academic Free License v1.2",
  29366. true,
  29367. false
  29368. ],
  29369. "AFL-2.0": [
  29370. "Academic Free License v2.0",
  29371. true,
  29372. false
  29373. ],
  29374. "AFL-2.1": [
  29375. "Academic Free License v2.1",
  29376. true,
  29377. false
  29378. ],
  29379. "AFL-3.0": [
  29380. "Academic Free License v3.0",
  29381. true,
  29382. false
  29383. ],
  29384. "Afmparse": [
  29385. "Afmparse License",
  29386. false,
  29387. false
  29388. ],
  29389. "AGPL-1.0": [
  29390. "Affero General Public License v1.0",
  29391. false,
  29392. true
  29393. ],
  29394. "AGPL-1.0-only": [
  29395. "Affero General Public License v1.0 only",
  29396. false,
  29397. false
  29398. ],
  29399. "AGPL-1.0-or-later": [
  29400. "Affero General Public License v1.0 or later",
  29401. false,
  29402. false
  29403. ],
  29404. "AGPL-3.0": [
  29405. "GNU Affero General Public License v3.0",
  29406. true,
  29407. true
  29408. ],
  29409. "AGPL-3.0-only": [
  29410. "GNU Affero General Public License v3.0 only",
  29411. true,
  29412. false
  29413. ],
  29414. "AGPL-3.0-or-later": [
  29415. "GNU Affero General Public License v3.0 or later",
  29416. true,
  29417. false
  29418. ],
  29419. "Aladdin": [
  29420. "Aladdin Free Public License",
  29421. false,
  29422. false
  29423. ],
  29424. "AMDPLPA": [
  29425. "AMD's plpa_map.c License",
  29426. false,
  29427. false
  29428. ],
  29429. "AML": [
  29430. "Apple MIT License",
  29431. false,
  29432. false
  29433. ],
  29434. "AMPAS": [
  29435. "Academy of Motion Picture Arts and Sciences BSD",
  29436. false,
  29437. false
  29438. ],
  29439. "ANTLR-PD": [
  29440. "ANTLR Software Rights Notice",
  29441. false,
  29442. false
  29443. ],
  29444. "Apache-1.0": [
  29445. "Apache License 1.0",
  29446. false,
  29447. false
  29448. ],
  29449. "Apache-1.1": [
  29450. "Apache License 1.1",
  29451. true,
  29452. false
  29453. ],
  29454. "Apache-2.0": [
  29455. "Apache License 2.0",
  29456. true,
  29457. false
  29458. ],
  29459. "APAFML": [
  29460. "Adobe Postscript AFM License",
  29461. false,
  29462. false
  29463. ],
  29464. "APL-1.0": [
  29465. "Adaptive Public License 1.0",
  29466. true,
  29467. false
  29468. ],
  29469. "APSL-1.0": [
  29470. "Apple Public Source License 1.0",
  29471. true,
  29472. false
  29473. ],
  29474. "APSL-1.1": [
  29475. "Apple Public Source License 1.1",
  29476. true,
  29477. false
  29478. ],
  29479. "APSL-1.2": [
  29480. "Apple Public Source License 1.2",
  29481. true,
  29482. false
  29483. ],
  29484. "APSL-2.0": [
  29485. "Apple Public Source License 2.0",
  29486. true,
  29487. false
  29488. ],
  29489. "Artistic-1.0": [
  29490. "Artistic License 1.0",
  29491. true,
  29492. false
  29493. ],
  29494. "Artistic-1.0-cl8": [
  29495. "Artistic License 1.0 w/clause 8",
  29496. true,
  29497. false
  29498. ],
  29499. "Artistic-1.0-Perl": [
  29500. "Artistic License 1.0 (Perl)",
  29501. true,
  29502. false
  29503. ],
  29504. "Artistic-2.0": [
  29505. "Artistic License 2.0",
  29506. true,
  29507. false
  29508. ],
  29509. "Bahyph": [
  29510. "Bahyph License",
  29511. false,
  29512. false
  29513. ],
  29514. "Barr": [
  29515. "Barr License",
  29516. false,
  29517. false
  29518. ],
  29519. "Beerware": [
  29520. "Beerware License",
  29521. false,
  29522. false
  29523. ],
  29524. "BitTorrent-1.0": [
  29525. "BitTorrent Open Source License v1.0",
  29526. false,
  29527. false
  29528. ],
  29529. "BitTorrent-1.1": [
  29530. "BitTorrent Open Source License v1.1",
  29531. false,
  29532. false
  29533. ],
  29534. "Borceux": [
  29535. "Borceux license",
  29536. false,
  29537. false
  29538. ],
  29539. "BSD-1-Clause": [
  29540. "BSD 1-Clause License",
  29541. false,
  29542. false
  29543. ],
  29544. "BSD-2-Clause": [
  29545. "BSD 2-Clause \"Simplified\" License",
  29546. true,
  29547. false
  29548. ],
  29549. "BSD-2-Clause-FreeBSD": [
  29550. "BSD 2-Clause FreeBSD License",
  29551. false,
  29552. false
  29553. ],
  29554. "BSD-2-Clause-NetBSD": [
  29555. "BSD 2-Clause NetBSD License",
  29556. false,
  29557. false
  29558. ],
  29559. "BSD-2-Clause-Patent": [
  29560. "BSD-2-Clause Plus Patent License",
  29561. true,
  29562. false
  29563. ],
  29564. "BSD-3-Clause": [
  29565. "BSD 3-Clause \"New\" or \"Revised\" License",
  29566. true,
  29567. false
  29568. ],
  29569. "BSD-3-Clause-Attribution": [
  29570. "BSD with attribution",
  29571. false,
  29572. false
  29573. ],
  29574. "BSD-3-Clause-Clear": [
  29575. "BSD 3-Clause Clear License",
  29576. false,
  29577. false
  29578. ],
  29579. "BSD-3-Clause-LBNL": [
  29580. "Lawrence Berkeley National Labs BSD variant license",
  29581. false,
  29582. false
  29583. ],
  29584. "BSD-3-Clause-No-Nuclear-License": [
  29585. "BSD 3-Clause No Nuclear License",
  29586. false,
  29587. false
  29588. ],
  29589. "BSD-3-Clause-No-Nuclear-License-2014": [
  29590. "BSD 3-Clause No Nuclear License 2014",
  29591. false,
  29592. false
  29593. ],
  29594. "BSD-3-Clause-No-Nuclear-Warranty": [
  29595. "BSD 3-Clause No Nuclear Warranty",
  29596. false,
  29597. false
  29598. ],
  29599. "BSD-4-Clause": [
  29600. "BSD 4-Clause \"Original\" or \"Old\" License",
  29601. false,
  29602. false
  29603. ],
  29604. "BSD-4-Clause-UC": [
  29605. "BSD-4-Clause (University of California-Specific)",
  29606. false,
  29607. false
  29608. ],
  29609. "BSD-Protection": [
  29610. "BSD Protection License",
  29611. false,
  29612. false
  29613. ],
  29614. "BSD-Source-Code": [
  29615. "BSD Source Code Attribution",
  29616. false,
  29617. false
  29618. ],
  29619. "BSL-1.0": [
  29620. "Boost Software License 1.0",
  29621. true,
  29622. false
  29623. ],
  29624. "bzip2-1.0.5": [
  29625. "bzip2 and libbzip2 License v1.0.5",
  29626. false,
  29627. false
  29628. ],
  29629. "bzip2-1.0.6": [
  29630. "bzip2 and libbzip2 License v1.0.6",
  29631. false,
  29632. false
  29633. ],
  29634. "Caldera": [
  29635. "Caldera License",
  29636. false,
  29637. false
  29638. ],
  29639. "CATOSL-1.1": [
  29640. "Computer Associates Trusted Open Source License 1.1",
  29641. true,
  29642. false
  29643. ],
  29644. "CC-BY-1.0": [
  29645. "Creative Commons Attribution 1.0 Generic",
  29646. false,
  29647. false
  29648. ],
  29649. "CC-BY-2.0": [
  29650. "Creative Commons Attribution 2.0 Generic",
  29651. false,
  29652. false
  29653. ],
  29654. "CC-BY-2.5": [
  29655. "Creative Commons Attribution 2.5 Generic",
  29656. false,
  29657. false
  29658. ],
  29659. "CC-BY-3.0": [
  29660. "Creative Commons Attribution 3.0 Unported",
  29661. false,
  29662. false
  29663. ],
  29664. "CC-BY-4.0": [
  29665. "Creative Commons Attribution 4.0 International",
  29666. false,
  29667. false
  29668. ],
  29669. "CC-BY-NC-1.0": [
  29670. "Creative Commons Attribution Non Commercial 1.0 Generic",
  29671. false,
  29672. false
  29673. ],
  29674. "CC-BY-NC-2.0": [
  29675. "Creative Commons Attribution Non Commercial 2.0 Generic",
  29676. false,
  29677. false
  29678. ],
  29679. "CC-BY-NC-2.5": [
  29680. "Creative Commons Attribution Non Commercial 2.5 Generic",
  29681. false,
  29682. false
  29683. ],
  29684. "CC-BY-NC-3.0": [
  29685. "Creative Commons Attribution Non Commercial 3.0 Unported",
  29686. false,
  29687. false
  29688. ],
  29689. "CC-BY-NC-4.0": [
  29690. "Creative Commons Attribution Non Commercial 4.0 International",
  29691. false,
  29692. false
  29693. ],
  29694. "CC-BY-NC-ND-1.0": [
  29695. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  29696. false,
  29697. false
  29698. ],
  29699. "CC-BY-NC-ND-2.0": [
  29700. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  29701. false,
  29702. false
  29703. ],
  29704. "CC-BY-NC-ND-2.5": [
  29705. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  29706. false,
  29707. false
  29708. ],
  29709. "CC-BY-NC-ND-3.0": [
  29710. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  29711. false,
  29712. false
  29713. ],
  29714. "CC-BY-NC-ND-4.0": [
  29715. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  29716. false,
  29717. false
  29718. ],
  29719. "CC-BY-NC-SA-1.0": [
  29720. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  29721. false,
  29722. false
  29723. ],
  29724. "CC-BY-NC-SA-2.0": [
  29725. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  29726. false,
  29727. false
  29728. ],
  29729. "CC-BY-NC-SA-2.5": [
  29730. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  29731. false,
  29732. false
  29733. ],
  29734. "CC-BY-NC-SA-3.0": [
  29735. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  29736. false,
  29737. false
  29738. ],
  29739. "CC-BY-NC-SA-4.0": [
  29740. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  29741. false,
  29742. false
  29743. ],
  29744. "CC-BY-ND-1.0": [
  29745. "Creative Commons Attribution No Derivatives 1.0 Generic",
  29746. false,
  29747. false
  29748. ],
  29749. "CC-BY-ND-2.0": [
  29750. "Creative Commons Attribution No Derivatives 2.0 Generic",
  29751. false,
  29752. false
  29753. ],
  29754. "CC-BY-ND-2.5": [
  29755. "Creative Commons Attribution No Derivatives 2.5 Generic",
  29756. false,
  29757. false
  29758. ],
  29759. "CC-BY-ND-3.0": [
  29760. "Creative Commons Attribution No Derivatives 3.0 Unported",
  29761. false,
  29762. false
  29763. ],
  29764. "CC-BY-ND-4.0": [
  29765. "Creative Commons Attribution No Derivatives 4.0 International",
  29766. false,
  29767. false
  29768. ],
  29769. "CC-BY-SA-1.0": [
  29770. "Creative Commons Attribution Share Alike 1.0 Generic",
  29771. false,
  29772. false
  29773. ],
  29774. "CC-BY-SA-2.0": [
  29775. "Creative Commons Attribution Share Alike 2.0 Generic",
  29776. false,
  29777. false
  29778. ],
  29779. "CC-BY-SA-2.5": [
  29780. "Creative Commons Attribution Share Alike 2.5 Generic",
  29781. false,
  29782. false
  29783. ],
  29784. "CC-BY-SA-3.0": [
  29785. "Creative Commons Attribution Share Alike 3.0 Unported",
  29786. false,
  29787. false
  29788. ],
  29789. "CC-BY-SA-4.0": [
  29790. "Creative Commons Attribution Share Alike 4.0 International",
  29791. false,
  29792. false
  29793. ],
  29794. "CC0-1.0": [
  29795. "Creative Commons Zero v1.0 Universal",
  29796. false,
  29797. false
  29798. ],
  29799. "CDDL-1.0": [
  29800. "Common Development and Distribution License 1.0",
  29801. true,
  29802. false
  29803. ],
  29804. "CDDL-1.1": [
  29805. "Common Development and Distribution License 1.1",
  29806. false,
  29807. false
  29808. ],
  29809. "CDLA-Permissive-1.0": [
  29810. "Community Data License Agreement Permissive 1.0",
  29811. false,
  29812. false
  29813. ],
  29814. "CDLA-Sharing-1.0": [
  29815. "Community Data License Agreement Sharing 1.0",
  29816. false,
  29817. false
  29818. ],
  29819. "CECILL-1.0": [
  29820. "CeCILL Free Software License Agreement v1.0",
  29821. false,
  29822. false
  29823. ],
  29824. "CECILL-1.1": [
  29825. "CeCILL Free Software License Agreement v1.1",
  29826. false,
  29827. false
  29828. ],
  29829. "CECILL-2.0": [
  29830. "CeCILL Free Software License Agreement v2.0",
  29831. false,
  29832. false
  29833. ],
  29834. "CECILL-2.1": [
  29835. "CeCILL Free Software License Agreement v2.1",
  29836. true,
  29837. false
  29838. ],
  29839. "CECILL-B": [
  29840. "CeCILL-B Free Software License Agreement",
  29841. false,
  29842. false
  29843. ],
  29844. "CECILL-C": [
  29845. "CeCILL-C Free Software License Agreement",
  29846. false,
  29847. false
  29848. ],
  29849. "ClArtistic": [
  29850. "Clarified Artistic License",
  29851. false,
  29852. false
  29853. ],
  29854. "CNRI-Jython": [
  29855. "CNRI Jython License",
  29856. false,
  29857. false
  29858. ],
  29859. "CNRI-Python": [
  29860. "CNRI Python License",
  29861. true,
  29862. false
  29863. ],
  29864. "CNRI-Python-GPL-Compatible": [
  29865. "CNRI Python Open Source GPL Compatible License Agreement",
  29866. false,
  29867. false
  29868. ],
  29869. "Condor-1.1": [
  29870. "Condor Public License v1.1",
  29871. false,
  29872. false
  29873. ],
  29874. "copyleft-next-0.3.1": [
  29875. "copyleft-next 0.3.1",
  29876. false,
  29877. false
  29878. ],
  29879. "CPAL-1.0": [
  29880. "Common Public Attribution License 1.0",
  29881. true,
  29882. false
  29883. ],
  29884. "CPL-1.0": [
  29885. "Common Public License 1.0",
  29886. true,
  29887. false
  29888. ],
  29889. "CPOL-1.02": [
  29890. "Code Project Open License 1.02",
  29891. false,
  29892. false
  29893. ],
  29894. "Crossword": [
  29895. "Crossword License",
  29896. false,
  29897. false
  29898. ],
  29899. "CrystalStacker": [
  29900. "CrystalStacker License",
  29901. false,
  29902. false
  29903. ],
  29904. "CUA-OPL-1.0": [
  29905. "CUA Office Public License v1.0",
  29906. true,
  29907. false
  29908. ],
  29909. "Cube": [
  29910. "Cube License",
  29911. false,
  29912. false
  29913. ],
  29914. "curl": [
  29915. "curl License",
  29916. false,
  29917. false
  29918. ],
  29919. "D-FSL-1.0": [
  29920. "Deutsche Freie Software Lizenz",
  29921. false,
  29922. false
  29923. ],
  29924. "diffmark": [
  29925. "diffmark license",
  29926. false,
  29927. false
  29928. ],
  29929. "DOC": [
  29930. "DOC License",
  29931. false,
  29932. false
  29933. ],
  29934. "Dotseqn": [
  29935. "Dotseqn License",
  29936. false,
  29937. false
  29938. ],
  29939. "DSDP": [
  29940. "DSDP License",
  29941. false,
  29942. false
  29943. ],
  29944. "dvipdfm": [
  29945. "dvipdfm License",
  29946. false,
  29947. false
  29948. ],
  29949. "ECL-1.0": [
  29950. "Educational Community License v1.0",
  29951. true,
  29952. false
  29953. ],
  29954. "ECL-2.0": [
  29955. "Educational Community License v2.0",
  29956. true,
  29957. false
  29958. ],
  29959. "eCos-2.0": [
  29960. "eCos license version 2.0",
  29961. false,
  29962. true
  29963. ],
  29964. "EFL-1.0": [
  29965. "Eiffel Forum License v1.0",
  29966. true,
  29967. false
  29968. ],
  29969. "EFL-2.0": [
  29970. "Eiffel Forum License v2.0",
  29971. true,
  29972. false
  29973. ],
  29974. "eGenix": [
  29975. "eGenix.com Public License 1.1.0",
  29976. false,
  29977. false
  29978. ],
  29979. "Entessa": [
  29980. "Entessa Public License v1.0",
  29981. true,
  29982. false
  29983. ],
  29984. "EPL-1.0": [
  29985. "Eclipse Public License 1.0",
  29986. true,
  29987. false
  29988. ],
  29989. "EPL-2.0": [
  29990. "Eclipse Public License 2.0",
  29991. true,
  29992. false
  29993. ],
  29994. "ErlPL-1.1": [
  29995. "Erlang Public License v1.1",
  29996. false,
  29997. false
  29998. ],
  29999. "EUDatagrid": [
  30000. "EU DataGrid Software License",
  30001. true,
  30002. false
  30003. ],
  30004. "EUPL-1.0": [
  30005. "European Union Public License 1.0",
  30006. false,
  30007. false
  30008. ],
  30009. "EUPL-1.1": [
  30010. "European Union Public License 1.1",
  30011. true,
  30012. false
  30013. ],
  30014. "EUPL-1.2": [
  30015. "European Union Public License 1.2",
  30016. true,
  30017. false
  30018. ],
  30019. "Eurosym": [
  30020. "Eurosym License",
  30021. false,
  30022. false
  30023. ],
  30024. "Fair": [
  30025. "Fair License",
  30026. true,
  30027. false
  30028. ],
  30029. "Frameworx-1.0": [
  30030. "Frameworx Open License 1.0",
  30031. true,
  30032. false
  30033. ],
  30034. "FreeImage": [
  30035. "FreeImage Public License v1.0",
  30036. false,
  30037. false
  30038. ],
  30039. "FSFAP": [
  30040. "FSF All Permissive License",
  30041. false,
  30042. false
  30043. ],
  30044. "FSFUL": [
  30045. "FSF Unlimited License",
  30046. false,
  30047. false
  30048. ],
  30049. "FSFULLR": [
  30050. "FSF Unlimited License (with License Retention)",
  30051. false,
  30052. false
  30053. ],
  30054. "FTL": [
  30055. "Freetype Project License",
  30056. false,
  30057. false
  30058. ],
  30059. "GFDL-1.1": [
  30060. "GNU Free Documentation License v1.1",
  30061. false,
  30062. true
  30063. ],
  30064. "GFDL-1.1-only": [
  30065. "GNU Free Documentation License v1.1 only",
  30066. false,
  30067. false
  30068. ],
  30069. "GFDL-1.1-or-later": [
  30070. "GNU Free Documentation License v1.1 or later",
  30071. false,
  30072. false
  30073. ],
  30074. "GFDL-1.2": [
  30075. "GNU Free Documentation License v1.2",
  30076. false,
  30077. true
  30078. ],
  30079. "GFDL-1.2-only": [
  30080. "GNU Free Documentation License v1.2 only",
  30081. false,
  30082. false
  30083. ],
  30084. "GFDL-1.2-or-later": [
  30085. "GNU Free Documentation License v1.2 or later",
  30086. false,
  30087. false
  30088. ],
  30089. "GFDL-1.3": [
  30090. "GNU Free Documentation License v1.3",
  30091. false,
  30092. true
  30093. ],
  30094. "GFDL-1.3-only": [
  30095. "GNU Free Documentation License v1.3 only",
  30096. false,
  30097. false
  30098. ],
  30099. "GFDL-1.3-or-later": [
  30100. "GNU Free Documentation License v1.3 or later",
  30101. false,
  30102. false
  30103. ],
  30104. "Giftware": [
  30105. "Giftware License",
  30106. false,
  30107. false
  30108. ],
  30109. "GL2PS": [
  30110. "GL2PS License",
  30111. false,
  30112. false
  30113. ],
  30114. "Glide": [
  30115. "3dfx Glide License",
  30116. false,
  30117. false
  30118. ],
  30119. "Glulxe": [
  30120. "Glulxe License",
  30121. false,
  30122. false
  30123. ],
  30124. "gnuplot": [
  30125. "gnuplot License",
  30126. false,
  30127. false
  30128. ],
  30129. "GPL-1.0": [
  30130. "GNU General Public License v1.0 only",
  30131. false,
  30132. true
  30133. ],
  30134. "GPL-1.0+": [
  30135. "GNU General Public License v1.0 or later",
  30136. false,
  30137. true
  30138. ],
  30139. "GPL-1.0-only": [
  30140. "GNU General Public License v1.0 only",
  30141. false,
  30142. false
  30143. ],
  30144. "GPL-1.0-or-later": [
  30145. "GNU General Public License v1.0 or later",
  30146. false,
  30147. false
  30148. ],
  30149. "GPL-2.0": [
  30150. "GNU General Public License v2.0 only",
  30151. true,
  30152. true
  30153. ],
  30154. "GPL-2.0+": [
  30155. "GNU General Public License v2.0 or later",
  30156. true,
  30157. true
  30158. ],
  30159. "GPL-2.0-only": [
  30160. "GNU General Public License v2.0 only",
  30161. true,
  30162. false
  30163. ],
  30164. "GPL-2.0-or-later": [
  30165. "GNU General Public License v2.0 or later",
  30166. true,
  30167. false
  30168. ],
  30169. "GPL-2.0-with-autoconf-exception": [
  30170. "GNU General Public License v2.0 w/Autoconf exception",
  30171. false,
  30172. true
  30173. ],
  30174. "GPL-2.0-with-bison-exception": [
  30175. "GNU General Public License v2.0 w/Bison exception",
  30176. false,
  30177. true
  30178. ],
  30179. "GPL-2.0-with-classpath-exception": [
  30180. "GNU General Public License v2.0 w/Classpath exception",
  30181. false,
  30182. true
  30183. ],
  30184. "GPL-2.0-with-font-exception": [
  30185. "GNU General Public License v2.0 w/Font exception",
  30186. false,
  30187. true
  30188. ],
  30189. "GPL-2.0-with-GCC-exception": [
  30190. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  30191. false,
  30192. true
  30193. ],
  30194. "GPL-3.0": [
  30195. "GNU General Public License v3.0 only",
  30196. true,
  30197. true
  30198. ],
  30199. "GPL-3.0+": [
  30200. "GNU General Public License v3.0 or later",
  30201. true,
  30202. true
  30203. ],
  30204. "GPL-3.0-only": [
  30205. "GNU General Public License v3.0 only",
  30206. true,
  30207. false
  30208. ],
  30209. "GPL-3.0-or-later": [
  30210. "GNU General Public License v3.0 or later",
  30211. true,
  30212. false
  30213. ],
  30214. "GPL-3.0-with-autoconf-exception": [
  30215. "GNU General Public License v3.0 w/Autoconf exception",
  30216. false,
  30217. true
  30218. ],
  30219. "GPL-3.0-with-GCC-exception": [
  30220. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  30221. true,
  30222. true
  30223. ],
  30224. "gSOAP-1.3b": [
  30225. "gSOAP Public License v1.3b",
  30226. false,
  30227. false
  30228. ],
  30229. "HaskellReport": [
  30230. "Haskell Language Report License",
  30231. false,
  30232. false
  30233. ],
  30234. "HPND": [
  30235. "Historical Permission Notice and Disclaimer",
  30236. true,
  30237. false
  30238. ],
  30239. "IBM-pibs": [
  30240. "IBM PowerPC Initialization and Boot Software",
  30241. false,
  30242. false
  30243. ],
  30244. "ICU": [
  30245. "ICU License",
  30246. false,
  30247. false
  30248. ],
  30249. "IJG": [
  30250. "Independent JPEG Group License",
  30251. false,
  30252. false
  30253. ],
  30254. "ImageMagick": [
  30255. "ImageMagick License",
  30256. false,
  30257. false
  30258. ],
  30259. "iMatix": [
  30260. "iMatix Standard Function Library Agreement",
  30261. false,
  30262. false
  30263. ],
  30264. "Imlib2": [
  30265. "Imlib2 License",
  30266. false,
  30267. false
  30268. ],
  30269. "Info-ZIP": [
  30270. "Info-ZIP License",
  30271. false,
  30272. false
  30273. ],
  30274. "Intel": [
  30275. "Intel Open Source License",
  30276. true,
  30277. false
  30278. ],
  30279. "Intel-ACPI": [
  30280. "Intel ACPI Software License Agreement",
  30281. false,
  30282. false
  30283. ],
  30284. "Interbase-1.0": [
  30285. "Interbase Public License v1.0",
  30286. false,
  30287. false
  30288. ],
  30289. "IPA": [
  30290. "IPA Font License",
  30291. true,
  30292. false
  30293. ],
  30294. "IPL-1.0": [
  30295. "IBM Public License v1.0",
  30296. true,
  30297. false
  30298. ],
  30299. "ISC": [
  30300. "ISC License",
  30301. true,
  30302. false
  30303. ],
  30304. "JasPer-2.0": [
  30305. "JasPer License",
  30306. false,
  30307. false
  30308. ],
  30309. "JSON": [
  30310. "JSON License",
  30311. false,
  30312. false
  30313. ],
  30314. "LAL-1.2": [
  30315. "Licence Art Libre 1.2",
  30316. false,
  30317. false
  30318. ],
  30319. "LAL-1.3": [
  30320. "Licence Art Libre 1.3",
  30321. false,
  30322. false
  30323. ],
  30324. "Latex2e": [
  30325. "Latex2e License",
  30326. false,
  30327. false
  30328. ],
  30329. "Leptonica": [
  30330. "Leptonica License",
  30331. false,
  30332. false
  30333. ],
  30334. "LGPL-2.0": [
  30335. "GNU Library General Public License v2 only",
  30336. true,
  30337. true
  30338. ],
  30339. "LGPL-2.0+": [
  30340. "GNU Library General Public License v2 or later",
  30341. true,
  30342. true
  30343. ],
  30344. "LGPL-2.0-only": [
  30345. "GNU Library General Public License v2 only",
  30346. true,
  30347. false
  30348. ],
  30349. "LGPL-2.0-or-later": [
  30350. "GNU Library General Public License v2 or later",
  30351. true,
  30352. false
  30353. ],
  30354. "LGPL-2.1": [
  30355. "GNU Lesser General Public License v2.1 only",
  30356. true,
  30357. true
  30358. ],
  30359. "LGPL-2.1+": [
  30360. "GNU Library General Public License v2.1 or later",
  30361. true,
  30362. true
  30363. ],
  30364. "LGPL-2.1-only": [
  30365. "GNU Lesser General Public License v2.1 only",
  30366. true,
  30367. false
  30368. ],
  30369. "LGPL-2.1-or-later": [
  30370. "GNU Lesser General Public License v2.1 or later",
  30371. true,
  30372. false
  30373. ],
  30374. "LGPL-3.0": [
  30375. "GNU Lesser General Public License v3.0 only",
  30376. true,
  30377. true
  30378. ],
  30379. "LGPL-3.0+": [
  30380. "GNU Lesser General Public License v3.0 or later",
  30381. true,
  30382. true
  30383. ],
  30384. "LGPL-3.0-only": [
  30385. "GNU Lesser General Public License v3.0 only",
  30386. true,
  30387. false
  30388. ],
  30389. "LGPL-3.0-or-later": [
  30390. "GNU Lesser General Public License v3.0 or later",
  30391. true,
  30392. false
  30393. ],
  30394. "LGPLLR": [
  30395. "Lesser General Public License For Linguistic Resources",
  30396. false,
  30397. false
  30398. ],
  30399. "Libpng": [
  30400. "libpng License",
  30401. false,
  30402. false
  30403. ],
  30404. "libtiff": [
  30405. "libtiff License",
  30406. false,
  30407. false
  30408. ],
  30409. "LiLiQ-P-1.1": [
  30410. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30411. true,
  30412. false
  30413. ],
  30414. "LiLiQ-R-1.1": [
  30415. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30416. true,
  30417. false
  30418. ],
  30419. "LiLiQ-Rplus-1.1": [
  30420. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30421. true,
  30422. false
  30423. ],
  30424. "Linux-OpenIB": [
  30425. "Linux Kernel Variant of OpenIB.org license",
  30426. false,
  30427. false
  30428. ],
  30429. "LPL-1.0": [
  30430. "Lucent Public License Version 1.0",
  30431. true,
  30432. false
  30433. ],
  30434. "LPL-1.02": [
  30435. "Lucent Public License v1.02",
  30436. true,
  30437. false
  30438. ],
  30439. "LPPL-1.0": [
  30440. "LaTeX Project Public License v1.0",
  30441. false,
  30442. false
  30443. ],
  30444. "LPPL-1.1": [
  30445. "LaTeX Project Public License v1.1",
  30446. false,
  30447. false
  30448. ],
  30449. "LPPL-1.2": [
  30450. "LaTeX Project Public License v1.2",
  30451. false,
  30452. false
  30453. ],
  30454. "LPPL-1.3a": [
  30455. "LaTeX Project Public License v1.3a",
  30456. false,
  30457. false
  30458. ],
  30459. "LPPL-1.3c": [
  30460. "LaTeX Project Public License v1.3c",
  30461. true,
  30462. false
  30463. ],
  30464. "MakeIndex": [
  30465. "MakeIndex License",
  30466. false,
  30467. false
  30468. ],
  30469. "MirOS": [
  30470. "MirOS License",
  30471. true,
  30472. false
  30473. ],
  30474. "MIT": [
  30475. "MIT License",
  30476. true,
  30477. false
  30478. ],
  30479. "MIT-0": [
  30480. "MIT No Attribution",
  30481. true,
  30482. false
  30483. ],
  30484. "MIT-advertising": [
  30485. "Enlightenment License (e16)",
  30486. false,
  30487. false
  30488. ],
  30489. "MIT-CMU": [
  30490. "CMU License",
  30491. false,
  30492. false
  30493. ],
  30494. "MIT-enna": [
  30495. "enna License",
  30496. false,
  30497. false
  30498. ],
  30499. "MIT-feh": [
  30500. "feh License",
  30501. false,
  30502. false
  30503. ],
  30504. "MITNFA": [
  30505. "MIT +no-false-attribs license",
  30506. false,
  30507. false
  30508. ],
  30509. "Motosoto": [
  30510. "Motosoto License",
  30511. true,
  30512. false
  30513. ],
  30514. "mpich2": [
  30515. "mpich2 License",
  30516. false,
  30517. false
  30518. ],
  30519. "MPL-1.0": [
  30520. "Mozilla Public License 1.0",
  30521. true,
  30522. false
  30523. ],
  30524. "MPL-1.1": [
  30525. "Mozilla Public License 1.1",
  30526. true,
  30527. false
  30528. ],
  30529. "MPL-2.0": [
  30530. "Mozilla Public License 2.0",
  30531. true,
  30532. false
  30533. ],
  30534. "MPL-2.0-no-copyleft-exception": [
  30535. "Mozilla Public License 2.0 (no copyleft exception)",
  30536. true,
  30537. false
  30538. ],
  30539. "MS-PL": [
  30540. "Microsoft Public License",
  30541. true,
  30542. false
  30543. ],
  30544. "MS-RL": [
  30545. "Microsoft Reciprocal License",
  30546. true,
  30547. false
  30548. ],
  30549. "MTLL": [
  30550. "Matrix Template Library License",
  30551. false,
  30552. false
  30553. ],
  30554. "Multics": [
  30555. "Multics License",
  30556. true,
  30557. false
  30558. ],
  30559. "Mup": [
  30560. "Mup License",
  30561. false,
  30562. false
  30563. ],
  30564. "NASA-1.3": [
  30565. "NASA Open Source Agreement 1.3",
  30566. true,
  30567. false
  30568. ],
  30569. "Naumen": [
  30570. "Naumen Public License",
  30571. true,
  30572. false
  30573. ],
  30574. "NBPL-1.0": [
  30575. "Net Boolean Public License v1",
  30576. false,
  30577. false
  30578. ],
  30579. "NCSA": [
  30580. "University of Illinois/NCSA Open Source License",
  30581. true,
  30582. false
  30583. ],
  30584. "Net-SNMP": [
  30585. "Net-SNMP License",
  30586. false,
  30587. false
  30588. ],
  30589. "NetCDF": [
  30590. "NetCDF license",
  30591. false,
  30592. false
  30593. ],
  30594. "Newsletr": [
  30595. "Newsletr License",
  30596. false,
  30597. false
  30598. ],
  30599. "NGPL": [
  30600. "Nethack General Public License",
  30601. true,
  30602. false
  30603. ],
  30604. "NLOD-1.0": [
  30605. "Norwegian Licence for Open Government Data",
  30606. false,
  30607. false
  30608. ],
  30609. "NLPL": [
  30610. "No Limit Public License",
  30611. false,
  30612. false
  30613. ],
  30614. "Nokia": [
  30615. "Nokia Open Source License",
  30616. true,
  30617. false
  30618. ],
  30619. "NOSL": [
  30620. "Netizen Open Source License",
  30621. false,
  30622. false
  30623. ],
  30624. "Noweb": [
  30625. "Noweb License",
  30626. false,
  30627. false
  30628. ],
  30629. "NPL-1.0": [
  30630. "Netscape Public License v1.0",
  30631. false,
  30632. false
  30633. ],
  30634. "NPL-1.1": [
  30635. "Netscape Public License v1.1",
  30636. false,
  30637. false
  30638. ],
  30639. "NPOSL-3.0": [
  30640. "Non-Profit Open Software License 3.0",
  30641. true,
  30642. false
  30643. ],
  30644. "NRL": [
  30645. "NRL License",
  30646. false,
  30647. false
  30648. ],
  30649. "NTP": [
  30650. "NTP License",
  30651. true,
  30652. false
  30653. ],
  30654. "Nunit": [
  30655. "Nunit License",
  30656. false,
  30657. true
  30658. ],
  30659. "OCCT-PL": [
  30660. "Open CASCADE Technology Public License",
  30661. false,
  30662. false
  30663. ],
  30664. "OCLC-2.0": [
  30665. "OCLC Research Public License 2.0",
  30666. true,
  30667. false
  30668. ],
  30669. "ODbL-1.0": [
  30670. "ODC Open Database License v1.0",
  30671. false,
  30672. false
  30673. ],
  30674. "ODC-By-1.0": [
  30675. "Open Data Commons Attribution License v1.0",
  30676. false,
  30677. false
  30678. ],
  30679. "OFL-1.0": [
  30680. "SIL Open Font License 1.0",
  30681. false,
  30682. false
  30683. ],
  30684. "OFL-1.1": [
  30685. "SIL Open Font License 1.1",
  30686. true,
  30687. false
  30688. ],
  30689. "OGL-UK-1.0": [
  30690. "Open Government Licence v1.0",
  30691. false,
  30692. false
  30693. ],
  30694. "OGL-UK-2.0": [
  30695. "Open Government Licence v2.0",
  30696. false,
  30697. false
  30698. ],
  30699. "OGL-UK-3.0": [
  30700. "Open Government Licence v3.0",
  30701. false,
  30702. false
  30703. ],
  30704. "OGTSL": [
  30705. "Open Group Test Suite License",
  30706. true,
  30707. false
  30708. ],
  30709. "OLDAP-1.1": [
  30710. "Open LDAP Public License v1.1",
  30711. false,
  30712. false
  30713. ],
  30714. "OLDAP-1.2": [
  30715. "Open LDAP Public License v1.2",
  30716. false,
  30717. false
  30718. ],
  30719. "OLDAP-1.3": [
  30720. "Open LDAP Public License v1.3",
  30721. false,
  30722. false
  30723. ],
  30724. "OLDAP-1.4": [
  30725. "Open LDAP Public License v1.4",
  30726. false,
  30727. false
  30728. ],
  30729. "OLDAP-2.0": [
  30730. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  30731. false,
  30732. false
  30733. ],
  30734. "OLDAP-2.0.1": [
  30735. "Open LDAP Public License v2.0.1",
  30736. false,
  30737. false
  30738. ],
  30739. "OLDAP-2.1": [
  30740. "Open LDAP Public License v2.1",
  30741. false,
  30742. false
  30743. ],
  30744. "OLDAP-2.2": [
  30745. "Open LDAP Public License v2.2",
  30746. false,
  30747. false
  30748. ],
  30749. "OLDAP-2.2.1": [
  30750. "Open LDAP Public License v2.2.1",
  30751. false,
  30752. false
  30753. ],
  30754. "OLDAP-2.2.2": [
  30755. "Open LDAP Public License 2.2.2",
  30756. false,
  30757. false
  30758. ],
  30759. "OLDAP-2.3": [
  30760. "Open LDAP Public License v2.3",
  30761. false,
  30762. false
  30763. ],
  30764. "OLDAP-2.4": [
  30765. "Open LDAP Public License v2.4",
  30766. false,
  30767. false
  30768. ],
  30769. "OLDAP-2.5": [
  30770. "Open LDAP Public License v2.5",
  30771. false,
  30772. false
  30773. ],
  30774. "OLDAP-2.6": [
  30775. "Open LDAP Public License v2.6",
  30776. false,
  30777. false
  30778. ],
  30779. "OLDAP-2.7": [
  30780. "Open LDAP Public License v2.7",
  30781. false,
  30782. false
  30783. ],
  30784. "OLDAP-2.8": [
  30785. "Open LDAP Public License v2.8",
  30786. false,
  30787. false
  30788. ],
  30789. "OML": [
  30790. "Open Market License",
  30791. false,
  30792. false
  30793. ],
  30794. "OpenSSL": [
  30795. "OpenSSL License",
  30796. false,
  30797. false
  30798. ],
  30799. "OPL-1.0": [
  30800. "Open Public License v1.0",
  30801. false,
  30802. false
  30803. ],
  30804. "OSET-PL-2.1": [
  30805. "OSET Public License version 2.1",
  30806. true,
  30807. false
  30808. ],
  30809. "OSL-1.0": [
  30810. "Open Software License 1.0",
  30811. true,
  30812. false
  30813. ],
  30814. "OSL-1.1": [
  30815. "Open Software License 1.1",
  30816. false,
  30817. false
  30818. ],
  30819. "OSL-2.0": [
  30820. "Open Software License 2.0",
  30821. true,
  30822. false
  30823. ],
  30824. "OSL-2.1": [
  30825. "Open Software License 2.1",
  30826. true,
  30827. false
  30828. ],
  30829. "OSL-3.0": [
  30830. "Open Software License 3.0",
  30831. true,
  30832. false
  30833. ],
  30834. "PDDL-1.0": [
  30835. "ODC Public Domain Dedication & License 1.0",
  30836. false,
  30837. false
  30838. ],
  30839. "PHP-3.0": [
  30840. "PHP License v3.0",
  30841. true,
  30842. false
  30843. ],
  30844. "PHP-3.01": [
  30845. "PHP License v3.01",
  30846. false,
  30847. false
  30848. ],
  30849. "Plexus": [
  30850. "Plexus Classworlds License",
  30851. false,
  30852. false
  30853. ],
  30854. "PostgreSQL": [
  30855. "PostgreSQL License",
  30856. true,
  30857. false
  30858. ],
  30859. "psfrag": [
  30860. "psfrag License",
  30861. false,
  30862. false
  30863. ],
  30864. "psutils": [
  30865. "psutils License",
  30866. false,
  30867. false
  30868. ],
  30869. "Python-2.0": [
  30870. "Python License 2.0",
  30871. true,
  30872. false
  30873. ],
  30874. "Qhull": [
  30875. "Qhull License",
  30876. false,
  30877. false
  30878. ],
  30879. "QPL-1.0": [
  30880. "Q Public License 1.0",
  30881. true,
  30882. false
  30883. ],
  30884. "Rdisc": [
  30885. "Rdisc License",
  30886. false,
  30887. false
  30888. ],
  30889. "RHeCos-1.1": [
  30890. "Red Hat eCos Public License v1.1",
  30891. false,
  30892. false
  30893. ],
  30894. "RPL-1.1": [
  30895. "Reciprocal Public License 1.1",
  30896. true,
  30897. false
  30898. ],
  30899. "RPL-1.5": [
  30900. "Reciprocal Public License 1.5",
  30901. true,
  30902. false
  30903. ],
  30904. "RPSL-1.0": [
  30905. "RealNetworks Public Source License v1.0",
  30906. true,
  30907. false
  30908. ],
  30909. "RSA-MD": [
  30910. "RSA Message-Digest License",
  30911. false,
  30912. false
  30913. ],
  30914. "RSCPL": [
  30915. "Ricoh Source Code Public License",
  30916. true,
  30917. false
  30918. ],
  30919. "Ruby": [
  30920. "Ruby License",
  30921. false,
  30922. false
  30923. ],
  30924. "SAX-PD": [
  30925. "Sax Public Domain Notice",
  30926. false,
  30927. false
  30928. ],
  30929. "Saxpath": [
  30930. "Saxpath License",
  30931. false,
  30932. false
  30933. ],
  30934. "SCEA": [
  30935. "SCEA Shared Source License",
  30936. false,
  30937. false
  30938. ],
  30939. "Sendmail": [
  30940. "Sendmail License",
  30941. false,
  30942. false
  30943. ],
  30944. "Sendmail-8.23": [
  30945. "Sendmail License 8.23",
  30946. false,
  30947. false
  30948. ],
  30949. "SGI-B-1.0": [
  30950. "SGI Free Software License B v1.0",
  30951. false,
  30952. false
  30953. ],
  30954. "SGI-B-1.1": [
  30955. "SGI Free Software License B v1.1",
  30956. false,
  30957. false
  30958. ],
  30959. "SGI-B-2.0": [
  30960. "SGI Free Software License B v2.0",
  30961. false,
  30962. false
  30963. ],
  30964. "SimPL-2.0": [
  30965. "Simple Public License 2.0",
  30966. true,
  30967. false
  30968. ],
  30969. "SISSL": [
  30970. "Sun Industry Standards Source License v1.1",
  30971. true,
  30972. false
  30973. ],
  30974. "SISSL-1.2": [
  30975. "Sun Industry Standards Source License v1.2",
  30976. false,
  30977. false
  30978. ],
  30979. "Sleepycat": [
  30980. "Sleepycat License",
  30981. true,
  30982. false
  30983. ],
  30984. "SMLNJ": [
  30985. "Standard ML of New Jersey License",
  30986. false,
  30987. false
  30988. ],
  30989. "SMPPL": [
  30990. "Secure Messaging Protocol Public License",
  30991. false,
  30992. false
  30993. ],
  30994. "SNIA": [
  30995. "SNIA Public License 1.1",
  30996. false,
  30997. false
  30998. ],
  30999. "Spencer-86": [
  31000. "Spencer License 86",
  31001. false,
  31002. false
  31003. ],
  31004. "Spencer-94": [
  31005. "Spencer License 94",
  31006. false,
  31007. false
  31008. ],
  31009. "Spencer-99": [
  31010. "Spencer License 99",
  31011. false,
  31012. false
  31013. ],
  31014. "SPL-1.0": [
  31015. "Sun Public License v1.0",
  31016. true,
  31017. false
  31018. ],
  31019. "StandardML-NJ": [
  31020. "Standard ML of New Jersey License",
  31021. false,
  31022. true
  31023. ],
  31024. "SugarCRM-1.1.3": [
  31025. "SugarCRM Public License v1.1.3",
  31026. false,
  31027. false
  31028. ],
  31029. "SWL": [
  31030. "Scheme Widget Library (SWL) Software License Agreement",
  31031. false,
  31032. false
  31033. ],
  31034. "TCL": [
  31035. "TCL/TK License",
  31036. false,
  31037. false
  31038. ],
  31039. "TCP-wrappers": [
  31040. "TCP Wrappers License",
  31041. false,
  31042. false
  31043. ],
  31044. "TMate": [
  31045. "TMate Open Source License",
  31046. false,
  31047. false
  31048. ],
  31049. "TORQUE-1.1": [
  31050. "TORQUE v2.5+ Software License v1.1",
  31051. false,
  31052. false
  31053. ],
  31054. "TOSL": [
  31055. "Trusster Open Source License",
  31056. false,
  31057. false
  31058. ],
  31059. "TU-Berlin-1.0": [
  31060. "Technische Universitaet Berlin License 1.0",
  31061. false,
  31062. false
  31063. ],
  31064. "TU-Berlin-2.0": [
  31065. "Technische Universitaet Berlin License 2.0",
  31066. false,
  31067. false
  31068. ],
  31069. "Unicode-DFS-2015": [
  31070. "Unicode License Agreement - Data Files and Software (2015)",
  31071. false,
  31072. false
  31073. ],
  31074. "Unicode-DFS-2016": [
  31075. "Unicode License Agreement - Data Files and Software (2016)",
  31076. false,
  31077. false
  31078. ],
  31079. "Unicode-TOU": [
  31080. "Unicode Terms of Use",
  31081. false,
  31082. false
  31083. ],
  31084. "Unlicense": [
  31085. "The Unlicense",
  31086. false,
  31087. false
  31088. ],
  31089. "UPL-1.0": [
  31090. "Universal Permissive License v1.0",
  31091. true,
  31092. false
  31093. ],
  31094. "Vim": [
  31095. "Vim License",
  31096. false,
  31097. false
  31098. ],
  31099. "VOSTROM": [
  31100. "VOSTROM Public License for Open Source",
  31101. false,
  31102. false
  31103. ],
  31104. "VSL-1.0": [
  31105. "Vovida Software License v1.0",
  31106. true,
  31107. false
  31108. ],
  31109. "W3C": [
  31110. "W3C Software Notice and License (2002-12-31)",
  31111. true,
  31112. false
  31113. ],
  31114. "W3C-19980720": [
  31115. "W3C Software Notice and License (1998-07-20)",
  31116. false,
  31117. false
  31118. ],
  31119. "W3C-20150513": [
  31120. "W3C Software Notice and Document License (2015-05-13)",
  31121. false,
  31122. false
  31123. ],
  31124. "Watcom-1.0": [
  31125. "Sybase Open Watcom Public License 1.0",
  31126. true,
  31127. false
  31128. ],
  31129. "Wsuipa": [
  31130. "Wsuipa License",
  31131. false,
  31132. false
  31133. ],
  31134. "WTFPL": [
  31135. "Do What The F*ck You Want To Public License",
  31136. false,
  31137. false
  31138. ],
  31139. "wxWindows": [
  31140. "wxWindows Library License",
  31141. false,
  31142. true
  31143. ],
  31144. "X11": [
  31145. "X11 License",
  31146. false,
  31147. false
  31148. ],
  31149. "Xerox": [
  31150. "Xerox License",
  31151. false,
  31152. false
  31153. ],
  31154. "XFree86-1.1": [
  31155. "XFree86 License 1.1",
  31156. false,
  31157. false
  31158. ],
  31159. "xinetd": [
  31160. "xinetd License",
  31161. false,
  31162. false
  31163. ],
  31164. "Xnet": [
  31165. "X.Net License",
  31166. true,
  31167. false
  31168. ],
  31169. "xpp": [
  31170. "XPP License",
  31171. false,
  31172. false
  31173. ],
  31174. "XSkat": [
  31175. "XSkat License",
  31176. false,
  31177. false
  31178. ],
  31179. "YPL-1.0": [
  31180. "Yahoo! Public License v1.0",
  31181. false,
  31182. false
  31183. ],
  31184. "YPL-1.1": [
  31185. "Yahoo! Public License v1.1",
  31186. false,
  31187. false
  31188. ],
  31189. "Zed": [
  31190. "Zed License",
  31191. false,
  31192. false
  31193. ],
  31194. "Zend-2.0": [
  31195. "Zend License v2.0",
  31196. false,
  31197. false
  31198. ],
  31199. "Zimbra-1.3": [
  31200. "Zimbra Public License v1.3",
  31201. false,
  31202. false
  31203. ],
  31204. "Zimbra-1.4": [
  31205. "Zimbra Public License v1.4",
  31206. false,
  31207. false
  31208. ],
  31209. "Zlib": [
  31210. "zlib License",
  31211. true,
  31212. false
  31213. ],
  31214. "zlib-acknowledgement": [
  31215. "zlib/libpng License with Acknowledgement",
  31216. false,
  31217. false
  31218. ],
  31219. "ZPL-1.1": [
  31220. "Zope Public License 1.1",
  31221. false,
  31222. false
  31223. ],
  31224. "ZPL-2.0": [
  31225. "Zope Public License 2.0",
  31226. true,
  31227. false
  31228. ],
  31229. "ZPL-2.1": [
  31230. "Zope Public License 2.1",
  31231. false,
  31232. false
  31233. ]
  31234. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  31235. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  31236. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  31237. ����������������� ��`.rdata����� ���
  31238. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  31239. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  31240. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  31241. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  31242. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  31243. <security>
  31244. <requestedPrivileges>
  31245. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  31246. </requestedPrivileges>
  31247. </security>
  31248. </trustInfo>
  31249. <dependency>
  31250. <dependentAssembly>
  31251. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  31252. </dependentAssembly>
  31253. </dependency>
  31254. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  31255. namespace Symfony\Component\Console;
  31256. use Symfony\Component\Console\Command\Command;
  31257. use Symfony\Component\Console\Command\HelpCommand;
  31258. use Symfony\Component\Console\Command\ListCommand;
  31259. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31260. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31261. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  31262. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  31263. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  31264. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31265. use Symfony\Component\Console\Exception\ExceptionInterface;
  31266. use Symfony\Component\Console\Exception\LogicException;
  31267. use Symfony\Component\Console\Formatter\OutputFormatter;
  31268. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  31269. use Symfony\Component\Console\Helper\DialogHelper;
  31270. use Symfony\Component\Console\Helper\FormatterHelper;
  31271. use Symfony\Component\Console\Helper\Helper;
  31272. use Symfony\Component\Console\Helper\HelperSet;
  31273. use Symfony\Component\Console\Helper\ProcessHelper;
  31274. use Symfony\Component\Console\Helper\ProgressHelper;
  31275. use Symfony\Component\Console\Helper\QuestionHelper;
  31276. use Symfony\Component\Console\Helper\TableHelper;
  31277. use Symfony\Component\Console\Input\ArgvInput;
  31278. use Symfony\Component\Console\Input\ArrayInput;
  31279. use Symfony\Component\Console\Input\InputArgument;
  31280. use Symfony\Component\Console\Input\InputAwareInterface;
  31281. use Symfony\Component\Console\Input\InputDefinition;
  31282. use Symfony\Component\Console\Input\InputInterface;
  31283. use Symfony\Component\Console\Input\InputOption;
  31284. use Symfony\Component\Console\Output\BufferedOutput;
  31285. use Symfony\Component\Console\Output\ConsoleOutput;
  31286. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31287. use Symfony\Component\Console\Output\OutputInterface;
  31288. use Symfony\Component\Debug\Exception\FatalThrowableError;
  31289. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  31290. class Application
  31291. {
  31292. private $commands = array();
  31293. private $wantHelps = false;
  31294. private $runningCommand;
  31295. private $name;
  31296. private $version;
  31297. private $catchExceptions = true;
  31298. private $autoExit = true;
  31299. private $definition;
  31300. private $helperSet;
  31301. private $dispatcher;
  31302. private $terminalDimensions;
  31303. private $defaultCommand;
  31304. private $initialized;
  31305. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  31306. {
  31307. $this->name = $name;
  31308. $this->version = $version;
  31309. $this->defaultCommand = 'list';
  31310. }
  31311. public function setDispatcher(EventDispatcherInterface $dispatcher)
  31312. {
  31313. $this->dispatcher = $dispatcher;
  31314. }
  31315. public function run(InputInterface $input = null, OutputInterface $output = null)
  31316. {
  31317. if (null === $input) {
  31318. $input = new ArgvInput();
  31319. }
  31320. if (null === $output) {
  31321. $output = new ConsoleOutput();
  31322. }
  31323. $this->configureIO($input, $output);
  31324. try {
  31325. $e = null;
  31326. $exitCode = $this->doRun($input, $output);
  31327. } catch (\Exception $e) {
  31328. }
  31329. if (null !== $e) {
  31330. if (!$this->catchExceptions) {
  31331. throw $e;
  31332. }
  31333. if ($output instanceof ConsoleOutputInterface) {
  31334. $this->renderException($e, $output->getErrorOutput());
  31335. } else {
  31336. $this->renderException($e, $output);
  31337. }
  31338. $exitCode = $this->getExitCodeForThrowable($e);
  31339. }
  31340. if ($this->autoExit) {
  31341. if ($exitCode > 255) {
  31342. $exitCode = 255;
  31343. }
  31344. exit($exitCode);
  31345. }
  31346. return $exitCode;
  31347. }
  31348. public function doRun(InputInterface $input, OutputInterface $output)
  31349. {
  31350. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  31351. $output->writeln($this->getLongVersion());
  31352. return 0;
  31353. }
  31354. $name = $this->getCommandName($input);
  31355. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  31356. if (!$name) {
  31357. $name = 'help';
  31358. $input = new ArrayInput(array('command' => 'help'));
  31359. } else {
  31360. $this->wantHelps = true;
  31361. }
  31362. }
  31363. if (!$name) {
  31364. $name = $this->defaultCommand;
  31365. $definition = $this->getDefinition();
  31366. $definition->setArguments(array_merge(
  31367. $definition->getArguments(),
  31368. array(
  31369. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  31370. )
  31371. ));
  31372. }
  31373. $this->runningCommand = null;
  31374. $command = $this->find($name);
  31375. $this->runningCommand = $command;
  31376. $exitCode = $this->doRunCommand($command, $input, $output);
  31377. $this->runningCommand = null;
  31378. return $exitCode;
  31379. }
  31380. public function setHelperSet(HelperSet $helperSet)
  31381. {
  31382. $this->helperSet = $helperSet;
  31383. }
  31384. public function getHelperSet()
  31385. {
  31386. if (!$this->helperSet) {
  31387. $this->helperSet = $this->getDefaultHelperSet();
  31388. }
  31389. return $this->helperSet;
  31390. }
  31391. public function setDefinition(InputDefinition $definition)
  31392. {
  31393. $this->definition = $definition;
  31394. }
  31395. public function getDefinition()
  31396. {
  31397. if (!$this->definition) {
  31398. $this->definition = $this->getDefaultInputDefinition();
  31399. }
  31400. return $this->definition;
  31401. }
  31402. public function getHelp()
  31403. {
  31404. return $this->getLongVersion();
  31405. }
  31406. public function setCatchExceptions($boolean)
  31407. {
  31408. $this->catchExceptions = (bool) $boolean;
  31409. }
  31410. public function setAutoExit($boolean)
  31411. {
  31412. $this->autoExit = (bool) $boolean;
  31413. }
  31414. public function getName()
  31415. {
  31416. return $this->name;
  31417. }
  31418. public function setName($name)
  31419. {
  31420. $this->name = $name;
  31421. }
  31422. public function getVersion()
  31423. {
  31424. return $this->version;
  31425. }
  31426. public function setVersion($version)
  31427. {
  31428. $this->version = $version;
  31429. }
  31430. public function getLongVersion()
  31431. {
  31432. if ('UNKNOWN' !== $this->getName()) {
  31433. if ('UNKNOWN' !== $this->getVersion()) {
  31434. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31435. }
  31436. return sprintf('<info>%s</info>', $this->getName());
  31437. }
  31438. return '<info>Console Tool</info>';
  31439. }
  31440. public function register($name)
  31441. {
  31442. return $this->add(new Command($name));
  31443. }
  31444. public function addCommands(array $commands)
  31445. {
  31446. foreach ($commands as $command) {
  31447. $this->add($command);
  31448. }
  31449. }
  31450. public function add(Command $command)
  31451. {
  31452. $this->init();
  31453. $command->setApplication($this);
  31454. if (!$command->isEnabled()) {
  31455. $command->setApplication(null);
  31456. return;
  31457. }
  31458. if (null === $command->getDefinition()) {
  31459. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  31460. }
  31461. $this->commands[$command->getName()] = $command;
  31462. foreach ($command->getAliases() as $alias) {
  31463. $this->commands[$alias] = $command;
  31464. }
  31465. return $command;
  31466. }
  31467. public function get($name)
  31468. {
  31469. $this->init();
  31470. if (!isset($this->commands[$name])) {
  31471. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  31472. }
  31473. $command = $this->commands[$name];
  31474. if ($this->wantHelps) {
  31475. $this->wantHelps = false;
  31476. $helpCommand = $this->get('help');
  31477. $helpCommand->setCommand($command);
  31478. return $helpCommand;
  31479. }
  31480. return $command;
  31481. }
  31482. public function has($name)
  31483. {
  31484. $this->init();
  31485. return isset($this->commands[$name]);
  31486. }
  31487. public function getNamespaces()
  31488. {
  31489. $namespaces = array();
  31490. foreach ($this->all() as $command) {
  31491. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  31492. foreach ($command->getAliases() as $alias) {
  31493. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  31494. }
  31495. }
  31496. return array_values(array_unique(array_filter($namespaces)));
  31497. }
  31498. public function findNamespace($namespace)
  31499. {
  31500. $allNamespaces = $this->getNamespaces();
  31501. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  31502. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  31503. if (empty($namespaces)) {
  31504. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  31505. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  31506. if (1 == \count($alternatives)) {
  31507. $message .= "\n\nDid you mean this?\n ";
  31508. } else {
  31509. $message .= "\n\nDid you mean one of these?\n ";
  31510. }
  31511. $message .= implode("\n ", $alternatives);
  31512. }
  31513. throw new CommandNotFoundException($message, $alternatives);
  31514. }
  31515. $exact = \in_array($namespace, $namespaces, true);
  31516. if (\count($namespaces) > 1 && !$exact) {
  31517. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  31518. }
  31519. return $exact ? $namespace : reset($namespaces);
  31520. }
  31521. public function find($name)
  31522. {
  31523. $this->init();
  31524. $aliases = array();
  31525. $allCommands = array_keys($this->commands);
  31526. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  31527. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  31528. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  31529. if (false !== $pos = strrpos($name, ':')) {
  31530. $this->findNamespace(substr($name, 0, $pos));
  31531. }
  31532. $message = sprintf('Command "%s" is not defined.', $name);
  31533. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  31534. if (1 == \count($alternatives)) {
  31535. $message .= "\n\nDid you mean this?\n ";
  31536. } else {
  31537. $message .= "\n\nDid you mean one of these?\n ";
  31538. }
  31539. $message .= implode("\n ", $alternatives);
  31540. }
  31541. throw new CommandNotFoundException($message, $alternatives);
  31542. }
  31543. if (\count($commands) > 1) {
  31544. $commandList = $this->commands;
  31545. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  31546. $commandName = $commandList[$nameOrAlias]->getName();
  31547. $aliases[$nameOrAlias] = $commandName;
  31548. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  31549. });
  31550. }
  31551. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  31552. if (!$exact && \count($commands) > 1) {
  31553. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  31554. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  31555. }
  31556. return $this->get($exact ? $name : reset($commands));
  31557. }
  31558. public function all($namespace = null)
  31559. {
  31560. $this->init();
  31561. if (null === $namespace) {
  31562. return $this->commands;
  31563. }
  31564. $commands = array();
  31565. foreach ($this->commands as $name => $command) {
  31566. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  31567. $commands[$name] = $command;
  31568. }
  31569. }
  31570. return $commands;
  31571. }
  31572. public static function getAbbreviations($names)
  31573. {
  31574. $abbrevs = array();
  31575. foreach ($names as $name) {
  31576. for ($len = \strlen($name); $len > 0; --$len) {
  31577. $abbrev = substr($name, 0, $len);
  31578. $abbrevs[$abbrev][] = $name;
  31579. }
  31580. }
  31581. return $abbrevs;
  31582. }
  31583. public function asText($namespace = null, $raw = false)
  31584. {
  31585. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31586. $descriptor = new TextDescriptor();
  31587. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  31588. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  31589. return $output->fetch();
  31590. }
  31591. public function asXml($namespace = null, $asDom = false)
  31592. {
  31593. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31594. $descriptor = new XmlDescriptor();
  31595. if ($asDom) {
  31596. return $descriptor->getApplicationDocument($this, $namespace);
  31597. }
  31598. $output = new BufferedOutput();
  31599. $descriptor->describe($output, $this, array('namespace' => $namespace));
  31600. return $output->fetch();
  31601. }
  31602. public function renderException($e, $output)
  31603. {
  31604. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31605. do {
  31606. $title = sprintf(' [%s] ', \get_class($e));
  31607. $len = Helper::strlen($title);
  31608. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  31609. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  31610. $width = 1 << 31;
  31611. }
  31612. $lines = array();
  31613. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  31614. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  31615. $lineLength = Helper::strlen($line) + 4;
  31616. $lines[] = array($line, $lineLength);
  31617. $len = max($lineLength, $len);
  31618. }
  31619. }
  31620. $messages = array();
  31621. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  31622. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  31623. foreach ($lines as $line) {
  31624. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  31625. }
  31626. $messages[] = $emptyLine;
  31627. $messages[] = '';
  31628. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  31629. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  31630. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  31631. $trace = $e->getTrace();
  31632. array_unshift($trace, array(
  31633. 'function' => '',
  31634. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  31635. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  31636. 'args' => array(),
  31637. ));
  31638. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  31639. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  31640. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  31641. $function = $trace[$i]['function'];
  31642. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  31643. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  31644. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  31645. }
  31646. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31647. }
  31648. } while ($e = $e->getPrevious());
  31649. if (null !== $this->runningCommand) {
  31650. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  31651. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31652. }
  31653. }
  31654. protected function getTerminalWidth()
  31655. {
  31656. $dimensions = $this->getTerminalDimensions();
  31657. return $dimensions[0];
  31658. }
  31659. protected function getTerminalHeight()
  31660. {
  31661. $dimensions = $this->getTerminalDimensions();
  31662. return $dimensions[1];
  31663. }
  31664. public function getTerminalDimensions()
  31665. {
  31666. if ($this->terminalDimensions) {
  31667. return $this->terminalDimensions;
  31668. }
  31669. if ('\\' === \DIRECTORY_SEPARATOR) {
  31670. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  31671. return array((int) $matches[1], (int) $matches[2]);
  31672. }
  31673. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  31674. return array((int) $matches[1], (int) $matches[2]);
  31675. }
  31676. }
  31677. if ($sttyString = $this->getSttyColumns()) {
  31678. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  31679. return array((int) $matches[2], (int) $matches[1]);
  31680. }
  31681. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  31682. return array((int) $matches[2], (int) $matches[1]);
  31683. }
  31684. }
  31685. return array(null, null);
  31686. }
  31687. public function setTerminalDimensions($width, $height)
  31688. {
  31689. $this->terminalDimensions = array($width, $height);
  31690. return $this;
  31691. }
  31692. protected function configureIO(InputInterface $input, OutputInterface $output)
  31693. {
  31694. if (true === $input->hasParameterOption(array('--ansi'))) {
  31695. $output->setDecorated(true);
  31696. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  31697. $output->setDecorated(false);
  31698. }
  31699. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  31700. $input->setInteractive(false);
  31701. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  31702. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  31703. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  31704. $input->setInteractive(false);
  31705. }
  31706. }
  31707. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  31708. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  31709. $input->setInteractive(false);
  31710. } else {
  31711. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  31712. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  31713. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  31714. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  31715. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  31716. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  31717. }
  31718. }
  31719. }
  31720. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  31721. {
  31722. foreach ($command->getHelperSet() as $helper) {
  31723. if ($helper instanceof InputAwareInterface) {
  31724. $helper->setInput($input);
  31725. }
  31726. }
  31727. if (null === $this->dispatcher) {
  31728. return $command->run($input, $output);
  31729. }
  31730. try {
  31731. $command->mergeApplicationDefinition();
  31732. $input->bind($command->getDefinition());
  31733. } catch (ExceptionInterface $e) {
  31734. }
  31735. $event = new ConsoleCommandEvent($command, $input, $output);
  31736. $e = null;
  31737. try {
  31738. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  31739. if ($event->commandShouldRun()) {
  31740. $exitCode = $command->run($input, $output);
  31741. } else {
  31742. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  31743. }
  31744. } catch (\Exception $e) {
  31745. } catch (\Throwable $e) {
  31746. }
  31747. if (null !== $e) {
  31748. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  31749. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  31750. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  31751. if ($x !== $event->getException()) {
  31752. $e = $event->getException();
  31753. }
  31754. $exitCode = $this->getExitCodeForThrowable($e);
  31755. }
  31756. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  31757. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  31758. if (null !== $e) {
  31759. throw $e;
  31760. }
  31761. return $event->getExitCode();
  31762. }
  31763. protected function getCommandName(InputInterface $input)
  31764. {
  31765. return $input->getFirstArgument();
  31766. }
  31767. protected function getDefaultInputDefinition()
  31768. {
  31769. return new InputDefinition(array(
  31770. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  31771. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  31772. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  31773. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  31774. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  31775. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  31776. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  31777. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  31778. ));
  31779. }
  31780. protected function getDefaultCommands()
  31781. {
  31782. return array(new HelpCommand(), new ListCommand());
  31783. }
  31784. protected function getDefaultHelperSet()
  31785. {
  31786. return new HelperSet(array(
  31787. new FormatterHelper(),
  31788. new DialogHelper(false),
  31789. new ProgressHelper(false),
  31790. new TableHelper(false),
  31791. new DebugFormatterHelper(),
  31792. new ProcessHelper(),
  31793. new QuestionHelper(),
  31794. ));
  31795. }
  31796. private function getSttyColumns()
  31797. {
  31798. if (!\function_exists('proc_open')) {
  31799. return;
  31800. }
  31801. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31802. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31803. if (\is_resource($process)) {
  31804. $info = stream_get_contents($pipes[1]);
  31805. fclose($pipes[1]);
  31806. fclose($pipes[2]);
  31807. proc_close($process);
  31808. return $info;
  31809. }
  31810. }
  31811. private function getConsoleMode()
  31812. {
  31813. if (!\function_exists('proc_open')) {
  31814. return;
  31815. }
  31816. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31817. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31818. if (\is_resource($process)) {
  31819. $info = stream_get_contents($pipes[1]);
  31820. fclose($pipes[1]);
  31821. fclose($pipes[2]);
  31822. proc_close($process);
  31823. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  31824. return $matches[2].'x'.$matches[1];
  31825. }
  31826. }
  31827. }
  31828. private function getAbbreviationSuggestions($abbrevs)
  31829. {
  31830. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  31831. }
  31832. public function extractNamespace($name, $limit = null)
  31833. {
  31834. $parts = explode(':', $name);
  31835. array_pop($parts);
  31836. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  31837. }
  31838. private function findAlternatives($name, $collection)
  31839. {
  31840. $threshold = 1e3;
  31841. $alternatives = array();
  31842. $collectionParts = array();
  31843. foreach ($collection as $item) {
  31844. $collectionParts[$item] = explode(':', $item);
  31845. }
  31846. foreach (explode(':', $name) as $i => $subname) {
  31847. foreach ($collectionParts as $collectionName => $parts) {
  31848. $exists = isset($alternatives[$collectionName]);
  31849. if (!isset($parts[$i]) && $exists) {
  31850. $alternatives[$collectionName] += $threshold;
  31851. continue;
  31852. } elseif (!isset($parts[$i])) {
  31853. continue;
  31854. }
  31855. $lev = levenshtein($subname, $parts[$i]);
  31856. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  31857. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  31858. } elseif ($exists) {
  31859. $alternatives[$collectionName] += $threshold;
  31860. }
  31861. }
  31862. }
  31863. foreach ($collection as $item) {
  31864. $lev = levenshtein($name, $item);
  31865. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  31866. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  31867. }
  31868. }
  31869. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  31870. asort($alternatives);
  31871. return array_keys($alternatives);
  31872. }
  31873. public function setDefaultCommand($commandName)
  31874. {
  31875. $this->defaultCommand = $commandName;
  31876. }
  31877. private function splitStringByWidth($string, $width)
  31878. {
  31879. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  31880. return str_split($string, $width);
  31881. }
  31882. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  31883. $lines = array();
  31884. $line = '';
  31885. foreach (preg_split('//u', $utf8String) as $char) {
  31886. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  31887. $line .= $char;
  31888. continue;
  31889. }
  31890. $lines[] = str_pad($line, $width);
  31891. $line = $char;
  31892. }
  31893. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  31894. mb_convert_variables($encoding, 'utf8', $lines);
  31895. return $lines;
  31896. }
  31897. private function extractAllNamespaces($name)
  31898. {
  31899. $parts = explode(':', $name, -1);
  31900. $namespaces = array();
  31901. foreach ($parts as $part) {
  31902. if (\count($namespaces)) {
  31903. $namespaces[] = end($namespaces).':'.$part;
  31904. } else {
  31905. $namespaces[] = $part;
  31906. }
  31907. }
  31908. return $namespaces;
  31909. }
  31910. private function init()
  31911. {
  31912. if ($this->initialized) {
  31913. return;
  31914. }
  31915. $this->initialized = true;
  31916. foreach ($this->getDefaultCommands() as $command) {
  31917. $this->add($command);
  31918. }
  31919. }
  31920. private function getExitCodeForThrowable($throwable)
  31921. {
  31922. $exitCode = $throwable->getCode();
  31923. if (is_numeric($exitCode)) {
  31924. $exitCode = (int) $exitCode;
  31925. if (0 === $exitCode) {
  31926. $exitCode = 1;
  31927. }
  31928. } else {
  31929. $exitCode = 1;
  31930. }
  31931. return $exitCode;
  31932. }
  31933. }
  31934. <?php
  31935. namespace Symfony\Component\Console\Command;
  31936. use Symfony\Component\Console\Application;
  31937. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31938. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31939. use Symfony\Component\Console\Exception\ExceptionInterface;
  31940. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31941. use Symfony\Component\Console\Exception\LogicException;
  31942. use Symfony\Component\Console\Helper\HelperSet;
  31943. use Symfony\Component\Console\Input\InputArgument;
  31944. use Symfony\Component\Console\Input\InputDefinition;
  31945. use Symfony\Component\Console\Input\InputInterface;
  31946. use Symfony\Component\Console\Input\InputOption;
  31947. use Symfony\Component\Console\Output\BufferedOutput;
  31948. use Symfony\Component\Console\Output\OutputInterface;
  31949. class Command
  31950. {
  31951. private $application;
  31952. private $name;
  31953. private $processTitle;
  31954. private $aliases = array();
  31955. private $definition;
  31956. private $help;
  31957. private $description;
  31958. private $ignoreValidationErrors = false;
  31959. private $applicationDefinitionMerged = false;
  31960. private $applicationDefinitionMergedWithArgs = false;
  31961. private $code;
  31962. private $synopsis = array();
  31963. private $usages = array();
  31964. private $helperSet;
  31965. public function __construct($name = null)
  31966. {
  31967. $this->definition = new InputDefinition();
  31968. if (null !== $name) {
  31969. $this->setName($name);
  31970. }
  31971. $this->configure();
  31972. if (!$this->name) {
  31973. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  31974. }
  31975. }
  31976. public function ignoreValidationErrors()
  31977. {
  31978. $this->ignoreValidationErrors = true;
  31979. }
  31980. public function setApplication(Application $application = null)
  31981. {
  31982. $this->application = $application;
  31983. if ($application) {
  31984. $this->setHelperSet($application->getHelperSet());
  31985. } else {
  31986. $this->helperSet = null;
  31987. }
  31988. }
  31989. public function setHelperSet(HelperSet $helperSet)
  31990. {
  31991. $this->helperSet = $helperSet;
  31992. }
  31993. public function getHelperSet()
  31994. {
  31995. return $this->helperSet;
  31996. }
  31997. public function getApplication()
  31998. {
  31999. return $this->application;
  32000. }
  32001. public function isEnabled()
  32002. {
  32003. return true;
  32004. }
  32005. protected function configure()
  32006. {
  32007. }
  32008. protected function execute(InputInterface $input, OutputInterface $output)
  32009. {
  32010. throw new LogicException('You must override the execute() method in the concrete command class.');
  32011. }
  32012. protected function interact(InputInterface $input, OutputInterface $output)
  32013. {
  32014. }
  32015. protected function initialize(InputInterface $input, OutputInterface $output)
  32016. {
  32017. }
  32018. public function run(InputInterface $input, OutputInterface $output)
  32019. {
  32020. $this->getSynopsis(true);
  32021. $this->getSynopsis(false);
  32022. $this->mergeApplicationDefinition();
  32023. try {
  32024. $input->bind($this->definition);
  32025. } catch (ExceptionInterface $e) {
  32026. if (!$this->ignoreValidationErrors) {
  32027. throw $e;
  32028. }
  32029. }
  32030. $this->initialize($input, $output);
  32031. if (null !== $this->processTitle) {
  32032. if (\function_exists('cli_set_process_title')) {
  32033. if (!@cli_set_process_title($this->processTitle)) {
  32034. if ('Darwin' === PHP_OS) {
  32035. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  32036. } else {
  32037. cli_set_process_title($this->processTitle);
  32038. }
  32039. }
  32040. } elseif (\function_exists('setproctitle')) {
  32041. setproctitle($this->processTitle);
  32042. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  32043. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  32044. }
  32045. }
  32046. if ($input->isInteractive()) {
  32047. $this->interact($input, $output);
  32048. }
  32049. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  32050. $input->setArgument('command', $this->getName());
  32051. }
  32052. $input->validate();
  32053. if ($this->code) {
  32054. $statusCode = \call_user_func($this->code, $input, $output);
  32055. } else {
  32056. $statusCode = $this->execute($input, $output);
  32057. }
  32058. return is_numeric($statusCode) ? (int) $statusCode : 0;
  32059. }
  32060. public function setCode($code)
  32061. {
  32062. if (!\is_callable($code)) {
  32063. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  32064. }
  32065. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  32066. $r = new \ReflectionFunction($code);
  32067. if (null === $r->getClosureThis()) {
  32068. if (\PHP_VERSION_ID < 70000) {
  32069. $code = @\Closure::bind($code, $this);
  32070. } else {
  32071. $code = \Closure::bind($code, $this);
  32072. }
  32073. }
  32074. }
  32075. $this->code = $code;
  32076. return $this;
  32077. }
  32078. public function mergeApplicationDefinition($mergeArgs = true)
  32079. {
  32080. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  32081. return;
  32082. }
  32083. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  32084. $this->applicationDefinitionMerged = true;
  32085. if ($mergeArgs) {
  32086. $currentArguments = $this->definition->getArguments();
  32087. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  32088. $this->definition->addArguments($currentArguments);
  32089. $this->applicationDefinitionMergedWithArgs = true;
  32090. }
  32091. }
  32092. public function setDefinition($definition)
  32093. {
  32094. if ($definition instanceof InputDefinition) {
  32095. $this->definition = $definition;
  32096. } else {
  32097. $this->definition->setDefinition($definition);
  32098. }
  32099. $this->applicationDefinitionMerged = false;
  32100. return $this;
  32101. }
  32102. public function getDefinition()
  32103. {
  32104. return $this->definition;
  32105. }
  32106. public function getNativeDefinition()
  32107. {
  32108. return $this->getDefinition();
  32109. }
  32110. public function addArgument($name, $mode = null, $description = '', $default = null)
  32111. {
  32112. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  32113. return $this;
  32114. }
  32115. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32116. {
  32117. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  32118. return $this;
  32119. }
  32120. public function setName($name)
  32121. {
  32122. $this->validateName($name);
  32123. $this->name = $name;
  32124. return $this;
  32125. }
  32126. public function setProcessTitle($title)
  32127. {
  32128. $this->processTitle = $title;
  32129. return $this;
  32130. }
  32131. public function getName()
  32132. {
  32133. return $this->name;
  32134. }
  32135. public function setDescription($description)
  32136. {
  32137. $this->description = $description;
  32138. return $this;
  32139. }
  32140. public function getDescription()
  32141. {
  32142. return $this->description;
  32143. }
  32144. public function setHelp($help)
  32145. {
  32146. $this->help = $help;
  32147. return $this;
  32148. }
  32149. public function getHelp()
  32150. {
  32151. return $this->help;
  32152. }
  32153. public function getProcessedHelp()
  32154. {
  32155. $name = $this->name;
  32156. $placeholders = array(
  32157. '%command.name%',
  32158. '%command.full_name%',
  32159. );
  32160. $replacements = array(
  32161. $name,
  32162. $_SERVER['PHP_SELF'].' '.$name,
  32163. );
  32164. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  32165. }
  32166. public function setAliases($aliases)
  32167. {
  32168. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  32169. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  32170. }
  32171. foreach ($aliases as $alias) {
  32172. $this->validateName($alias);
  32173. }
  32174. $this->aliases = $aliases;
  32175. return $this;
  32176. }
  32177. public function getAliases()
  32178. {
  32179. return $this->aliases;
  32180. }
  32181. public function getSynopsis($short = false)
  32182. {
  32183. $key = $short ? 'short' : 'long';
  32184. if (!isset($this->synopsis[$key])) {
  32185. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  32186. }
  32187. return $this->synopsis[$key];
  32188. }
  32189. public function addUsage($usage)
  32190. {
  32191. if (0 !== strpos($usage, $this->name)) {
  32192. $usage = sprintf('%s %s', $this->name, $usage);
  32193. }
  32194. $this->usages[] = $usage;
  32195. return $this;
  32196. }
  32197. public function getUsages()
  32198. {
  32199. return $this->usages;
  32200. }
  32201. public function getHelper($name)
  32202. {
  32203. if (null === $this->helperSet) {
  32204. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  32205. }
  32206. return $this->helperSet->get($name);
  32207. }
  32208. public function asText()
  32209. {
  32210. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32211. $descriptor = new TextDescriptor();
  32212. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32213. $descriptor->describe($output, $this, array('raw_output' => true));
  32214. return $output->fetch();
  32215. }
  32216. public function asXml($asDom = false)
  32217. {
  32218. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32219. $descriptor = new XmlDescriptor();
  32220. if ($asDom) {
  32221. return $descriptor->getCommandDocument($this);
  32222. }
  32223. $output = new BufferedOutput();
  32224. $descriptor->describe($output, $this);
  32225. return $output->fetch();
  32226. }
  32227. private function validateName($name)
  32228. {
  32229. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  32230. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  32231. }
  32232. }
  32233. }
  32234. <?php
  32235. namespace Symfony\Component\Console\Command;
  32236. use Symfony\Component\Console\Helper\DescriptorHelper;
  32237. use Symfony\Component\Console\Input\InputArgument;
  32238. use Symfony\Component\Console\Input\InputInterface;
  32239. use Symfony\Component\Console\Input\InputOption;
  32240. use Symfony\Component\Console\Output\OutputInterface;
  32241. class HelpCommand extends Command
  32242. {
  32243. private $command;
  32244. protected function configure()
  32245. {
  32246. $this->ignoreValidationErrors();
  32247. $this
  32248. ->setName('help')
  32249. ->setDefinition(array(
  32250. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  32251. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  32252. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32253. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  32254. ))
  32255. ->setDescription('Displays help for a command')
  32256. ->setHelp(<<<'EOF'
  32257. The <info>%command.name%</info> command displays help for a given command:
  32258. <info>php %command.full_name% list</info>
  32259. You can also output the help in other formats by using the <comment>--format</comment> option:
  32260. <info>php %command.full_name% --format=xml list</info>
  32261. To display the list of available commands, please use the <info>list</info> command.
  32262. EOF
  32263. )
  32264. ;
  32265. }
  32266. public function setCommand(Command $command)
  32267. {
  32268. $this->command = $command;
  32269. }
  32270. protected function execute(InputInterface $input, OutputInterface $output)
  32271. {
  32272. if (null === $this->command) {
  32273. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  32274. }
  32275. if ($input->getOption('xml')) {
  32276. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  32277. $input->setOption('format', 'xml');
  32278. }
  32279. $helper = new DescriptorHelper();
  32280. $helper->describe($output, $this->command, array(
  32281. 'format' => $input->getOption('format'),
  32282. 'raw_text' => $input->getOption('raw'),
  32283. ));
  32284. $this->command = null;
  32285. }
  32286. }
  32287. <?php
  32288. namespace Symfony\Component\Console\Command;
  32289. use Symfony\Component\Console\Helper\DescriptorHelper;
  32290. use Symfony\Component\Console\Input\InputArgument;
  32291. use Symfony\Component\Console\Input\InputDefinition;
  32292. use Symfony\Component\Console\Input\InputInterface;
  32293. use Symfony\Component\Console\Input\InputOption;
  32294. use Symfony\Component\Console\Output\OutputInterface;
  32295. class ListCommand extends Command
  32296. {
  32297. protected function configure()
  32298. {
  32299. $this
  32300. ->setName('list')
  32301. ->setDefinition($this->createDefinition())
  32302. ->setDescription('Lists commands')
  32303. ->setHelp(<<<'EOF'
  32304. The <info>%command.name%</info> command lists all commands:
  32305. <info>php %command.full_name%</info>
  32306. You can also display the commands for a specific namespace:
  32307. <info>php %command.full_name% test</info>
  32308. You can also output the information in other formats by using the <comment>--format</comment> option:
  32309. <info>php %command.full_name% --format=xml</info>
  32310. It's also possible to get raw list of commands (useful for embedding command runner):
  32311. <info>php %command.full_name% --raw</info>
  32312. EOF
  32313. )
  32314. ;
  32315. }
  32316. public function getNativeDefinition()
  32317. {
  32318. return $this->createDefinition();
  32319. }
  32320. protected function execute(InputInterface $input, OutputInterface $output)
  32321. {
  32322. if ($input->getOption('xml')) {
  32323. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  32324. $input->setOption('format', 'xml');
  32325. }
  32326. $helper = new DescriptorHelper();
  32327. $helper->describe($output, $this->getApplication(), array(
  32328. 'format' => $input->getOption('format'),
  32329. 'raw_text' => $input->getOption('raw'),
  32330. 'namespace' => $input->getArgument('namespace'),
  32331. ));
  32332. }
  32333. private function createDefinition()
  32334. {
  32335. return new InputDefinition(array(
  32336. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  32337. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  32338. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  32339. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32340. ));
  32341. }
  32342. }
  32343. <?php
  32344. namespace Symfony\Component\Console;
  32345. final class ConsoleEvents
  32346. {
  32347. const COMMAND = 'console.command';
  32348. const TERMINATE = 'console.terminate';
  32349. const EXCEPTION = 'console.exception';
  32350. }
  32351. <?php
  32352. namespace Symfony\Component\Console\Descriptor;
  32353. use Symfony\Component\Console\Application;
  32354. use Symfony\Component\Console\Command\Command;
  32355. use Symfony\Component\Console\Exception\CommandNotFoundException;
  32356. class ApplicationDescription
  32357. {
  32358. const GLOBAL_NAMESPACE = '_global';
  32359. private $application;
  32360. private $namespace;
  32361. private $namespaces;
  32362. private $commands;
  32363. private $aliases;
  32364. public function __construct(Application $application, $namespace = null)
  32365. {
  32366. $this->application = $application;
  32367. $this->namespace = $namespace;
  32368. }
  32369. public function getNamespaces()
  32370. {
  32371. if (null === $this->namespaces) {
  32372. $this->inspectApplication();
  32373. }
  32374. return $this->namespaces;
  32375. }
  32376. public function getCommands()
  32377. {
  32378. if (null === $this->commands) {
  32379. $this->inspectApplication();
  32380. }
  32381. return $this->commands;
  32382. }
  32383. public function getCommand($name)
  32384. {
  32385. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  32386. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  32387. }
  32388. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  32389. }
  32390. private function inspectApplication()
  32391. {
  32392. $this->commands = array();
  32393. $this->namespaces = array();
  32394. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  32395. foreach ($this->sortCommands($all) as $namespace => $commands) {
  32396. $names = array();
  32397. foreach ($commands as $name => $command) {
  32398. if (!$command->getName()) {
  32399. continue;
  32400. }
  32401. if ($command->getName() === $name) {
  32402. $this->commands[$name] = $command;
  32403. } else {
  32404. $this->aliases[$name] = $command;
  32405. }
  32406. $names[] = $name;
  32407. }
  32408. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  32409. }
  32410. }
  32411. private function sortCommands(array $commands)
  32412. {
  32413. $namespacedCommands = array();
  32414. $globalCommands = array();
  32415. foreach ($commands as $name => $command) {
  32416. $key = $this->application->extractNamespace($name, 1);
  32417. if (!$key) {
  32418. $globalCommands['_global'][$name] = $command;
  32419. } else {
  32420. $namespacedCommands[$key][$name] = $command;
  32421. }
  32422. }
  32423. ksort($namespacedCommands);
  32424. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  32425. foreach ($namespacedCommands as &$commandsSet) {
  32426. ksort($commandsSet);
  32427. }
  32428. unset($commandsSet);
  32429. return $namespacedCommands;
  32430. }
  32431. }
  32432. <?php
  32433. namespace Symfony\Component\Console\Descriptor;
  32434. use Symfony\Component\Console\Application;
  32435. use Symfony\Component\Console\Command\Command;
  32436. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32437. use Symfony\Component\Console\Input\InputArgument;
  32438. use Symfony\Component\Console\Input\InputDefinition;
  32439. use Symfony\Component\Console\Input\InputOption;
  32440. use Symfony\Component\Console\Output\OutputInterface;
  32441. abstract class Descriptor implements DescriptorInterface
  32442. {
  32443. private $output;
  32444. public function describe(OutputInterface $output, $object, array $options = array())
  32445. {
  32446. $this->output = $output;
  32447. switch (true) {
  32448. case $object instanceof InputArgument:
  32449. $this->describeInputArgument($object, $options);
  32450. break;
  32451. case $object instanceof InputOption:
  32452. $this->describeInputOption($object, $options);
  32453. break;
  32454. case $object instanceof InputDefinition:
  32455. $this->describeInputDefinition($object, $options);
  32456. break;
  32457. case $object instanceof Command:
  32458. $this->describeCommand($object, $options);
  32459. break;
  32460. case $object instanceof Application:
  32461. $this->describeApplication($object, $options);
  32462. break;
  32463. default:
  32464. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  32465. }
  32466. }
  32467. protected function write($content, $decorated = false)
  32468. {
  32469. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  32470. }
  32471. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  32472. abstract protected function describeInputOption(InputOption $option, array $options = array());
  32473. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  32474. abstract protected function describeCommand(Command $command, array $options = array());
  32475. abstract protected function describeApplication(Application $application, array $options = array());
  32476. }
  32477. <?php
  32478. namespace Symfony\Component\Console\Descriptor;
  32479. use Symfony\Component\Console\Output\OutputInterface;
  32480. interface DescriptorInterface
  32481. {
  32482. public function describe(OutputInterface $output, $object, array $options = array());
  32483. }
  32484. <?php
  32485. namespace Symfony\Component\Console\Descriptor;
  32486. use Symfony\Component\Console\Application;
  32487. use Symfony\Component\Console\Command\Command;
  32488. use Symfony\Component\Console\Input\InputArgument;
  32489. use Symfony\Component\Console\Input\InputDefinition;
  32490. use Symfony\Component\Console\Input\InputOption;
  32491. class JsonDescriptor extends Descriptor
  32492. {
  32493. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32494. {
  32495. $this->writeData($this->getInputArgumentData($argument), $options);
  32496. }
  32497. protected function describeInputOption(InputOption $option, array $options = array())
  32498. {
  32499. $this->writeData($this->getInputOptionData($option), $options);
  32500. }
  32501. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32502. {
  32503. $this->writeData($this->getInputDefinitionData($definition), $options);
  32504. }
  32505. protected function describeCommand(Command $command, array $options = array())
  32506. {
  32507. $this->writeData($this->getCommandData($command), $options);
  32508. }
  32509. protected function describeApplication(Application $application, array $options = array())
  32510. {
  32511. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32512. $description = new ApplicationDescription($application, $describedNamespace);
  32513. $commands = array();
  32514. foreach ($description->getCommands() as $command) {
  32515. $commands[] = $this->getCommandData($command);
  32516. }
  32517. $data = $describedNamespace
  32518. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  32519. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  32520. $this->writeData($data, $options);
  32521. }
  32522. private function writeData(array $data, array $options)
  32523. {
  32524. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  32525. }
  32526. private function getInputArgumentData(InputArgument $argument)
  32527. {
  32528. return array(
  32529. 'name' => $argument->getName(),
  32530. 'is_required' => $argument->isRequired(),
  32531. 'is_array' => $argument->isArray(),
  32532. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  32533. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  32534. );
  32535. }
  32536. private function getInputOptionData(InputOption $option)
  32537. {
  32538. return array(
  32539. 'name' => '--'.$option->getName(),
  32540. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  32541. 'accept_value' => $option->acceptValue(),
  32542. 'is_value_required' => $option->isValueRequired(),
  32543. 'is_multiple' => $option->isArray(),
  32544. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  32545. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  32546. );
  32547. }
  32548. private function getInputDefinitionData(InputDefinition $definition)
  32549. {
  32550. $inputArguments = array();
  32551. foreach ($definition->getArguments() as $name => $argument) {
  32552. $inputArguments[$name] = $this->getInputArgumentData($argument);
  32553. }
  32554. $inputOptions = array();
  32555. foreach ($definition->getOptions() as $name => $option) {
  32556. $inputOptions[$name] = $this->getInputOptionData($option);
  32557. }
  32558. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  32559. }
  32560. private function getCommandData(Command $command)
  32561. {
  32562. $command->getSynopsis();
  32563. $command->mergeApplicationDefinition(false);
  32564. return array(
  32565. 'name' => $command->getName(),
  32566. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  32567. 'description' => $command->getDescription(),
  32568. 'help' => $command->getProcessedHelp(),
  32569. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  32570. );
  32571. }
  32572. }
  32573. <?php
  32574. namespace Symfony\Component\Console\Descriptor;
  32575. use Symfony\Component\Console\Application;
  32576. use Symfony\Component\Console\Command\Command;
  32577. use Symfony\Component\Console\Helper\Helper;
  32578. use Symfony\Component\Console\Input\InputArgument;
  32579. use Symfony\Component\Console\Input\InputDefinition;
  32580. use Symfony\Component\Console\Input\InputOption;
  32581. class MarkdownDescriptor extends Descriptor
  32582. {
  32583. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32584. {
  32585. $this->write(
  32586. '**'.$argument->getName().':**'."\n\n"
  32587. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  32588. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  32589. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  32590. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  32591. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  32592. );
  32593. }
  32594. protected function describeInputOption(InputOption $option, array $options = array())
  32595. {
  32596. $this->write(
  32597. '**'.$option->getName().':**'."\n\n"
  32598. .'* Name: `--'.$option->getName().'`'."\n"
  32599. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  32600. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  32601. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  32602. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  32603. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  32604. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  32605. );
  32606. }
  32607. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32608. {
  32609. if ($showArguments = \count($definition->getArguments()) > 0) {
  32610. $this->write('### Arguments:');
  32611. foreach ($definition->getArguments() as $argument) {
  32612. $this->write("\n\n");
  32613. $this->write($this->describeInputArgument($argument));
  32614. }
  32615. }
  32616. if (\count($definition->getOptions()) > 0) {
  32617. if ($showArguments) {
  32618. $this->write("\n\n");
  32619. }
  32620. $this->write('### Options:');
  32621. foreach ($definition->getOptions() as $option) {
  32622. $this->write("\n\n");
  32623. $this->write($this->describeInputOption($option));
  32624. }
  32625. }
  32626. }
  32627. protected function describeCommand(Command $command, array $options = array())
  32628. {
  32629. $command->getSynopsis();
  32630. $command->mergeApplicationDefinition(false);
  32631. $this->write(
  32632. $command->getName()."\n"
  32633. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  32634. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  32635. .'* Usage:'."\n\n"
  32636. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  32637. return $carry.' * `'.$usage.'`'."\n";
  32638. })
  32639. );
  32640. if ($help = $command->getProcessedHelp()) {
  32641. $this->write("\n");
  32642. $this->write($help);
  32643. }
  32644. if ($command->getNativeDefinition()) {
  32645. $this->write("\n\n");
  32646. $this->describeInputDefinition($command->getNativeDefinition());
  32647. }
  32648. }
  32649. protected function describeApplication(Application $application, array $options = array())
  32650. {
  32651. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32652. $description = new ApplicationDescription($application, $describedNamespace);
  32653. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  32654. foreach ($description->getNamespaces() as $namespace) {
  32655. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32656. $this->write("\n\n");
  32657. $this->write('**'.$namespace['id'].':**');
  32658. }
  32659. $this->write("\n\n");
  32660. $this->write(implode("\n", array_map(function ($commandName) {
  32661. return '* '.$commandName;
  32662. }, $namespace['commands'])));
  32663. }
  32664. foreach ($description->getCommands() as $command) {
  32665. $this->write("\n\n");
  32666. $this->write($this->describeCommand($command));
  32667. }
  32668. }
  32669. }
  32670. <?php
  32671. namespace Symfony\Component\Console\Descriptor;
  32672. use Symfony\Component\Console\Application;
  32673. use Symfony\Component\Console\Command\Command;
  32674. use Symfony\Component\Console\Formatter\OutputFormatter;
  32675. use Symfony\Component\Console\Helper\Helper;
  32676. use Symfony\Component\Console\Input\InputArgument;
  32677. use Symfony\Component\Console\Input\InputDefinition;
  32678. use Symfony\Component\Console\Input\InputOption;
  32679. class TextDescriptor extends Descriptor
  32680. {
  32681. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32682. {
  32683. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  32684. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  32685. } else {
  32686. $default = '';
  32687. }
  32688. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  32689. $spacingWidth = $totalWidth - \strlen($argument->getName());
  32690. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  32691. $argument->getName(),
  32692. str_repeat(' ', $spacingWidth),
  32693. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  32694. $default
  32695. ), $options);
  32696. }
  32697. protected function describeInputOption(InputOption $option, array $options = array())
  32698. {
  32699. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  32700. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  32701. } else {
  32702. $default = '';
  32703. }
  32704. $value = '';
  32705. if ($option->acceptValue()) {
  32706. $value = '='.strtoupper($option->getName());
  32707. if ($option->isValueOptional()) {
  32708. $value = '['.$value.']';
  32709. }
  32710. }
  32711. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  32712. $synopsis = sprintf('%s%s',
  32713. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  32714. sprintf('--%s%s', $option->getName(), $value)
  32715. );
  32716. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  32717. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  32718. $synopsis,
  32719. str_repeat(' ', $spacingWidth),
  32720. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  32721. $default,
  32722. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  32723. ), $options);
  32724. }
  32725. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32726. {
  32727. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  32728. foreach ($definition->getArguments() as $argument) {
  32729. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  32730. }
  32731. if ($definition->getArguments()) {
  32732. $this->writeText('<comment>Arguments:</comment>', $options);
  32733. $this->writeText("\n");
  32734. foreach ($definition->getArguments() as $argument) {
  32735. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  32736. $this->writeText("\n");
  32737. }
  32738. }
  32739. if ($definition->getArguments() && $definition->getOptions()) {
  32740. $this->writeText("\n");
  32741. }
  32742. if ($definition->getOptions()) {
  32743. $laterOptions = array();
  32744. $this->writeText('<comment>Options:</comment>', $options);
  32745. foreach ($definition->getOptions() as $option) {
  32746. if (\strlen($option->getShortcut()) > 1) {
  32747. $laterOptions[] = $option;
  32748. continue;
  32749. }
  32750. $this->writeText("\n");
  32751. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32752. }
  32753. foreach ($laterOptions as $option) {
  32754. $this->writeText("\n");
  32755. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32756. }
  32757. }
  32758. }
  32759. protected function describeCommand(Command $command, array $options = array())
  32760. {
  32761. $command->getSynopsis(true);
  32762. $command->getSynopsis(false);
  32763. $command->mergeApplicationDefinition(false);
  32764. $this->writeText('<comment>Usage:</comment>', $options);
  32765. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  32766. $this->writeText("\n");
  32767. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  32768. }
  32769. $this->writeText("\n");
  32770. $definition = $command->getNativeDefinition();
  32771. if ($definition->getOptions() || $definition->getArguments()) {
  32772. $this->writeText("\n");
  32773. $this->describeInputDefinition($definition, $options);
  32774. $this->writeText("\n");
  32775. }
  32776. if ($help = $command->getProcessedHelp()) {
  32777. $this->writeText("\n");
  32778. $this->writeText('<comment>Help:</comment>', $options);
  32779. $this->writeText("\n");
  32780. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  32781. $this->writeText("\n");
  32782. }
  32783. }
  32784. protected function describeApplication(Application $application, array $options = array())
  32785. {
  32786. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32787. $description = new ApplicationDescription($application, $describedNamespace);
  32788. if (isset($options['raw_text']) && $options['raw_text']) {
  32789. $width = $this->getColumnWidth($description->getCommands());
  32790. foreach ($description->getCommands() as $command) {
  32791. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  32792. $this->writeText("\n");
  32793. }
  32794. } else {
  32795. if ('' != $help = $application->getHelp()) {
  32796. $this->writeText("$help\n\n", $options);
  32797. }
  32798. $this->writeText("<comment>Usage:</comment>\n", $options);
  32799. $this->writeText(" command [options] [arguments]\n\n", $options);
  32800. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  32801. $this->writeText("\n");
  32802. $this->writeText("\n");
  32803. $width = $this->getColumnWidth($description->getCommands());
  32804. if ($describedNamespace) {
  32805. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  32806. } else {
  32807. $this->writeText('<comment>Available commands:</comment>', $options);
  32808. }
  32809. foreach ($description->getNamespaces() as $namespace) {
  32810. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32811. $this->writeText("\n");
  32812. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  32813. }
  32814. foreach ($namespace['commands'] as $name) {
  32815. $this->writeText("\n");
  32816. $spacingWidth = $width - Helper::strlen($name);
  32817. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  32818. }
  32819. }
  32820. $this->writeText("\n");
  32821. }
  32822. }
  32823. private function writeText($content, array $options = array())
  32824. {
  32825. $this->write(
  32826. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  32827. isset($options['raw_output']) ? !$options['raw_output'] : true
  32828. );
  32829. }
  32830. private function formatDefaultValue($default)
  32831. {
  32832. if (INF === $default) {
  32833. return 'INF';
  32834. }
  32835. if (\is_string($default)) {
  32836. $default = OutputFormatter::escape($default);
  32837. } elseif (\is_array($default)) {
  32838. foreach ($default as $key => $value) {
  32839. if (\is_string($value)) {
  32840. $default[$key] = OutputFormatter::escape($value);
  32841. }
  32842. }
  32843. }
  32844. if (\PHP_VERSION_ID < 50400) {
  32845. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  32846. }
  32847. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  32848. }
  32849. private function getColumnWidth(array $commands)
  32850. {
  32851. $widths = array();
  32852. foreach ($commands as $command) {
  32853. $widths[] = Helper::strlen($command->getName());
  32854. foreach ($command->getAliases() as $alias) {
  32855. $widths[] = Helper::strlen($alias);
  32856. }
  32857. }
  32858. return max($widths) + 2;
  32859. }
  32860. private function calculateTotalWidthForOptions(array $options)
  32861. {
  32862. $totalWidth = 0;
  32863. foreach ($options as $option) {
  32864. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  32865. if ($option->acceptValue()) {
  32866. $valueLength = 1 + Helper::strlen($option->getName());
  32867. $valueLength += $option->isValueOptional() ? 2 : 0;
  32868. $nameLength += $valueLength;
  32869. }
  32870. $totalWidth = max($totalWidth, $nameLength);
  32871. }
  32872. return $totalWidth;
  32873. }
  32874. }
  32875. <?php
  32876. namespace Symfony\Component\Console\Descriptor;
  32877. use Symfony\Component\Console\Application;
  32878. use Symfony\Component\Console\Command\Command;
  32879. use Symfony\Component\Console\Input\InputArgument;
  32880. use Symfony\Component\Console\Input\InputDefinition;
  32881. use Symfony\Component\Console\Input\InputOption;
  32882. class XmlDescriptor extends Descriptor
  32883. {
  32884. public function getInputDefinitionDocument(InputDefinition $definition)
  32885. {
  32886. $dom = new \DOMDocument('1.0', 'UTF-8');
  32887. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  32888. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  32889. foreach ($definition->getArguments() as $argument) {
  32890. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  32891. }
  32892. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  32893. foreach ($definition->getOptions() as $option) {
  32894. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  32895. }
  32896. return $dom;
  32897. }
  32898. public function getCommandDocument(Command $command)
  32899. {
  32900. $dom = new \DOMDocument('1.0', 'UTF-8');
  32901. $dom->appendChild($commandXML = $dom->createElement('command'));
  32902. $command->getSynopsis();
  32903. $command->mergeApplicationDefinition(false);
  32904. $commandXML->setAttribute('id', $command->getName());
  32905. $commandXML->setAttribute('name', $command->getName());
  32906. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  32907. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  32908. $usagesXML->appendChild($dom->createElement('usage', $usage));
  32909. }
  32910. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  32911. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  32912. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  32913. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  32914. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  32915. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  32916. return $dom;
  32917. }
  32918. public function getApplicationDocument(Application $application, $namespace = null)
  32919. {
  32920. $dom = new \DOMDocument('1.0', 'UTF-8');
  32921. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  32922. if ('UNKNOWN' !== $application->getName()) {
  32923. $rootXml->setAttribute('name', $application->getName());
  32924. if ('UNKNOWN' !== $application->getVersion()) {
  32925. $rootXml->setAttribute('version', $application->getVersion());
  32926. }
  32927. }
  32928. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  32929. $description = new ApplicationDescription($application, $namespace);
  32930. if ($namespace) {
  32931. $commandsXML->setAttribute('namespace', $namespace);
  32932. }
  32933. foreach ($description->getCommands() as $command) {
  32934. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  32935. }
  32936. if (!$namespace) {
  32937. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  32938. foreach ($description->getNamespaces() as $namespaceDescription) {
  32939. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  32940. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  32941. foreach ($namespaceDescription['commands'] as $name) {
  32942. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  32943. $commandXML->appendChild($dom->createTextNode($name));
  32944. }
  32945. }
  32946. }
  32947. return $dom;
  32948. }
  32949. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32950. {
  32951. $this->writeDocument($this->getInputArgumentDocument($argument));
  32952. }
  32953. protected function describeInputOption(InputOption $option, array $options = array())
  32954. {
  32955. $this->writeDocument($this->getInputOptionDocument($option));
  32956. }
  32957. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32958. {
  32959. $this->writeDocument($this->getInputDefinitionDocument($definition));
  32960. }
  32961. protected function describeCommand(Command $command, array $options = array())
  32962. {
  32963. $this->writeDocument($this->getCommandDocument($command));
  32964. }
  32965. protected function describeApplication(Application $application, array $options = array())
  32966. {
  32967. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  32968. }
  32969. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  32970. {
  32971. foreach ($importedParent->childNodes as $childNode) {
  32972. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  32973. }
  32974. }
  32975. private function writeDocument(\DOMDocument $dom)
  32976. {
  32977. $dom->formatOutput = true;
  32978. $this->write($dom->saveXML());
  32979. }
  32980. private function getInputArgumentDocument(InputArgument $argument)
  32981. {
  32982. $dom = new \DOMDocument('1.0', 'UTF-8');
  32983. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32984. $objectXML->setAttribute('name', $argument->getName());
  32985. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32986. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32987. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32988. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32989. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32990. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32991. foreach ($defaults as $default) {
  32992. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32993. $defaultXML->appendChild($dom->createTextNode($default));
  32994. }
  32995. return $dom;
  32996. }
  32997. private function getInputOptionDocument(InputOption $option)
  32998. {
  32999. $dom = new \DOMDocument('1.0', 'UTF-8');
  33000. $dom->appendChild($objectXML = $dom->createElement('option'));
  33001. $objectXML->setAttribute('name', '--'.$option->getName());
  33002. $pos = strpos($option->getShortcut(), '|');
  33003. if (false !== $pos) {
  33004. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  33005. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  33006. } else {
  33007. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  33008. }
  33009. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  33010. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  33011. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  33012. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33013. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  33014. if ($option->acceptValue()) {
  33015. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  33016. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33017. if (!empty($defaults)) {
  33018. foreach ($defaults as $default) {
  33019. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33020. $defaultXML->appendChild($dom->createTextNode($default));
  33021. }
  33022. }
  33023. }
  33024. return $dom;
  33025. }
  33026. }
  33027. <?php
  33028. namespace Symfony\Component\Console\Event;
  33029. class ConsoleCommandEvent extends ConsoleEvent
  33030. {
  33031. const RETURN_CODE_DISABLED = 113;
  33032. private $commandShouldRun = true;
  33033. public function disableCommand()
  33034. {
  33035. return $this->commandShouldRun = false;
  33036. }
  33037. public function enableCommand()
  33038. {
  33039. return $this->commandShouldRun = true;
  33040. }
  33041. public function commandShouldRun()
  33042. {
  33043. return $this->commandShouldRun;
  33044. }
  33045. }
  33046. <?php
  33047. namespace Symfony\Component\Console\Event;
  33048. use Symfony\Component\Console\Command\Command;
  33049. use Symfony\Component\Console\Input\InputInterface;
  33050. use Symfony\Component\Console\Output\OutputInterface;
  33051. use Symfony\Component\EventDispatcher\Event;
  33052. class ConsoleEvent extends Event
  33053. {
  33054. protected $command;
  33055. private $input;
  33056. private $output;
  33057. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  33058. {
  33059. $this->command = $command;
  33060. $this->input = $input;
  33061. $this->output = $output;
  33062. }
  33063. public function getCommand()
  33064. {
  33065. return $this->command;
  33066. }
  33067. public function getInput()
  33068. {
  33069. return $this->input;
  33070. }
  33071. public function getOutput()
  33072. {
  33073. return $this->output;
  33074. }
  33075. }
  33076. <?php
  33077. namespace Symfony\Component\Console\Event;
  33078. use Symfony\Component\Console\Command\Command;
  33079. use Symfony\Component\Console\Input\InputInterface;
  33080. use Symfony\Component\Console\Output\OutputInterface;
  33081. class ConsoleExceptionEvent extends ConsoleEvent
  33082. {
  33083. private $exception;
  33084. private $exitCode;
  33085. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  33086. {
  33087. parent::__construct($command, $input, $output);
  33088. $this->setException($exception);
  33089. $this->exitCode = (int) $exitCode;
  33090. }
  33091. public function getException()
  33092. {
  33093. return $this->exception;
  33094. }
  33095. public function setException(\Exception $exception)
  33096. {
  33097. $this->exception = $exception;
  33098. }
  33099. public function getExitCode()
  33100. {
  33101. return $this->exitCode;
  33102. }
  33103. }
  33104. <?php
  33105. namespace Symfony\Component\Console\Event;
  33106. use Symfony\Component\Console\Command\Command;
  33107. use Symfony\Component\Console\Input\InputInterface;
  33108. use Symfony\Component\Console\Output\OutputInterface;
  33109. class ConsoleTerminateEvent extends ConsoleEvent
  33110. {
  33111. private $exitCode;
  33112. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  33113. {
  33114. parent::__construct($command, $input, $output);
  33115. $this->setExitCode($exitCode);
  33116. }
  33117. public function setExitCode($exitCode)
  33118. {
  33119. $this->exitCode = (int) $exitCode;
  33120. }
  33121. public function getExitCode()
  33122. {
  33123. return $this->exitCode;
  33124. }
  33125. }
  33126. <?php
  33127. namespace Symfony\Component\Console\Exception;
  33128. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  33129. {
  33130. private $alternatives;
  33131. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  33132. {
  33133. parent::__construct($message, $code, $previous);
  33134. $this->alternatives = $alternatives;
  33135. }
  33136. public function getAlternatives()
  33137. {
  33138. return $this->alternatives;
  33139. }
  33140. }
  33141. <?php
  33142. namespace Symfony\Component\Console\Exception;
  33143. interface ExceptionInterface
  33144. {
  33145. }
  33146. <?php
  33147. namespace Symfony\Component\Console\Exception;
  33148. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  33149. {
  33150. }
  33151. <?php
  33152. namespace Symfony\Component\Console\Exception;
  33153. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  33154. {
  33155. }
  33156. <?php
  33157. namespace Symfony\Component\Console\Exception;
  33158. class LogicException extends \LogicException implements ExceptionInterface
  33159. {
  33160. }
  33161. <?php
  33162. namespace Symfony\Component\Console\Exception;
  33163. class RuntimeException extends \RuntimeException implements ExceptionInterface
  33164. {
  33165. }
  33166. <?php
  33167. namespace Symfony\Component\Console\Formatter;
  33168. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33169. class OutputFormatter implements OutputFormatterInterface
  33170. {
  33171. private $decorated;
  33172. private $styles = array();
  33173. private $styleStack;
  33174. public static function escape($text)
  33175. {
  33176. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  33177. return self::escapeTrailingBackslash($text);
  33178. }
  33179. public static function escapeTrailingBackslash($text)
  33180. {
  33181. if ('\\' === substr($text, -1)) {
  33182. $len = \strlen($text);
  33183. $text = rtrim($text, '\\');
  33184. $text = str_replace("\0", '', $text);
  33185. $text .= str_repeat("\0", $len - \strlen($text));
  33186. }
  33187. return $text;
  33188. }
  33189. public function __construct($decorated = false, array $styles = array())
  33190. {
  33191. $this->decorated = (bool) $decorated;
  33192. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  33193. $this->setStyle('info', new OutputFormatterStyle('green'));
  33194. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  33195. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  33196. foreach ($styles as $name => $style) {
  33197. $this->setStyle($name, $style);
  33198. }
  33199. $this->styleStack = new OutputFormatterStyleStack();
  33200. }
  33201. public function setDecorated($decorated)
  33202. {
  33203. $this->decorated = (bool) $decorated;
  33204. }
  33205. public function isDecorated()
  33206. {
  33207. return $this->decorated;
  33208. }
  33209. public function setStyle($name, OutputFormatterStyleInterface $style)
  33210. {
  33211. $this->styles[strtolower($name)] = $style;
  33212. }
  33213. public function hasStyle($name)
  33214. {
  33215. return isset($this->styles[strtolower($name)]);
  33216. }
  33217. public function getStyle($name)
  33218. {
  33219. if (!$this->hasStyle($name)) {
  33220. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  33221. }
  33222. return $this->styles[strtolower($name)];
  33223. }
  33224. public function format($message)
  33225. {
  33226. $message = (string) $message;
  33227. $offset = 0;
  33228. $output = '';
  33229. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  33230. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  33231. foreach ($matches[0] as $i => $match) {
  33232. $pos = $match[1];
  33233. $text = $match[0];
  33234. if (0 != $pos && '\\' == $message[$pos - 1]) {
  33235. continue;
  33236. }
  33237. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  33238. $offset = $pos + \strlen($text);
  33239. if ($open = '/' != $text[1]) {
  33240. $tag = $matches[1][$i][0];
  33241. } else {
  33242. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  33243. }
  33244. if (!$open && !$tag) {
  33245. $this->styleStack->pop();
  33246. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  33247. $output .= $this->applyCurrentStyle($text);
  33248. } elseif ($open) {
  33249. $this->styleStack->push($style);
  33250. } else {
  33251. $this->styleStack->pop($style);
  33252. }
  33253. }
  33254. $output .= $this->applyCurrentStyle(substr($message, $offset));
  33255. if (false !== strpos($output, "\0")) {
  33256. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  33257. }
  33258. return str_replace('\\<', '<', $output);
  33259. }
  33260. public function getStyleStack()
  33261. {
  33262. return $this->styleStack;
  33263. }
  33264. private function createStyleFromString($string)
  33265. {
  33266. if (isset($this->styles[$string])) {
  33267. return $this->styles[$string];
  33268. }
  33269. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  33270. return false;
  33271. }
  33272. $style = new OutputFormatterStyle();
  33273. foreach ($matches as $match) {
  33274. array_shift($match);
  33275. if ('fg' == $match[0]) {
  33276. $style->setForeground($match[1]);
  33277. } elseif ('bg' == $match[0]) {
  33278. $style->setBackground($match[1]);
  33279. } else {
  33280. try {
  33281. $style->setOption($match[1]);
  33282. } catch (\InvalidArgumentException $e) {
  33283. return false;
  33284. }
  33285. }
  33286. }
  33287. return $style;
  33288. }
  33289. private function applyCurrentStyle($text)
  33290. {
  33291. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  33292. }
  33293. }
  33294. <?php
  33295. namespace Symfony\Component\Console\Formatter;
  33296. interface OutputFormatterInterface
  33297. {
  33298. public function setDecorated($decorated);
  33299. public function isDecorated();
  33300. public function setStyle($name, OutputFormatterStyleInterface $style);
  33301. public function hasStyle($name);
  33302. public function getStyle($name);
  33303. public function format($message);
  33304. }
  33305. <?php
  33306. namespace Symfony\Component\Console\Formatter;
  33307. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33308. class OutputFormatterStyle implements OutputFormatterStyleInterface
  33309. {
  33310. private static $availableForegroundColors = array(
  33311. 'black' => array('set' => 30, 'unset' => 39),
  33312. 'red' => array('set' => 31, 'unset' => 39),
  33313. 'green' => array('set' => 32, 'unset' => 39),
  33314. 'yellow' => array('set' => 33, 'unset' => 39),
  33315. 'blue' => array('set' => 34, 'unset' => 39),
  33316. 'magenta' => array('set' => 35, 'unset' => 39),
  33317. 'cyan' => array('set' => 36, 'unset' => 39),
  33318. 'white' => array('set' => 37, 'unset' => 39),
  33319. 'default' => array('set' => 39, 'unset' => 39),
  33320. );
  33321. private static $availableBackgroundColors = array(
  33322. 'black' => array('set' => 40, 'unset' => 49),
  33323. 'red' => array('set' => 41, 'unset' => 49),
  33324. 'green' => array('set' => 42, 'unset' => 49),
  33325. 'yellow' => array('set' => 43, 'unset' => 49),
  33326. 'blue' => array('set' => 44, 'unset' => 49),
  33327. 'magenta' => array('set' => 45, 'unset' => 49),
  33328. 'cyan' => array('set' => 46, 'unset' => 49),
  33329. 'white' => array('set' => 47, 'unset' => 49),
  33330. 'default' => array('set' => 49, 'unset' => 49),
  33331. );
  33332. private static $availableOptions = array(
  33333. 'bold' => array('set' => 1, 'unset' => 22),
  33334. 'underscore' => array('set' => 4, 'unset' => 24),
  33335. 'blink' => array('set' => 5, 'unset' => 25),
  33336. 'reverse' => array('set' => 7, 'unset' => 27),
  33337. 'conceal' => array('set' => 8, 'unset' => 28),
  33338. );
  33339. private $foreground;
  33340. private $background;
  33341. private $options = array();
  33342. public function __construct($foreground = null, $background = null, array $options = array())
  33343. {
  33344. if (null !== $foreground) {
  33345. $this->setForeground($foreground);
  33346. }
  33347. if (null !== $background) {
  33348. $this->setBackground($background);
  33349. }
  33350. if (\count($options)) {
  33351. $this->setOptions($options);
  33352. }
  33353. }
  33354. public function setForeground($color = null)
  33355. {
  33356. if (null === $color) {
  33357. $this->foreground = null;
  33358. return;
  33359. }
  33360. if (!isset(static::$availableForegroundColors[$color])) {
  33361. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  33362. }
  33363. $this->foreground = static::$availableForegroundColors[$color];
  33364. }
  33365. public function setBackground($color = null)
  33366. {
  33367. if (null === $color) {
  33368. $this->background = null;
  33369. return;
  33370. }
  33371. if (!isset(static::$availableBackgroundColors[$color])) {
  33372. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  33373. }
  33374. $this->background = static::$availableBackgroundColors[$color];
  33375. }
  33376. public function setOption($option)
  33377. {
  33378. if (!isset(static::$availableOptions[$option])) {
  33379. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33380. }
  33381. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  33382. $this->options[] = static::$availableOptions[$option];
  33383. }
  33384. }
  33385. public function unsetOption($option)
  33386. {
  33387. if (!isset(static::$availableOptions[$option])) {
  33388. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33389. }
  33390. $pos = array_search(static::$availableOptions[$option], $this->options);
  33391. if (false !== $pos) {
  33392. unset($this->options[$pos]);
  33393. }
  33394. }
  33395. public function setOptions(array $options)
  33396. {
  33397. $this->options = array();
  33398. foreach ($options as $option) {
  33399. $this->setOption($option);
  33400. }
  33401. }
  33402. public function apply($text)
  33403. {
  33404. $setCodes = array();
  33405. $unsetCodes = array();
  33406. if (null !== $this->foreground) {
  33407. $setCodes[] = $this->foreground['set'];
  33408. $unsetCodes[] = $this->foreground['unset'];
  33409. }
  33410. if (null !== $this->background) {
  33411. $setCodes[] = $this->background['set'];
  33412. $unsetCodes[] = $this->background['unset'];
  33413. }
  33414. if (\count($this->options)) {
  33415. foreach ($this->options as $option) {
  33416. $setCodes[] = $option['set'];
  33417. $unsetCodes[] = $option['unset'];
  33418. }
  33419. }
  33420. if (0 === \count($setCodes)) {
  33421. return $text;
  33422. }
  33423. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33424. }
  33425. }
  33426. <?php
  33427. namespace Symfony\Component\Console\Formatter;
  33428. interface OutputFormatterStyleInterface
  33429. {
  33430. public function setForeground($color = null);
  33431. public function setBackground($color = null);
  33432. public function setOption($option);
  33433. public function unsetOption($option);
  33434. public function setOptions(array $options);
  33435. public function apply($text);
  33436. }
  33437. <?php
  33438. namespace Symfony\Component\Console\Formatter;
  33439. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33440. class OutputFormatterStyleStack
  33441. {
  33442. private $styles;
  33443. private $emptyStyle;
  33444. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  33445. {
  33446. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  33447. $this->reset();
  33448. }
  33449. public function reset()
  33450. {
  33451. $this->styles = array();
  33452. }
  33453. public function push(OutputFormatterStyleInterface $style)
  33454. {
  33455. $this->styles[] = $style;
  33456. }
  33457. public function pop(OutputFormatterStyleInterface $style = null)
  33458. {
  33459. if (empty($this->styles)) {
  33460. return $this->emptyStyle;
  33461. }
  33462. if (null === $style) {
  33463. return array_pop($this->styles);
  33464. }
  33465. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  33466. if ($style->apply('') === $stackedStyle->apply('')) {
  33467. $this->styles = \array_slice($this->styles, 0, $index);
  33468. return $stackedStyle;
  33469. }
  33470. }
  33471. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  33472. }
  33473. public function getCurrent()
  33474. {
  33475. if (empty($this->styles)) {
  33476. return $this->emptyStyle;
  33477. }
  33478. return $this->styles[\count($this->styles) - 1];
  33479. }
  33480. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  33481. {
  33482. $this->emptyStyle = $emptyStyle;
  33483. return $this;
  33484. }
  33485. public function getEmptyStyle()
  33486. {
  33487. return $this->emptyStyle;
  33488. }
  33489. }
  33490. <?php
  33491. namespace Symfony\Component\Console\Helper;
  33492. class DebugFormatterHelper extends Helper
  33493. {
  33494. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  33495. private $started = array();
  33496. private $count = -1;
  33497. public function start($id, $message, $prefix = 'RUN')
  33498. {
  33499. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  33500. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  33501. }
  33502. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  33503. {
  33504. $message = '';
  33505. if ($error) {
  33506. if (isset($this->started[$id]['out'])) {
  33507. $message .= "\n";
  33508. unset($this->started[$id]['out']);
  33509. }
  33510. if (!isset($this->started[$id]['err'])) {
  33511. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  33512. $this->started[$id]['err'] = true;
  33513. }
  33514. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  33515. } else {
  33516. if (isset($this->started[$id]['err'])) {
  33517. $message .= "\n";
  33518. unset($this->started[$id]['err']);
  33519. }
  33520. if (!isset($this->started[$id]['out'])) {
  33521. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  33522. $this->started[$id]['out'] = true;
  33523. }
  33524. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  33525. }
  33526. return $message;
  33527. }
  33528. public function stop($id, $message, $successful, $prefix = 'RES')
  33529. {
  33530. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  33531. if ($successful) {
  33532. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33533. }
  33534. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33535. unset($this->started[$id]['out'], $this->started[$id]['err']);
  33536. return $message;
  33537. }
  33538. private function getBorder($id)
  33539. {
  33540. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  33541. }
  33542. public function getName()
  33543. {
  33544. return 'debug_formatter';
  33545. }
  33546. }
  33547. <?php
  33548. namespace Symfony\Component\Console\Helper;
  33549. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  33550. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  33551. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  33552. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33553. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33554. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33555. use Symfony\Component\Console\Output\OutputInterface;
  33556. class DescriptorHelper extends Helper
  33557. {
  33558. private $descriptors = array();
  33559. public function __construct()
  33560. {
  33561. $this
  33562. ->register('txt', new TextDescriptor())
  33563. ->register('xml', new XmlDescriptor())
  33564. ->register('json', new JsonDescriptor())
  33565. ->register('md', new MarkdownDescriptor())
  33566. ;
  33567. }
  33568. public function describe(OutputInterface $output, $object, array $options = array())
  33569. {
  33570. $options = array_merge(array(
  33571. 'raw_text' => false,
  33572. 'format' => 'txt',
  33573. ), $options);
  33574. if (!isset($this->descriptors[$options['format']])) {
  33575. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  33576. }
  33577. $descriptor = $this->descriptors[$options['format']];
  33578. $descriptor->describe($output, $object, $options);
  33579. }
  33580. public function register($format, DescriptorInterface $descriptor)
  33581. {
  33582. $this->descriptors[$format] = $descriptor;
  33583. return $this;
  33584. }
  33585. public function getName()
  33586. {
  33587. return 'descriptor';
  33588. }
  33589. }
  33590. <?php
  33591. namespace Symfony\Component\Console\Helper;
  33592. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33593. use Symfony\Component\Console\Exception\RuntimeException;
  33594. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33595. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33596. use Symfony\Component\Console\Output\OutputInterface;
  33597. class DialogHelper extends InputAwareHelper
  33598. {
  33599. private $inputStream;
  33600. private static $shell;
  33601. private static $stty;
  33602. public function __construct($triggerDeprecationError = true)
  33603. {
  33604. if ($triggerDeprecationError) {
  33605. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33606. }
  33607. }
  33608. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  33609. {
  33610. if ($output instanceof ConsoleOutputInterface) {
  33611. $output = $output->getErrorOutput();
  33612. }
  33613. $width = max(array_map('strlen', array_keys($choices)));
  33614. $messages = (array) $question;
  33615. foreach ($choices as $key => $value) {
  33616. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  33617. }
  33618. $output->writeln($messages);
  33619. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  33620. $selectedChoices = str_replace(' ', '', $picked);
  33621. if ($multiselect) {
  33622. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  33623. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  33624. }
  33625. $selectedChoices = explode(',', $selectedChoices);
  33626. } else {
  33627. $selectedChoices = array($picked);
  33628. }
  33629. $multiselectChoices = array();
  33630. foreach ($selectedChoices as $value) {
  33631. if (empty($choices[$value])) {
  33632. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  33633. }
  33634. $multiselectChoices[] = $value;
  33635. }
  33636. if ($multiselect) {
  33637. return $multiselectChoices;
  33638. }
  33639. return $picked;
  33640. }, $attempts, $default);
  33641. return $result;
  33642. }
  33643. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  33644. {
  33645. if ($this->input && !$this->input->isInteractive()) {
  33646. return $default;
  33647. }
  33648. if ($output instanceof ConsoleOutputInterface) {
  33649. $output = $output->getErrorOutput();
  33650. }
  33651. $output->write($question);
  33652. $inputStream = $this->inputStream ?: STDIN;
  33653. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  33654. $ret = fgets($inputStream, 4096);
  33655. if (false === $ret) {
  33656. throw new RuntimeException('Aborted');
  33657. }
  33658. $ret = trim($ret);
  33659. } else {
  33660. $ret = '';
  33661. $i = 0;
  33662. $ofs = -1;
  33663. $matches = $autocomplete;
  33664. $numMatches = \count($matches);
  33665. $sttyMode = shell_exec('stty -g');
  33666. shell_exec('stty -icanon -echo');
  33667. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  33668. while (!feof($inputStream)) {
  33669. $c = fread($inputStream, 1);
  33670. if ("\177" === $c) {
  33671. if (0 === $numMatches && 0 !== $i) {
  33672. --$i;
  33673. $output->write("\033[1D");
  33674. }
  33675. if (0 === $i) {
  33676. $ofs = -1;
  33677. $matches = $autocomplete;
  33678. $numMatches = \count($matches);
  33679. } else {
  33680. $numMatches = 0;
  33681. }
  33682. $ret = substr($ret, 0, $i);
  33683. } elseif ("\033" === $c) {
  33684. $c .= fread($inputStream, 2);
  33685. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  33686. if ('A' === $c[2] && -1 === $ofs) {
  33687. $ofs = 0;
  33688. }
  33689. if (0 === $numMatches) {
  33690. continue;
  33691. }
  33692. $ofs += ('A' === $c[2]) ? -1 : 1;
  33693. $ofs = ($numMatches + $ofs) % $numMatches;
  33694. }
  33695. } elseif (\ord($c) < 32) {
  33696. if ("\t" === $c || "\n" === $c) {
  33697. if ($numMatches > 0 && -1 !== $ofs) {
  33698. $ret = $matches[$ofs];
  33699. $output->write(substr($ret, $i));
  33700. $i = \strlen($ret);
  33701. }
  33702. if ("\n" === $c) {
  33703. $output->write($c);
  33704. break;
  33705. }
  33706. $numMatches = 0;
  33707. }
  33708. continue;
  33709. } else {
  33710. $output->write($c);
  33711. $ret .= $c;
  33712. ++$i;
  33713. $numMatches = 0;
  33714. $ofs = 0;
  33715. foreach ($autocomplete as $value) {
  33716. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  33717. $matches[$numMatches++] = $value;
  33718. }
  33719. }
  33720. }
  33721. $output->write("\033[K");
  33722. if ($numMatches > 0 && -1 !== $ofs) {
  33723. $output->write("\0337");
  33724. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  33725. $output->write("\0338");
  33726. }
  33727. }
  33728. shell_exec(sprintf('stty %s', $sttyMode));
  33729. }
  33730. return \strlen($ret) > 0 ? $ret : $default;
  33731. }
  33732. public function askConfirmation(OutputInterface $output, $question, $default = true)
  33733. {
  33734. $answer = 'z';
  33735. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  33736. $answer = $this->ask($output, $question);
  33737. }
  33738. if (false === $default) {
  33739. return $answer && 'y' == strtolower($answer[0]);
  33740. }
  33741. return !$answer || 'y' == strtolower($answer[0]);
  33742. }
  33743. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  33744. {
  33745. if ($output instanceof ConsoleOutputInterface) {
  33746. $output = $output->getErrorOutput();
  33747. }
  33748. if ('\\' === \DIRECTORY_SEPARATOR) {
  33749. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  33750. if ('phar:' === substr(__FILE__, 0, 5)) {
  33751. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  33752. copy($exe, $tmpExe);
  33753. $exe = $tmpExe;
  33754. }
  33755. $output->write($question);
  33756. $value = rtrim(shell_exec($exe));
  33757. $output->writeln('');
  33758. if (isset($tmpExe)) {
  33759. unlink($tmpExe);
  33760. }
  33761. return $value;
  33762. }
  33763. if ($this->hasSttyAvailable()) {
  33764. $output->write($question);
  33765. $sttyMode = shell_exec('stty -g');
  33766. shell_exec('stty -echo');
  33767. $value = fgets($this->inputStream ?: STDIN, 4096);
  33768. shell_exec(sprintf('stty %s', $sttyMode));
  33769. if (false === $value) {
  33770. throw new RuntimeException('Aborted');
  33771. }
  33772. $value = trim($value);
  33773. $output->writeln('');
  33774. return $value;
  33775. }
  33776. if (false !== $shell = $this->getShell()) {
  33777. $output->write($question);
  33778. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  33779. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  33780. $value = rtrim(shell_exec($command));
  33781. $output->writeln('');
  33782. return $value;
  33783. }
  33784. if ($fallback) {
  33785. return $this->ask($output, $question);
  33786. }
  33787. throw new RuntimeException('Unable to hide the response');
  33788. }
  33789. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  33790. {
  33791. $that = $this;
  33792. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  33793. return $that->ask($output, $question, $default, $autocomplete);
  33794. };
  33795. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33796. }
  33797. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  33798. {
  33799. $that = $this;
  33800. $interviewer = function () use ($output, $question, $fallback, $that) {
  33801. return $that->askHiddenResponse($output, $question, $fallback);
  33802. };
  33803. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33804. }
  33805. public function setInputStream($stream)
  33806. {
  33807. $this->inputStream = $stream;
  33808. }
  33809. public function getInputStream()
  33810. {
  33811. return $this->inputStream;
  33812. }
  33813. public function getName()
  33814. {
  33815. return 'dialog';
  33816. }
  33817. private function getShell()
  33818. {
  33819. if (null !== self::$shell) {
  33820. return self::$shell;
  33821. }
  33822. self::$shell = false;
  33823. if (file_exists('/usr/bin/env')) {
  33824. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  33825. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  33826. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  33827. self::$shell = $sh;
  33828. break;
  33829. }
  33830. }
  33831. }
  33832. return self::$shell;
  33833. }
  33834. private function hasSttyAvailable()
  33835. {
  33836. if (null !== self::$stty) {
  33837. return self::$stty;
  33838. }
  33839. exec('stty 2>&1', $output, $exitcode);
  33840. return self::$stty = 0 === $exitcode;
  33841. }
  33842. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  33843. {
  33844. if ($output instanceof ConsoleOutputInterface) {
  33845. $output = $output->getErrorOutput();
  33846. }
  33847. $e = null;
  33848. while (false === $attempts || $attempts--) {
  33849. if (null !== $e) {
  33850. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  33851. }
  33852. try {
  33853. return \call_user_func($validator, $interviewer());
  33854. } catch (\Exception $e) {
  33855. }
  33856. }
  33857. throw $e;
  33858. }
  33859. }
  33860. <?php
  33861. namespace Symfony\Component\Console\Helper;
  33862. use Symfony\Component\Console\Formatter\OutputFormatter;
  33863. class FormatterHelper extends Helper
  33864. {
  33865. public function formatSection($section, $message, $style = 'info')
  33866. {
  33867. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  33868. }
  33869. public function formatBlock($messages, $style, $large = false)
  33870. {
  33871. if (!\is_array($messages)) {
  33872. $messages = array($messages);
  33873. }
  33874. $len = 0;
  33875. $lines = array();
  33876. foreach ($messages as $message) {
  33877. $message = OutputFormatter::escape($message);
  33878. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  33879. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  33880. }
  33881. $messages = $large ? array(str_repeat(' ', $len)) : array();
  33882. for ($i = 0; isset($lines[$i]); ++$i) {
  33883. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  33884. }
  33885. if ($large) {
  33886. $messages[] = str_repeat(' ', $len);
  33887. }
  33888. for ($i = 0; isset($messages[$i]); ++$i) {
  33889. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  33890. }
  33891. return implode("\n", $messages);
  33892. }
  33893. public function getName()
  33894. {
  33895. return 'formatter';
  33896. }
  33897. }
  33898. <?php
  33899. namespace Symfony\Component\Console\Helper;
  33900. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33901. abstract class Helper implements HelperInterface
  33902. {
  33903. protected $helperSet = null;
  33904. public function setHelperSet(HelperSet $helperSet = null)
  33905. {
  33906. $this->helperSet = $helperSet;
  33907. }
  33908. public function getHelperSet()
  33909. {
  33910. return $this->helperSet;
  33911. }
  33912. public static function strlen($string)
  33913. {
  33914. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33915. return \strlen($string);
  33916. }
  33917. return mb_strwidth($string, $encoding);
  33918. }
  33919. public static function formatTime($secs)
  33920. {
  33921. static $timeFormats = array(
  33922. array(0, '< 1 sec'),
  33923. array(1, '1 sec'),
  33924. array(2, 'secs', 1),
  33925. array(60, '1 min'),
  33926. array(120, 'mins', 60),
  33927. array(3600, '1 hr'),
  33928. array(7200, 'hrs', 3600),
  33929. array(86400, '1 day'),
  33930. array(172800, 'days', 86400),
  33931. );
  33932. foreach ($timeFormats as $index => $format) {
  33933. if ($secs >= $format[0]) {
  33934. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  33935. || $index == \count($timeFormats) - 1
  33936. ) {
  33937. if (2 == \count($format)) {
  33938. return $format[1];
  33939. }
  33940. return floor($secs / $format[2]).' '.$format[1];
  33941. }
  33942. }
  33943. }
  33944. }
  33945. public static function formatMemory($memory)
  33946. {
  33947. if ($memory >= 1024 * 1024 * 1024) {
  33948. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  33949. }
  33950. if ($memory >= 1024 * 1024) {
  33951. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  33952. }
  33953. if ($memory >= 1024) {
  33954. return sprintf('%d KiB', $memory / 1024);
  33955. }
  33956. return sprintf('%d B', $memory);
  33957. }
  33958. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  33959. {
  33960. return self::strlen(self::removeDecoration($formatter, $string));
  33961. }
  33962. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33963. {
  33964. $isDecorated = $formatter->isDecorated();
  33965. $formatter->setDecorated(false);
  33966. $string = $formatter->format($string);
  33967. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33968. $formatter->setDecorated($isDecorated);
  33969. return $string;
  33970. }
  33971. }
  33972. <?php
  33973. namespace Symfony\Component\Console\Helper;
  33974. interface HelperInterface
  33975. {
  33976. public function setHelperSet(HelperSet $helperSet = null);
  33977. public function getHelperSet();
  33978. public function getName();
  33979. }
  33980. <?php
  33981. namespace Symfony\Component\Console\Helper;
  33982. use Symfony\Component\Console\Command\Command;
  33983. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33984. class HelperSet implements \IteratorAggregate
  33985. {
  33986. private $helpers = array();
  33987. private $command;
  33988. public function __construct(array $helpers = array())
  33989. {
  33990. foreach ($helpers as $alias => $helper) {
  33991. $this->set($helper, \is_int($alias) ? null : $alias);
  33992. }
  33993. }
  33994. public function set(HelperInterface $helper, $alias = null)
  33995. {
  33996. $this->helpers[$helper->getName()] = $helper;
  33997. if (null !== $alias) {
  33998. $this->helpers[$alias] = $helper;
  33999. }
  34000. $helper->setHelperSet($this);
  34001. }
  34002. public function has($name)
  34003. {
  34004. return isset($this->helpers[$name]);
  34005. }
  34006. public function get($name)
  34007. {
  34008. if (!$this->has($name)) {
  34009. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  34010. }
  34011. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  34012. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  34013. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  34014. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  34015. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  34016. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  34017. }
  34018. return $this->helpers[$name];
  34019. }
  34020. public function setCommand(Command $command = null)
  34021. {
  34022. $this->command = $command;
  34023. }
  34024. public function getCommand()
  34025. {
  34026. return $this->command;
  34027. }
  34028. public function getIterator()
  34029. {
  34030. return new \ArrayIterator($this->helpers);
  34031. }
  34032. }
  34033. <?php
  34034. namespace Symfony\Component\Console\Helper;
  34035. use Symfony\Component\Console\Input\InputAwareInterface;
  34036. use Symfony\Component\Console\Input\InputInterface;
  34037. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  34038. {
  34039. protected $input;
  34040. public function setInput(InputInterface $input)
  34041. {
  34042. $this->input = $input;
  34043. }
  34044. }
  34045. <?php
  34046. namespace Symfony\Component\Console\Helper;
  34047. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34048. use Symfony\Component\Console\Output\OutputInterface;
  34049. use Symfony\Component\Process\Exception\ProcessFailedException;
  34050. use Symfony\Component\Process\Process;
  34051. use Symfony\Component\Process\ProcessBuilder;
  34052. class ProcessHelper extends Helper
  34053. {
  34054. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  34055. {
  34056. if ($output instanceof ConsoleOutputInterface) {
  34057. $output = $output->getErrorOutput();
  34058. }
  34059. $formatter = $this->getHelperSet()->get('debug_formatter');
  34060. if (\is_array($cmd)) {
  34061. $process = ProcessBuilder::create($cmd)->getProcess();
  34062. } elseif ($cmd instanceof Process) {
  34063. $process = $cmd;
  34064. } else {
  34065. $process = new Process($cmd);
  34066. }
  34067. if ($verbosity <= $output->getVerbosity()) {
  34068. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  34069. }
  34070. if ($output->isDebug()) {
  34071. $callback = $this->wrapCallback($output, $process, $callback);
  34072. }
  34073. $process->run($callback);
  34074. if ($verbosity <= $output->getVerbosity()) {
  34075. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  34076. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  34077. }
  34078. if (!$process->isSuccessful() && null !== $error) {
  34079. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  34080. }
  34081. return $process;
  34082. }
  34083. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  34084. {
  34085. $process = $this->run($output, $cmd, $error, $callback);
  34086. if (!$process->isSuccessful()) {
  34087. throw new ProcessFailedException($process);
  34088. }
  34089. return $process;
  34090. }
  34091. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  34092. {
  34093. if ($output instanceof ConsoleOutputInterface) {
  34094. $output = $output->getErrorOutput();
  34095. }
  34096. $formatter = $this->getHelperSet()->get('debug_formatter');
  34097. $that = $this;
  34098. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  34099. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  34100. if (null !== $callback) {
  34101. \call_user_func($callback, $type, $buffer);
  34102. }
  34103. };
  34104. }
  34105. public function escapeString($str)
  34106. {
  34107. return str_replace('<', '\\<', $str);
  34108. }
  34109. public function getName()
  34110. {
  34111. return 'process';
  34112. }
  34113. }
  34114. <?php
  34115. namespace Symfony\Component\Console\Helper;
  34116. use Symfony\Component\Console\Exception\LogicException;
  34117. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34118. use Symfony\Component\Console\Output\OutputInterface;
  34119. class ProgressBar
  34120. {
  34121. private $barWidth = 28;
  34122. private $barChar;
  34123. private $emptyBarChar = '-';
  34124. private $progressChar = '>';
  34125. private $format;
  34126. private $internalFormat;
  34127. private $redrawFreq = 1;
  34128. private $output;
  34129. private $step = 0;
  34130. private $max;
  34131. private $startTime;
  34132. private $stepWidth;
  34133. private $percent = 0.0;
  34134. private $formatLineCount;
  34135. private $messages = array();
  34136. private $overwrite = true;
  34137. private $firstRun = true;
  34138. private static $formatters;
  34139. private static $formats;
  34140. public function __construct(OutputInterface $output, $max = 0)
  34141. {
  34142. if ($output instanceof ConsoleOutputInterface) {
  34143. $output = $output->getErrorOutput();
  34144. }
  34145. $this->output = $output;
  34146. $this->setMaxSteps($max);
  34147. if (!$this->output->isDecorated()) {
  34148. $this->overwrite = false;
  34149. $this->setRedrawFrequency($max / 10);
  34150. }
  34151. $this->startTime = time();
  34152. }
  34153. public static function setPlaceholderFormatterDefinition($name, $callable)
  34154. {
  34155. if (!self::$formatters) {
  34156. self::$formatters = self::initPlaceholderFormatters();
  34157. }
  34158. self::$formatters[$name] = $callable;
  34159. }
  34160. public static function getPlaceholderFormatterDefinition($name)
  34161. {
  34162. if (!self::$formatters) {
  34163. self::$formatters = self::initPlaceholderFormatters();
  34164. }
  34165. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34166. }
  34167. public static function setFormatDefinition($name, $format)
  34168. {
  34169. if (!self::$formats) {
  34170. self::$formats = self::initFormats();
  34171. }
  34172. self::$formats[$name] = $format;
  34173. }
  34174. public static function getFormatDefinition($name)
  34175. {
  34176. if (!self::$formats) {
  34177. self::$formats = self::initFormats();
  34178. }
  34179. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34180. }
  34181. public function setMessage($message, $name = 'message')
  34182. {
  34183. $this->messages[$name] = $message;
  34184. }
  34185. public function getMessage($name = 'message')
  34186. {
  34187. return $this->messages[$name];
  34188. }
  34189. public function getStartTime()
  34190. {
  34191. return $this->startTime;
  34192. }
  34193. public function getMaxSteps()
  34194. {
  34195. return $this->max;
  34196. }
  34197. public function getStep()
  34198. {
  34199. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  34200. return $this->getProgress();
  34201. }
  34202. public function getProgress()
  34203. {
  34204. return $this->step;
  34205. }
  34206. public function getStepWidth()
  34207. {
  34208. return $this->stepWidth;
  34209. }
  34210. public function getProgressPercent()
  34211. {
  34212. return $this->percent;
  34213. }
  34214. public function setBarWidth($size)
  34215. {
  34216. $this->barWidth = (int) $size;
  34217. }
  34218. public function getBarWidth()
  34219. {
  34220. return $this->barWidth;
  34221. }
  34222. public function setBarCharacter($char)
  34223. {
  34224. $this->barChar = $char;
  34225. }
  34226. public function getBarCharacter()
  34227. {
  34228. if (null === $this->barChar) {
  34229. return $this->max ? '=' : $this->emptyBarChar;
  34230. }
  34231. return $this->barChar;
  34232. }
  34233. public function setEmptyBarCharacter($char)
  34234. {
  34235. $this->emptyBarChar = $char;
  34236. }
  34237. public function getEmptyBarCharacter()
  34238. {
  34239. return $this->emptyBarChar;
  34240. }
  34241. public function setProgressCharacter($char)
  34242. {
  34243. $this->progressChar = $char;
  34244. }
  34245. public function getProgressCharacter()
  34246. {
  34247. return $this->progressChar;
  34248. }
  34249. public function setFormat($format)
  34250. {
  34251. $this->format = null;
  34252. $this->internalFormat = $format;
  34253. }
  34254. public function setRedrawFrequency($freq)
  34255. {
  34256. $this->redrawFreq = max((int) $freq, 1);
  34257. }
  34258. public function start($max = null)
  34259. {
  34260. $this->startTime = time();
  34261. $this->step = 0;
  34262. $this->percent = 0.0;
  34263. if (null !== $max) {
  34264. $this->setMaxSteps($max);
  34265. }
  34266. $this->display();
  34267. }
  34268. public function advance($step = 1)
  34269. {
  34270. $this->setProgress($this->step + $step);
  34271. }
  34272. public function setCurrent($step)
  34273. {
  34274. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  34275. $this->setProgress($step);
  34276. }
  34277. public function setOverwrite($overwrite)
  34278. {
  34279. $this->overwrite = (bool) $overwrite;
  34280. }
  34281. public function setProgress($step)
  34282. {
  34283. $step = (int) $step;
  34284. if ($step < $this->step) {
  34285. throw new LogicException('You can\'t regress the progress bar.');
  34286. }
  34287. if ($this->max && $step > $this->max) {
  34288. $this->max = $step;
  34289. }
  34290. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  34291. $currPeriod = (int) ($step / $this->redrawFreq);
  34292. $this->step = $step;
  34293. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  34294. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  34295. $this->display();
  34296. }
  34297. }
  34298. public function finish()
  34299. {
  34300. if (!$this->max) {
  34301. $this->max = $this->step;
  34302. }
  34303. if ($this->step === $this->max && !$this->overwrite) {
  34304. return;
  34305. }
  34306. $this->setProgress($this->max);
  34307. }
  34308. public function display()
  34309. {
  34310. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34311. return;
  34312. }
  34313. if (null === $this->format) {
  34314. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34315. }
  34316. $self = $this;
  34317. $output = $this->output;
  34318. $messages = $this->messages;
  34319. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  34320. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34321. $text = \call_user_func($formatter, $self, $output);
  34322. } elseif (isset($messages[$matches[1]])) {
  34323. $text = $messages[$matches[1]];
  34324. } else {
  34325. return $matches[0];
  34326. }
  34327. if (isset($matches[2])) {
  34328. $text = sprintf('%'.$matches[2], $text);
  34329. }
  34330. return $text;
  34331. }, $this->format));
  34332. }
  34333. public function clear()
  34334. {
  34335. if (!$this->overwrite) {
  34336. return;
  34337. }
  34338. if (null === $this->format) {
  34339. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34340. }
  34341. $this->overwrite('');
  34342. }
  34343. private function setRealFormat($format)
  34344. {
  34345. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34346. $this->format = self::getFormatDefinition($format.'_nomax');
  34347. } elseif (null !== self::getFormatDefinition($format)) {
  34348. $this->format = self::getFormatDefinition($format);
  34349. } else {
  34350. $this->format = $format;
  34351. }
  34352. $this->formatLineCount = substr_count($this->format, "\n");
  34353. }
  34354. private function setMaxSteps($max)
  34355. {
  34356. $this->max = max(0, (int) $max);
  34357. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  34358. }
  34359. private function overwrite($message)
  34360. {
  34361. if ($this->overwrite) {
  34362. if (!$this->firstRun) {
  34363. $this->output->write("\x0D");
  34364. $this->output->write("\x1B[2K");
  34365. if ($this->formatLineCount > 0) {
  34366. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  34367. }
  34368. }
  34369. } elseif ($this->step > 0) {
  34370. $this->output->writeln('');
  34371. }
  34372. $this->firstRun = false;
  34373. $this->output->write($message);
  34374. }
  34375. private function determineBestFormat()
  34376. {
  34377. switch ($this->output->getVerbosity()) {
  34378. case OutputInterface::VERBOSITY_VERBOSE:
  34379. return $this->max ? 'verbose' : 'verbose_nomax';
  34380. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34381. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  34382. case OutputInterface::VERBOSITY_DEBUG:
  34383. return $this->max ? 'debug' : 'debug_nomax';
  34384. default:
  34385. return $this->max ? 'normal' : 'normal_nomax';
  34386. }
  34387. }
  34388. private static function initPlaceholderFormatters()
  34389. {
  34390. return array(
  34391. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  34392. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  34393. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  34394. if ($completeBars < $bar->getBarWidth()) {
  34395. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  34396. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  34397. }
  34398. return $display;
  34399. },
  34400. 'elapsed' => function (ProgressBar $bar) {
  34401. return Helper::formatTime(time() - $bar->getStartTime());
  34402. },
  34403. 'remaining' => function (ProgressBar $bar) {
  34404. if (!$bar->getMaxSteps()) {
  34405. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  34406. }
  34407. if (!$bar->getProgress()) {
  34408. $remaining = 0;
  34409. } else {
  34410. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  34411. }
  34412. return Helper::formatTime($remaining);
  34413. },
  34414. 'estimated' => function (ProgressBar $bar) {
  34415. if (!$bar->getMaxSteps()) {
  34416. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  34417. }
  34418. if (!$bar->getProgress()) {
  34419. $estimated = 0;
  34420. } else {
  34421. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34422. }
  34423. return Helper::formatTime($estimated);
  34424. },
  34425. 'memory' => function (ProgressBar $bar) {
  34426. return Helper::formatMemory(memory_get_usage(true));
  34427. },
  34428. 'current' => function (ProgressBar $bar) {
  34429. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34430. },
  34431. 'max' => function (ProgressBar $bar) {
  34432. return $bar->getMaxSteps();
  34433. },
  34434. 'percent' => function (ProgressBar $bar) {
  34435. return floor($bar->getProgressPercent() * 100);
  34436. },
  34437. );
  34438. }
  34439. private static function initFormats()
  34440. {
  34441. return array(
  34442. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  34443. 'normal_nomax' => ' %current% [%bar%]',
  34444. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  34445. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34446. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  34447. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34448. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  34449. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  34450. );
  34451. }
  34452. }
  34453. <?php
  34454. namespace Symfony\Component\Console\Helper;
  34455. use Symfony\Component\Console\Exception\LogicException;
  34456. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34457. use Symfony\Component\Console\Output\NullOutput;
  34458. use Symfony\Component\Console\Output\OutputInterface;
  34459. class ProgressHelper extends Helper
  34460. {
  34461. const FORMAT_QUIET = ' %percent%%';
  34462. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  34463. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  34464. const FORMAT_QUIET_NOMAX = ' %current%';
  34465. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  34466. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  34467. private $barWidth = 28;
  34468. private $barChar = '=';
  34469. private $emptyBarChar = '-';
  34470. private $progressChar = '>';
  34471. private $format = null;
  34472. private $redrawFreq = 1;
  34473. private $lastMessagesLength;
  34474. private $barCharOriginal;
  34475. private $output;
  34476. private $current;
  34477. private $max;
  34478. private $startTime;
  34479. private $defaultFormatVars = array(
  34480. 'current',
  34481. 'max',
  34482. 'bar',
  34483. 'percent',
  34484. 'elapsed',
  34485. );
  34486. private $formatVars;
  34487. private $widths = array(
  34488. 'current' => 4,
  34489. 'max' => 4,
  34490. 'percent' => 3,
  34491. 'elapsed' => 6,
  34492. );
  34493. private $timeFormats = array(
  34494. array(0, '???'),
  34495. array(2, '1 sec'),
  34496. array(59, 'secs', 1),
  34497. array(60, '1 min'),
  34498. array(3600, 'mins', 60),
  34499. array(5400, '1 hr'),
  34500. array(86400, 'hrs', 3600),
  34501. array(129600, '1 day'),
  34502. array(604800, 'days', 86400),
  34503. );
  34504. public function __construct($triggerDeprecationError = true)
  34505. {
  34506. if ($triggerDeprecationError) {
  34507. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  34508. }
  34509. }
  34510. public function setBarWidth($size)
  34511. {
  34512. $this->barWidth = (int) $size;
  34513. }
  34514. public function setBarCharacter($char)
  34515. {
  34516. $this->barChar = $char;
  34517. }
  34518. public function setEmptyBarCharacter($char)
  34519. {
  34520. $this->emptyBarChar = $char;
  34521. }
  34522. public function setProgressCharacter($char)
  34523. {
  34524. $this->progressChar = $char;
  34525. }
  34526. public function setFormat($format)
  34527. {
  34528. $this->format = $format;
  34529. }
  34530. public function setRedrawFrequency($freq)
  34531. {
  34532. $this->redrawFreq = (int) $freq;
  34533. }
  34534. public function start(OutputInterface $output, $max = null)
  34535. {
  34536. if ($output instanceof ConsoleOutputInterface) {
  34537. $output = $output->getErrorOutput();
  34538. }
  34539. $this->startTime = time();
  34540. $this->current = 0;
  34541. $this->max = (int) $max;
  34542. $this->output = $output->isDecorated() ? $output : new NullOutput();
  34543. $this->lastMessagesLength = 0;
  34544. $this->barCharOriginal = '';
  34545. if (null === $this->format) {
  34546. switch ($output->getVerbosity()) {
  34547. case OutputInterface::VERBOSITY_QUIET:
  34548. $this->format = self::FORMAT_QUIET_NOMAX;
  34549. if ($this->max > 0) {
  34550. $this->format = self::FORMAT_QUIET;
  34551. }
  34552. break;
  34553. case OutputInterface::VERBOSITY_VERBOSE:
  34554. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34555. case OutputInterface::VERBOSITY_DEBUG:
  34556. $this->format = self::FORMAT_VERBOSE_NOMAX;
  34557. if ($this->max > 0) {
  34558. $this->format = self::FORMAT_VERBOSE;
  34559. }
  34560. break;
  34561. default:
  34562. $this->format = self::FORMAT_NORMAL_NOMAX;
  34563. if ($this->max > 0) {
  34564. $this->format = self::FORMAT_NORMAL;
  34565. }
  34566. break;
  34567. }
  34568. }
  34569. $this->initialize();
  34570. }
  34571. public function advance($step = 1, $redraw = false)
  34572. {
  34573. $this->setCurrent($this->current + $step, $redraw);
  34574. }
  34575. public function setCurrent($current, $redraw = false)
  34576. {
  34577. if (null === $this->startTime) {
  34578. throw new LogicException('You must start the progress bar before calling setCurrent().');
  34579. }
  34580. $current = (int) $current;
  34581. if ($current < $this->current) {
  34582. throw new LogicException('You can\'t regress the progress bar');
  34583. }
  34584. if (0 === $this->current) {
  34585. $redraw = true;
  34586. }
  34587. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  34588. $this->current = $current;
  34589. $currPeriod = (int) ($this->current / $this->redrawFreq);
  34590. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  34591. $this->display();
  34592. }
  34593. }
  34594. public function display($finish = false)
  34595. {
  34596. if (null === $this->startTime) {
  34597. throw new LogicException('You must start the progress bar before calling display().');
  34598. }
  34599. $message = $this->format;
  34600. foreach ($this->generate($finish) as $name => $value) {
  34601. $message = str_replace("%{$name}%", $value, $message);
  34602. }
  34603. $this->overwrite($this->output, $message);
  34604. }
  34605. public function clear()
  34606. {
  34607. $this->overwrite($this->output, '');
  34608. }
  34609. public function finish()
  34610. {
  34611. if (null === $this->startTime) {
  34612. throw new LogicException('You must start the progress bar before calling finish().');
  34613. }
  34614. if (null !== $this->startTime) {
  34615. if (!$this->max) {
  34616. $this->barChar = $this->barCharOriginal;
  34617. $this->display(true);
  34618. }
  34619. $this->startTime = null;
  34620. $this->output->writeln('');
  34621. $this->output = null;
  34622. }
  34623. }
  34624. private function initialize()
  34625. {
  34626. $this->formatVars = array();
  34627. foreach ($this->defaultFormatVars as $var) {
  34628. if (false !== strpos($this->format, "%{$var}%")) {
  34629. $this->formatVars[$var] = true;
  34630. }
  34631. }
  34632. if ($this->max > 0) {
  34633. $this->widths['max'] = $this->strlen($this->max);
  34634. $this->widths['current'] = $this->widths['max'];
  34635. } else {
  34636. $this->barCharOriginal = $this->barChar;
  34637. $this->barChar = $this->emptyBarChar;
  34638. }
  34639. }
  34640. private function generate($finish = false)
  34641. {
  34642. $vars = array();
  34643. $percent = 0;
  34644. if ($this->max > 0) {
  34645. $percent = (float) $this->current / $this->max;
  34646. }
  34647. if (isset($this->formatVars['bar'])) {
  34648. if ($this->max > 0) {
  34649. $completeBars = floor($percent * $this->barWidth);
  34650. } else {
  34651. if (!$finish) {
  34652. $completeBars = floor($this->current % $this->barWidth);
  34653. } else {
  34654. $completeBars = $this->barWidth;
  34655. }
  34656. }
  34657. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  34658. $bar = str_repeat($this->barChar, $completeBars);
  34659. if ($completeBars < $this->barWidth) {
  34660. $bar .= $this->progressChar;
  34661. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  34662. }
  34663. $vars['bar'] = $bar;
  34664. }
  34665. if (isset($this->formatVars['elapsed'])) {
  34666. $elapsed = time() - $this->startTime;
  34667. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  34668. }
  34669. if (isset($this->formatVars['current'])) {
  34670. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  34671. }
  34672. if (isset($this->formatVars['max'])) {
  34673. $vars['max'] = $this->max;
  34674. }
  34675. if (isset($this->formatVars['percent'])) {
  34676. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  34677. }
  34678. return $vars;
  34679. }
  34680. private function humaneTime($secs)
  34681. {
  34682. $text = '';
  34683. foreach ($this->timeFormats as $format) {
  34684. if ($secs < $format[0]) {
  34685. if (2 == \count($format)) {
  34686. $text = $format[1];
  34687. break;
  34688. } else {
  34689. $text = ceil($secs / $format[2]).' '.$format[1];
  34690. break;
  34691. }
  34692. }
  34693. }
  34694. return $text;
  34695. }
  34696. private function overwrite(OutputInterface $output, $message)
  34697. {
  34698. $length = $this->strlen($message);
  34699. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  34700. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  34701. }
  34702. $output->write("\x0D");
  34703. $output->write($message);
  34704. $this->lastMessagesLength = $this->strlen($message);
  34705. }
  34706. public function getName()
  34707. {
  34708. return 'progress';
  34709. }
  34710. }
  34711. <?php
  34712. namespace Symfony\Component\Console\Helper;
  34713. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34714. use Symfony\Component\Console\Exception\LogicException;
  34715. use Symfony\Component\Console\Output\OutputInterface;
  34716. class ProgressIndicator
  34717. {
  34718. private $output;
  34719. private $startTime;
  34720. private $format;
  34721. private $message;
  34722. private $indicatorValues;
  34723. private $indicatorCurrent;
  34724. private $indicatorChangeInterval;
  34725. private $indicatorUpdateTime;
  34726. private $started = false;
  34727. private static $formatters;
  34728. private static $formats;
  34729. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  34730. {
  34731. $this->output = $output;
  34732. if (null === $format) {
  34733. $format = $this->determineBestFormat();
  34734. }
  34735. if (null === $indicatorValues) {
  34736. $indicatorValues = array('-', '\\', '|', '/');
  34737. }
  34738. $indicatorValues = array_values($indicatorValues);
  34739. if (2 > \count($indicatorValues)) {
  34740. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  34741. }
  34742. $this->format = self::getFormatDefinition($format);
  34743. $this->indicatorChangeInterval = $indicatorChangeInterval;
  34744. $this->indicatorValues = $indicatorValues;
  34745. $this->startTime = time();
  34746. }
  34747. public function setMessage($message)
  34748. {
  34749. $this->message = $message;
  34750. $this->display();
  34751. }
  34752. public function getMessage()
  34753. {
  34754. return $this->message;
  34755. }
  34756. public function getStartTime()
  34757. {
  34758. return $this->startTime;
  34759. }
  34760. public function getCurrentValue()
  34761. {
  34762. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  34763. }
  34764. public function start($message)
  34765. {
  34766. if ($this->started) {
  34767. throw new LogicException('Progress indicator already started.');
  34768. }
  34769. $this->message = $message;
  34770. $this->started = true;
  34771. $this->startTime = time();
  34772. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  34773. $this->indicatorCurrent = 0;
  34774. $this->display();
  34775. }
  34776. public function advance()
  34777. {
  34778. if (!$this->started) {
  34779. throw new LogicException('Progress indicator has not yet been started.');
  34780. }
  34781. if (!$this->output->isDecorated()) {
  34782. return;
  34783. }
  34784. $currentTime = $this->getCurrentTimeInMilliseconds();
  34785. if ($currentTime < $this->indicatorUpdateTime) {
  34786. return;
  34787. }
  34788. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  34789. ++$this->indicatorCurrent;
  34790. $this->display();
  34791. }
  34792. public function finish($message)
  34793. {
  34794. if (!$this->started) {
  34795. throw new LogicException('Progress indicator has not yet been started.');
  34796. }
  34797. $this->message = $message;
  34798. $this->display();
  34799. $this->output->writeln('');
  34800. $this->started = false;
  34801. }
  34802. public static function getFormatDefinition($name)
  34803. {
  34804. if (!self::$formats) {
  34805. self::$formats = self::initFormats();
  34806. }
  34807. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34808. }
  34809. public static function setPlaceholderFormatterDefinition($name, $callable)
  34810. {
  34811. if (!self::$formatters) {
  34812. self::$formatters = self::initPlaceholderFormatters();
  34813. }
  34814. self::$formatters[$name] = $callable;
  34815. }
  34816. public static function getPlaceholderFormatterDefinition($name)
  34817. {
  34818. if (!self::$formatters) {
  34819. self::$formatters = self::initPlaceholderFormatters();
  34820. }
  34821. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34822. }
  34823. private function display()
  34824. {
  34825. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34826. return;
  34827. }
  34828. $self = $this;
  34829. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  34830. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34831. return \call_user_func($formatter, $self);
  34832. }
  34833. return $matches[0];
  34834. }, $this->format));
  34835. }
  34836. private function determineBestFormat()
  34837. {
  34838. switch ($this->output->getVerbosity()) {
  34839. case OutputInterface::VERBOSITY_VERBOSE:
  34840. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  34841. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34842. case OutputInterface::VERBOSITY_DEBUG:
  34843. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  34844. default:
  34845. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  34846. }
  34847. }
  34848. private function overwrite($message)
  34849. {
  34850. if ($this->output->isDecorated()) {
  34851. $this->output->write("\x0D\x1B[2K");
  34852. $this->output->write($message);
  34853. } else {
  34854. $this->output->writeln($message);
  34855. }
  34856. }
  34857. private function getCurrentTimeInMilliseconds()
  34858. {
  34859. return round(microtime(true) * 1000);
  34860. }
  34861. private static function initPlaceholderFormatters()
  34862. {
  34863. return array(
  34864. 'indicator' => function (ProgressIndicator $indicator) {
  34865. return $indicator->getCurrentValue();
  34866. },
  34867. 'message' => function (ProgressIndicator $indicator) {
  34868. return $indicator->getMessage();
  34869. },
  34870. 'elapsed' => function (ProgressIndicator $indicator) {
  34871. return Helper::formatTime(time() - $indicator->getStartTime());
  34872. },
  34873. 'memory' => function () {
  34874. return Helper::formatMemory(memory_get_usage(true));
  34875. },
  34876. );
  34877. }
  34878. private static function initFormats()
  34879. {
  34880. return array(
  34881. 'normal' => ' %indicator% %message%',
  34882. 'normal_no_ansi' => ' %message%',
  34883. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  34884. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  34885. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  34886. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  34887. );
  34888. }
  34889. }
  34890. <?php
  34891. namespace Symfony\Component\Console\Helper;
  34892. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34893. use Symfony\Component\Console\Exception\RuntimeException;
  34894. use Symfony\Component\Console\Formatter\OutputFormatter;
  34895. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34896. use Symfony\Component\Console\Input\InputInterface;
  34897. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34898. use Symfony\Component\Console\Output\OutputInterface;
  34899. use Symfony\Component\Console\Question\ChoiceQuestion;
  34900. use Symfony\Component\Console\Question\Question;
  34901. class QuestionHelper extends Helper
  34902. {
  34903. private $inputStream;
  34904. private static $shell;
  34905. private static $stty;
  34906. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34907. {
  34908. if ($output instanceof ConsoleOutputInterface) {
  34909. $output = $output->getErrorOutput();
  34910. }
  34911. if (!$input->isInteractive()) {
  34912. $default = $question->getDefault();
  34913. if (null !== $default && $question instanceof ChoiceQuestion) {
  34914. $choices = $question->getChoices();
  34915. if (!$question->isMultiselect()) {
  34916. return isset($choices[$default]) ? $choices[$default] : $default;
  34917. }
  34918. $default = explode(',', $default);
  34919. foreach ($default as $k => $v) {
  34920. $v = trim($v);
  34921. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  34922. }
  34923. }
  34924. return $default;
  34925. }
  34926. if (!$question->getValidator()) {
  34927. return $this->doAsk($output, $question);
  34928. }
  34929. $that = $this;
  34930. $interviewer = function () use ($output, $question, $that) {
  34931. return $that->doAsk($output, $question);
  34932. };
  34933. return $this->validateAttempts($interviewer, $output, $question);
  34934. }
  34935. public function setInputStream($stream)
  34936. {
  34937. if (!\is_resource($stream)) {
  34938. throw new InvalidArgumentException('Input stream must be a valid resource.');
  34939. }
  34940. $this->inputStream = $stream;
  34941. }
  34942. public function getInputStream()
  34943. {
  34944. return $this->inputStream;
  34945. }
  34946. public function getName()
  34947. {
  34948. return 'question';
  34949. }
  34950. public function doAsk(OutputInterface $output, Question $question)
  34951. {
  34952. $this->writePrompt($output, $question);
  34953. $inputStream = $this->inputStream ?: STDIN;
  34954. $autocomplete = $question->getAutocompleterValues();
  34955. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34956. $ret = false;
  34957. if ($question->isHidden()) {
  34958. try {
  34959. $ret = trim($this->getHiddenResponse($output, $inputStream));
  34960. } catch (RuntimeException $e) {
  34961. if (!$question->isHiddenFallback()) {
  34962. throw $e;
  34963. }
  34964. }
  34965. }
  34966. if (false === $ret) {
  34967. $ret = fgets($inputStream, 4096);
  34968. if (false === $ret) {
  34969. throw new RuntimeException('Aborted');
  34970. }
  34971. $ret = trim($ret);
  34972. }
  34973. } else {
  34974. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34975. }
  34976. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  34977. if ($normalizer = $question->getNormalizer()) {
  34978. return $normalizer($ret);
  34979. }
  34980. return $ret;
  34981. }
  34982. protected function writePrompt(OutputInterface $output, Question $question)
  34983. {
  34984. $message = $question->getQuestion();
  34985. if ($question instanceof ChoiceQuestion) {
  34986. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34987. $messages = (array) $question->getQuestion();
  34988. foreach ($question->getChoices() as $key => $value) {
  34989. $width = $maxWidth - $this->strlen($key);
  34990. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34991. }
  34992. $output->writeln($messages);
  34993. $message = $question->getPrompt();
  34994. }
  34995. $output->write($message);
  34996. }
  34997. protected function writeError(OutputInterface $output, \Exception $error)
  34998. {
  34999. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  35000. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  35001. } else {
  35002. $message = '<error>'.$error->getMessage().'</error>';
  35003. }
  35004. $output->writeln($message);
  35005. }
  35006. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  35007. {
  35008. $ret = '';
  35009. $i = 0;
  35010. $ofs = -1;
  35011. $matches = $autocomplete;
  35012. $numMatches = \count($matches);
  35013. $sttyMode = shell_exec('stty -g');
  35014. shell_exec('stty -icanon -echo');
  35015. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35016. while (!feof($inputStream)) {
  35017. $c = fread($inputStream, 1);
  35018. if ("\177" === $c) {
  35019. if (0 === $numMatches && 0 !== $i) {
  35020. --$i;
  35021. $output->write("\033[1D");
  35022. }
  35023. if (0 === $i) {
  35024. $ofs = -1;
  35025. $matches = $autocomplete;
  35026. $numMatches = \count($matches);
  35027. } else {
  35028. $numMatches = 0;
  35029. }
  35030. $ret = substr($ret, 0, $i);
  35031. } elseif ("\033" === $c) {
  35032. $c .= fread($inputStream, 2);
  35033. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35034. if ('A' === $c[2] && -1 === $ofs) {
  35035. $ofs = 0;
  35036. }
  35037. if (0 === $numMatches) {
  35038. continue;
  35039. }
  35040. $ofs += ('A' === $c[2]) ? -1 : 1;
  35041. $ofs = ($numMatches + $ofs) % $numMatches;
  35042. }
  35043. } elseif (\ord($c) < 32) {
  35044. if ("\t" === $c || "\n" === $c) {
  35045. if ($numMatches > 0 && -1 !== $ofs) {
  35046. $ret = $matches[$ofs];
  35047. $output->write(substr($ret, $i));
  35048. $i = \strlen($ret);
  35049. }
  35050. if ("\n" === $c) {
  35051. $output->write($c);
  35052. break;
  35053. }
  35054. $numMatches = 0;
  35055. }
  35056. continue;
  35057. } else {
  35058. $output->write($c);
  35059. $ret .= $c;
  35060. ++$i;
  35061. $numMatches = 0;
  35062. $ofs = 0;
  35063. foreach ($autocomplete as $value) {
  35064. if (0 === strpos($value, $ret)) {
  35065. $matches[$numMatches++] = $value;
  35066. }
  35067. }
  35068. }
  35069. $output->write("\033[K");
  35070. if ($numMatches > 0 && -1 !== $ofs) {
  35071. $output->write("\0337");
  35072. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  35073. $output->write("\0338");
  35074. }
  35075. }
  35076. shell_exec(sprintf('stty %s', $sttyMode));
  35077. return $ret;
  35078. }
  35079. private function getHiddenResponse(OutputInterface $output, $inputStream)
  35080. {
  35081. if ('\\' === \DIRECTORY_SEPARATOR) {
  35082. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35083. if ('phar:' === substr(__FILE__, 0, 5)) {
  35084. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35085. copy($exe, $tmpExe);
  35086. $exe = $tmpExe;
  35087. }
  35088. $value = rtrim(shell_exec($exe));
  35089. $output->writeln('');
  35090. if (isset($tmpExe)) {
  35091. unlink($tmpExe);
  35092. }
  35093. return $value;
  35094. }
  35095. if ($this->hasSttyAvailable()) {
  35096. $sttyMode = shell_exec('stty -g');
  35097. shell_exec('stty -echo');
  35098. $value = fgets($inputStream, 4096);
  35099. shell_exec(sprintf('stty %s', $sttyMode));
  35100. if (false === $value) {
  35101. throw new RuntimeException('Aborted');
  35102. }
  35103. $value = trim($value);
  35104. $output->writeln('');
  35105. return $value;
  35106. }
  35107. if (false !== $shell = $this->getShell()) {
  35108. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35109. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35110. $value = rtrim(shell_exec($command));
  35111. $output->writeln('');
  35112. return $value;
  35113. }
  35114. throw new RuntimeException('Unable to hide the response.');
  35115. }
  35116. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  35117. {
  35118. $error = null;
  35119. $attempts = $question->getMaxAttempts();
  35120. while (null === $attempts || $attempts--) {
  35121. if (null !== $error) {
  35122. $this->writeError($output, $error);
  35123. }
  35124. try {
  35125. return \call_user_func($question->getValidator(), $interviewer());
  35126. } catch (RuntimeException $e) {
  35127. throw $e;
  35128. } catch (\Exception $error) {
  35129. }
  35130. }
  35131. throw $error;
  35132. }
  35133. private function getShell()
  35134. {
  35135. if (null !== self::$shell) {
  35136. return self::$shell;
  35137. }
  35138. self::$shell = false;
  35139. if (file_exists('/usr/bin/env')) {
  35140. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35141. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35142. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35143. self::$shell = $sh;
  35144. break;
  35145. }
  35146. }
  35147. }
  35148. return self::$shell;
  35149. }
  35150. private function hasSttyAvailable()
  35151. {
  35152. if (null !== self::$stty) {
  35153. return self::$stty;
  35154. }
  35155. exec('stty 2>&1', $output, $exitcode);
  35156. return self::$stty = 0 === $exitcode;
  35157. }
  35158. }
  35159. <?php
  35160. namespace Symfony\Component\Console\Helper;
  35161. use Symfony\Component\Console\Exception\LogicException;
  35162. use Symfony\Component\Console\Formatter\OutputFormatter;
  35163. use Symfony\Component\Console\Input\InputInterface;
  35164. use Symfony\Component\Console\Output\OutputInterface;
  35165. use Symfony\Component\Console\Question\ChoiceQuestion;
  35166. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35167. use Symfony\Component\Console\Question\Question;
  35168. use Symfony\Component\Console\Style\SymfonyStyle;
  35169. class SymfonyQuestionHelper extends QuestionHelper
  35170. {
  35171. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35172. {
  35173. $validator = $question->getValidator();
  35174. $question->setValidator(function ($value) use ($validator) {
  35175. if (null !== $validator) {
  35176. $value = $validator($value);
  35177. } else {
  35178. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  35179. throw new LogicException('A value is required.');
  35180. }
  35181. }
  35182. return $value;
  35183. });
  35184. return parent::ask($input, $output, $question);
  35185. }
  35186. protected function writePrompt(OutputInterface $output, Question $question)
  35187. {
  35188. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  35189. $default = $question->getDefault();
  35190. switch (true) {
  35191. case null === $default:
  35192. $text = sprintf(' <info>%s</info>:', $text);
  35193. break;
  35194. case $question instanceof ConfirmationQuestion:
  35195. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  35196. break;
  35197. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  35198. $choices = $question->getChoices();
  35199. $default = explode(',', $default);
  35200. foreach ($default as $key => $value) {
  35201. $default[$key] = $choices[trim($value)];
  35202. }
  35203. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  35204. break;
  35205. case $question instanceof ChoiceQuestion:
  35206. $choices = $question->getChoices();
  35207. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  35208. break;
  35209. default:
  35210. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  35211. }
  35212. $output->writeln($text);
  35213. if ($question instanceof ChoiceQuestion) {
  35214. $width = max(array_map('strlen', array_keys($question->getChoices())));
  35215. foreach ($question->getChoices() as $key => $value) {
  35216. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  35217. }
  35218. }
  35219. $output->write(' > ');
  35220. }
  35221. protected function writeError(OutputInterface $output, \Exception $error)
  35222. {
  35223. if ($output instanceof SymfonyStyle) {
  35224. $output->newLine();
  35225. $output->error($error->getMessage());
  35226. return;
  35227. }
  35228. parent::writeError($output, $error);
  35229. }
  35230. }
  35231. <?php
  35232. namespace Symfony\Component\Console\Helper;
  35233. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35234. use Symfony\Component\Console\Output\OutputInterface;
  35235. class Table
  35236. {
  35237. private $headers = array();
  35238. private $rows = array();
  35239. private $columnWidths = array();
  35240. private $numberOfColumns;
  35241. private $output;
  35242. private $style;
  35243. private $columnStyles = array();
  35244. private static $styles;
  35245. public function __construct(OutputInterface $output)
  35246. {
  35247. $this->output = $output;
  35248. if (!self::$styles) {
  35249. self::$styles = self::initStyles();
  35250. }
  35251. $this->setStyle('default');
  35252. }
  35253. public static function setStyleDefinition($name, TableStyle $style)
  35254. {
  35255. if (!self::$styles) {
  35256. self::$styles = self::initStyles();
  35257. }
  35258. self::$styles[$name] = $style;
  35259. }
  35260. public static function getStyleDefinition($name)
  35261. {
  35262. if (!self::$styles) {
  35263. self::$styles = self::initStyles();
  35264. }
  35265. if (isset(self::$styles[$name])) {
  35266. return self::$styles[$name];
  35267. }
  35268. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35269. }
  35270. public function setStyle($name)
  35271. {
  35272. $this->style = $this->resolveStyle($name);
  35273. return $this;
  35274. }
  35275. public function getStyle()
  35276. {
  35277. return $this->style;
  35278. }
  35279. public function setColumnStyle($columnIndex, $name)
  35280. {
  35281. $columnIndex = (int) $columnIndex;
  35282. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  35283. return $this;
  35284. }
  35285. public function getColumnStyle($columnIndex)
  35286. {
  35287. if (isset($this->columnStyles[$columnIndex])) {
  35288. return $this->columnStyles[$columnIndex];
  35289. }
  35290. return $this->getStyle();
  35291. }
  35292. public function setHeaders(array $headers)
  35293. {
  35294. $headers = array_values($headers);
  35295. if (!empty($headers) && !\is_array($headers[0])) {
  35296. $headers = array($headers);
  35297. }
  35298. $this->headers = $headers;
  35299. return $this;
  35300. }
  35301. public function setRows(array $rows)
  35302. {
  35303. $this->rows = array();
  35304. return $this->addRows($rows);
  35305. }
  35306. public function addRows(array $rows)
  35307. {
  35308. foreach ($rows as $row) {
  35309. $this->addRow($row);
  35310. }
  35311. return $this;
  35312. }
  35313. public function addRow($row)
  35314. {
  35315. if ($row instanceof TableSeparator) {
  35316. $this->rows[] = $row;
  35317. return $this;
  35318. }
  35319. if (!\is_array($row)) {
  35320. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  35321. }
  35322. $this->rows[] = array_values($row);
  35323. return $this;
  35324. }
  35325. public function setRow($column, array $row)
  35326. {
  35327. $this->rows[$column] = $row;
  35328. return $this;
  35329. }
  35330. public function render()
  35331. {
  35332. $this->calculateNumberOfColumns();
  35333. $rows = $this->buildTableRows($this->rows);
  35334. $headers = $this->buildTableRows($this->headers);
  35335. $this->calculateColumnsWidth(array_merge($headers, $rows));
  35336. $this->renderRowSeparator();
  35337. if (!empty($headers)) {
  35338. foreach ($headers as $header) {
  35339. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35340. $this->renderRowSeparator();
  35341. }
  35342. }
  35343. foreach ($rows as $row) {
  35344. if ($row instanceof TableSeparator) {
  35345. $this->renderRowSeparator();
  35346. } else {
  35347. $this->renderRow($row, $this->style->getCellRowFormat());
  35348. }
  35349. }
  35350. if (!empty($rows)) {
  35351. $this->renderRowSeparator();
  35352. }
  35353. $this->cleanup();
  35354. }
  35355. private function renderRowSeparator()
  35356. {
  35357. if (0 === $count = $this->numberOfColumns) {
  35358. return;
  35359. }
  35360. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  35361. return;
  35362. }
  35363. $markup = $this->style->getCrossingChar();
  35364. for ($column = 0; $column < $count; ++$column) {
  35365. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  35366. }
  35367. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  35368. }
  35369. private function renderColumnSeparator()
  35370. {
  35371. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  35372. }
  35373. private function renderRow(array $row, $cellFormat)
  35374. {
  35375. if (empty($row)) {
  35376. return;
  35377. }
  35378. $rowContent = $this->renderColumnSeparator();
  35379. foreach ($this->getRowColumns($row) as $column) {
  35380. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  35381. $rowContent .= $this->renderColumnSeparator();
  35382. }
  35383. $this->output->writeln($rowContent);
  35384. }
  35385. private function renderCell(array $row, $column, $cellFormat)
  35386. {
  35387. $cell = isset($row[$column]) ? $row[$column] : '';
  35388. $width = $this->columnWidths[$column];
  35389. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35390. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  35391. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  35392. }
  35393. }
  35394. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  35395. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  35396. }
  35397. $style = $this->getColumnStyle($column);
  35398. if ($cell instanceof TableSeparator) {
  35399. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  35400. }
  35401. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35402. $content = sprintf($style->getCellRowContentFormat(), $cell);
  35403. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  35404. }
  35405. private function calculateNumberOfColumns()
  35406. {
  35407. if (null !== $this->numberOfColumns) {
  35408. return;
  35409. }
  35410. $columns = array(0);
  35411. foreach (array_merge($this->headers, $this->rows) as $row) {
  35412. if ($row instanceof TableSeparator) {
  35413. continue;
  35414. }
  35415. $columns[] = $this->getNumberOfColumns($row);
  35416. }
  35417. $this->numberOfColumns = max($columns);
  35418. }
  35419. private function buildTableRows($rows)
  35420. {
  35421. $unmergedRows = array();
  35422. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  35423. $rows = $this->fillNextRows($rows, $rowKey);
  35424. foreach ($rows[$rowKey] as $column => $cell) {
  35425. if (!strstr($cell, "\n")) {
  35426. continue;
  35427. }
  35428. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35429. foreach ($lines as $lineKey => $line) {
  35430. if ($cell instanceof TableCell) {
  35431. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35432. }
  35433. if (0 === $lineKey) {
  35434. $rows[$rowKey][$column] = $line;
  35435. } else {
  35436. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35437. }
  35438. }
  35439. }
  35440. }
  35441. $tableRows = array();
  35442. foreach ($rows as $rowKey => $row) {
  35443. $tableRows[] = $this->fillCells($row);
  35444. if (isset($unmergedRows[$rowKey])) {
  35445. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  35446. }
  35447. }
  35448. return $tableRows;
  35449. }
  35450. private function fillNextRows(array $rows, $line)
  35451. {
  35452. $unmergedRows = array();
  35453. foreach ($rows[$line] as $column => $cell) {
  35454. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  35455. $nbLines = $cell->getRowspan() - 1;
  35456. $lines = array($cell);
  35457. if (strstr($cell, "\n")) {
  35458. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35459. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  35460. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  35461. unset($lines[0]);
  35462. }
  35463. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  35464. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35465. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  35466. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  35467. if ($nbLines === $unmergedRowKey - $line) {
  35468. break;
  35469. }
  35470. }
  35471. }
  35472. }
  35473. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35474. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  35475. foreach ($unmergedRow as $cellKey => $cell) {
  35476. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  35477. }
  35478. } else {
  35479. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  35480. foreach ($unmergedRow as $column => $cell) {
  35481. if (!empty($cell)) {
  35482. $row[$column] = $unmergedRow[$column];
  35483. }
  35484. }
  35485. array_splice($rows, $unmergedRowKey, 0, array($row));
  35486. }
  35487. }
  35488. return $rows;
  35489. }
  35490. private function fillCells($row)
  35491. {
  35492. $newRow = array();
  35493. foreach ($row as $column => $cell) {
  35494. $newRow[] = $cell;
  35495. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35496. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  35497. $newRow[] = '';
  35498. }
  35499. }
  35500. }
  35501. return $newRow ?: $row;
  35502. }
  35503. private function copyRow(array $rows, $line)
  35504. {
  35505. $row = $rows[$line];
  35506. foreach ($row as $cellKey => $cellValue) {
  35507. $row[$cellKey] = '';
  35508. if ($cellValue instanceof TableCell) {
  35509. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  35510. }
  35511. }
  35512. return $row;
  35513. }
  35514. private function getNumberOfColumns(array $row)
  35515. {
  35516. $columns = \count($row);
  35517. foreach ($row as $column) {
  35518. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  35519. }
  35520. return $columns;
  35521. }
  35522. private function getRowColumns(array $row)
  35523. {
  35524. $columns = range(0, $this->numberOfColumns - 1);
  35525. foreach ($row as $cellKey => $cell) {
  35526. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35527. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  35528. }
  35529. }
  35530. return $columns;
  35531. }
  35532. private function calculateColumnsWidth($rows)
  35533. {
  35534. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  35535. $lengths = array();
  35536. foreach ($rows as $row) {
  35537. if ($row instanceof TableSeparator) {
  35538. continue;
  35539. }
  35540. foreach ($row as $i => $cell) {
  35541. if ($cell instanceof TableCell) {
  35542. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  35543. $textLength = Helper::strlen($textContent);
  35544. if ($textLength > 0) {
  35545. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  35546. foreach ($contentColumns as $position => $content) {
  35547. $row[$i + $position] = $content;
  35548. }
  35549. }
  35550. }
  35551. }
  35552. $lengths[] = $this->getCellWidth($row, $column);
  35553. }
  35554. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  35555. }
  35556. }
  35557. private function getColumnSeparatorWidth()
  35558. {
  35559. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  35560. }
  35561. private function getCellWidth(array $row, $column)
  35562. {
  35563. if (isset($row[$column])) {
  35564. $cell = $row[$column];
  35565. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35566. return $cellWidth;
  35567. }
  35568. return 0;
  35569. }
  35570. private function cleanup()
  35571. {
  35572. $this->columnWidths = array();
  35573. $this->numberOfColumns = null;
  35574. }
  35575. private static function initStyles()
  35576. {
  35577. $borderless = new TableStyle();
  35578. $borderless
  35579. ->setHorizontalBorderChar('=')
  35580. ->setVerticalBorderChar(' ')
  35581. ->setCrossingChar(' ')
  35582. ;
  35583. $compact = new TableStyle();
  35584. $compact
  35585. ->setHorizontalBorderChar('')
  35586. ->setVerticalBorderChar(' ')
  35587. ->setCrossingChar('')
  35588. ->setCellRowContentFormat('%s')
  35589. ;
  35590. $styleGuide = new TableStyle();
  35591. $styleGuide
  35592. ->setHorizontalBorderChar('-')
  35593. ->setVerticalBorderChar(' ')
  35594. ->setCrossingChar(' ')
  35595. ->setCellHeaderFormat('%s')
  35596. ;
  35597. return array(
  35598. 'default' => new TableStyle(),
  35599. 'borderless' => $borderless,
  35600. 'compact' => $compact,
  35601. 'symfony-style-guide' => $styleGuide,
  35602. );
  35603. }
  35604. private function resolveStyle($name)
  35605. {
  35606. if ($name instanceof TableStyle) {
  35607. return $name;
  35608. }
  35609. if (isset(self::$styles[$name])) {
  35610. return self::$styles[$name];
  35611. }
  35612. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35613. }
  35614. }
  35615. <?php
  35616. namespace Symfony\Component\Console\Helper;
  35617. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35618. class TableCell
  35619. {
  35620. private $value;
  35621. private $options = array(
  35622. 'rowspan' => 1,
  35623. 'colspan' => 1,
  35624. );
  35625. public function __construct($value = '', array $options = array())
  35626. {
  35627. if (is_numeric($value) && !\is_string($value)) {
  35628. $value = (string) $value;
  35629. }
  35630. $this->value = $value;
  35631. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  35632. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  35633. }
  35634. $this->options = array_merge($this->options, $options);
  35635. }
  35636. public function __toString()
  35637. {
  35638. return $this->value;
  35639. }
  35640. public function getColspan()
  35641. {
  35642. return (int) $this->options['colspan'];
  35643. }
  35644. public function getRowspan()
  35645. {
  35646. return (int) $this->options['rowspan'];
  35647. }
  35648. }
  35649. <?php
  35650. namespace Symfony\Component\Console\Helper;
  35651. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35652. use Symfony\Component\Console\Output\NullOutput;
  35653. use Symfony\Component\Console\Output\OutputInterface;
  35654. class TableHelper extends Helper
  35655. {
  35656. const LAYOUT_DEFAULT = 0;
  35657. const LAYOUT_BORDERLESS = 1;
  35658. const LAYOUT_COMPACT = 2;
  35659. private $table;
  35660. public function __construct($triggerDeprecationError = true)
  35661. {
  35662. if ($triggerDeprecationError) {
  35663. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  35664. }
  35665. $this->table = new Table(new NullOutput());
  35666. }
  35667. public function setLayout($layout)
  35668. {
  35669. switch ($layout) {
  35670. case self::LAYOUT_BORDERLESS:
  35671. $this->table->setStyle('borderless');
  35672. break;
  35673. case self::LAYOUT_COMPACT:
  35674. $this->table->setStyle('compact');
  35675. break;
  35676. case self::LAYOUT_DEFAULT:
  35677. $this->table->setStyle('default');
  35678. break;
  35679. default:
  35680. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  35681. }
  35682. return $this;
  35683. }
  35684. public function setHeaders(array $headers)
  35685. {
  35686. $this->table->setHeaders($headers);
  35687. return $this;
  35688. }
  35689. public function setRows(array $rows)
  35690. {
  35691. $this->table->setRows($rows);
  35692. return $this;
  35693. }
  35694. public function addRows(array $rows)
  35695. {
  35696. $this->table->addRows($rows);
  35697. return $this;
  35698. }
  35699. public function addRow(array $row)
  35700. {
  35701. $this->table->addRow($row);
  35702. return $this;
  35703. }
  35704. public function setRow($column, array $row)
  35705. {
  35706. $this->table->setRow($column, $row);
  35707. return $this;
  35708. }
  35709. public function setPaddingChar($paddingChar)
  35710. {
  35711. $this->table->getStyle()->setPaddingChar($paddingChar);
  35712. return $this;
  35713. }
  35714. public function setHorizontalBorderChar($horizontalBorderChar)
  35715. {
  35716. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  35717. return $this;
  35718. }
  35719. public function setVerticalBorderChar($verticalBorderChar)
  35720. {
  35721. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  35722. return $this;
  35723. }
  35724. public function setCrossingChar($crossingChar)
  35725. {
  35726. $this->table->getStyle()->setCrossingChar($crossingChar);
  35727. return $this;
  35728. }
  35729. public function setCellHeaderFormat($cellHeaderFormat)
  35730. {
  35731. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  35732. return $this;
  35733. }
  35734. public function setCellRowFormat($cellRowFormat)
  35735. {
  35736. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  35737. return $this;
  35738. }
  35739. public function setCellRowContentFormat($cellRowContentFormat)
  35740. {
  35741. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  35742. return $this;
  35743. }
  35744. public function setBorderFormat($borderFormat)
  35745. {
  35746. $this->table->getStyle()->setBorderFormat($borderFormat);
  35747. return $this;
  35748. }
  35749. public function setPadType($padType)
  35750. {
  35751. $this->table->getStyle()->setPadType($padType);
  35752. return $this;
  35753. }
  35754. public function render(OutputInterface $output)
  35755. {
  35756. $p = new \ReflectionProperty($this->table, 'output');
  35757. $p->setAccessible(true);
  35758. $p->setValue($this->table, $output);
  35759. $this->table->render();
  35760. }
  35761. public function getName()
  35762. {
  35763. return 'table';
  35764. }
  35765. }
  35766. <?php
  35767. namespace Symfony\Component\Console\Helper;
  35768. class TableSeparator extends TableCell
  35769. {
  35770. public function __construct(array $options = array())
  35771. {
  35772. parent::__construct('', $options);
  35773. }
  35774. }
  35775. <?php
  35776. namespace Symfony\Component\Console\Helper;
  35777. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35778. use Symfony\Component\Console\Exception\LogicException;
  35779. class TableStyle
  35780. {
  35781. private $paddingChar = ' ';
  35782. private $horizontalBorderChar = '-';
  35783. private $verticalBorderChar = '|';
  35784. private $crossingChar = '+';
  35785. private $cellHeaderFormat = '<info>%s</info>';
  35786. private $cellRowFormat = '%s';
  35787. private $cellRowContentFormat = ' %s ';
  35788. private $borderFormat = '%s';
  35789. private $padType = STR_PAD_RIGHT;
  35790. public function setPaddingChar($paddingChar)
  35791. {
  35792. if (!$paddingChar) {
  35793. throw new LogicException('The padding char must not be empty');
  35794. }
  35795. $this->paddingChar = $paddingChar;
  35796. return $this;
  35797. }
  35798. public function getPaddingChar()
  35799. {
  35800. return $this->paddingChar;
  35801. }
  35802. public function setHorizontalBorderChar($horizontalBorderChar)
  35803. {
  35804. $this->horizontalBorderChar = $horizontalBorderChar;
  35805. return $this;
  35806. }
  35807. public function getHorizontalBorderChar()
  35808. {
  35809. return $this->horizontalBorderChar;
  35810. }
  35811. public function setVerticalBorderChar($verticalBorderChar)
  35812. {
  35813. $this->verticalBorderChar = $verticalBorderChar;
  35814. return $this;
  35815. }
  35816. public function getVerticalBorderChar()
  35817. {
  35818. return $this->verticalBorderChar;
  35819. }
  35820. public function setCrossingChar($crossingChar)
  35821. {
  35822. $this->crossingChar = $crossingChar;
  35823. return $this;
  35824. }
  35825. public function getCrossingChar()
  35826. {
  35827. return $this->crossingChar;
  35828. }
  35829. public function setCellHeaderFormat($cellHeaderFormat)
  35830. {
  35831. $this->cellHeaderFormat = $cellHeaderFormat;
  35832. return $this;
  35833. }
  35834. public function getCellHeaderFormat()
  35835. {
  35836. return $this->cellHeaderFormat;
  35837. }
  35838. public function setCellRowFormat($cellRowFormat)
  35839. {
  35840. $this->cellRowFormat = $cellRowFormat;
  35841. return $this;
  35842. }
  35843. public function getCellRowFormat()
  35844. {
  35845. return $this->cellRowFormat;
  35846. }
  35847. public function setCellRowContentFormat($cellRowContentFormat)
  35848. {
  35849. $this->cellRowContentFormat = $cellRowContentFormat;
  35850. return $this;
  35851. }
  35852. public function getCellRowContentFormat()
  35853. {
  35854. return $this->cellRowContentFormat;
  35855. }
  35856. public function setBorderFormat($borderFormat)
  35857. {
  35858. $this->borderFormat = $borderFormat;
  35859. return $this;
  35860. }
  35861. public function getBorderFormat()
  35862. {
  35863. return $this->borderFormat;
  35864. }
  35865. public function setPadType($padType)
  35866. {
  35867. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  35868. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  35869. }
  35870. $this->padType = $padType;
  35871. return $this;
  35872. }
  35873. public function getPadType()
  35874. {
  35875. return $this->padType;
  35876. }
  35877. }
  35878. <?php
  35879. namespace Symfony\Component\Console\Input;
  35880. use Symfony\Component\Console\Exception\RuntimeException;
  35881. class ArgvInput extends Input
  35882. {
  35883. private $tokens;
  35884. private $parsed;
  35885. public function __construct(array $argv = null, InputDefinition $definition = null)
  35886. {
  35887. if (null === $argv) {
  35888. $argv = $_SERVER['argv'];
  35889. }
  35890. array_shift($argv);
  35891. $this->tokens = $argv;
  35892. parent::__construct($definition);
  35893. }
  35894. protected function setTokens(array $tokens)
  35895. {
  35896. $this->tokens = $tokens;
  35897. }
  35898. protected function parse()
  35899. {
  35900. $parseOptions = true;
  35901. $this->parsed = $this->tokens;
  35902. while (null !== $token = array_shift($this->parsed)) {
  35903. if ($parseOptions && '' == $token) {
  35904. $this->parseArgument($token);
  35905. } elseif ($parseOptions && '--' == $token) {
  35906. $parseOptions = false;
  35907. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  35908. $this->parseLongOption($token);
  35909. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  35910. $this->parseShortOption($token);
  35911. } else {
  35912. $this->parseArgument($token);
  35913. }
  35914. }
  35915. }
  35916. private function parseShortOption($token)
  35917. {
  35918. $name = substr($token, 1);
  35919. if (\strlen($name) > 1) {
  35920. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  35921. $this->addShortOption($name[0], substr($name, 1));
  35922. } else {
  35923. $this->parseShortOptionSet($name);
  35924. }
  35925. } else {
  35926. $this->addShortOption($name, null);
  35927. }
  35928. }
  35929. private function parseShortOptionSet($name)
  35930. {
  35931. $len = \strlen($name);
  35932. for ($i = 0; $i < $len; ++$i) {
  35933. if (!$this->definition->hasShortcut($name[$i])) {
  35934. $encoding = mb_detect_encoding($name, null, true);
  35935. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  35936. }
  35937. $option = $this->definition->getOptionForShortcut($name[$i]);
  35938. if ($option->acceptValue()) {
  35939. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  35940. break;
  35941. } else {
  35942. $this->addLongOption($option->getName(), null);
  35943. }
  35944. }
  35945. }
  35946. private function parseLongOption($token)
  35947. {
  35948. $name = substr($token, 2);
  35949. if (false !== $pos = strpos($name, '=')) {
  35950. if (0 === \strlen($value = substr($name, $pos + 1))) {
  35951. array_unshift($this->parsed, null);
  35952. }
  35953. $this->addLongOption(substr($name, 0, $pos), $value);
  35954. } else {
  35955. $this->addLongOption($name, null);
  35956. }
  35957. }
  35958. private function parseArgument($token)
  35959. {
  35960. $c = \count($this->arguments);
  35961. if ($this->definition->hasArgument($c)) {
  35962. $arg = $this->definition->getArgument($c);
  35963. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  35964. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  35965. $arg = $this->definition->getArgument($c - 1);
  35966. $this->arguments[$arg->getName()][] = $token;
  35967. } else {
  35968. $all = $this->definition->getArguments();
  35969. if (\count($all)) {
  35970. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  35971. }
  35972. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  35973. }
  35974. }
  35975. private function addShortOption($shortcut, $value)
  35976. {
  35977. if (!$this->definition->hasShortcut($shortcut)) {
  35978. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35979. }
  35980. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35981. }
  35982. private function addLongOption($name, $value)
  35983. {
  35984. if (!$this->definition->hasOption($name)) {
  35985. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35986. }
  35987. $option = $this->definition->getOption($name);
  35988. if (!isset($value[0])) {
  35989. $value = null;
  35990. }
  35991. if (null !== $value && !$option->acceptValue()) {
  35992. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35993. }
  35994. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  35995. $next = array_shift($this->parsed);
  35996. if (isset($next[0]) && '-' !== $next[0]) {
  35997. $value = $next;
  35998. } elseif (empty($next)) {
  35999. $value = null;
  36000. } else {
  36001. array_unshift($this->parsed, $next);
  36002. }
  36003. }
  36004. if (null === $value) {
  36005. if ($option->isValueRequired()) {
  36006. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  36007. }
  36008. if (!$option->isArray()) {
  36009. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36010. }
  36011. }
  36012. if ($option->isArray()) {
  36013. $this->options[$name][] = $value;
  36014. } else {
  36015. $this->options[$name] = $value;
  36016. }
  36017. }
  36018. public function getFirstArgument()
  36019. {
  36020. foreach ($this->tokens as $token) {
  36021. if ($token && '-' === $token[0]) {
  36022. continue;
  36023. }
  36024. return $token;
  36025. }
  36026. }
  36027. public function hasParameterOption($values)
  36028. {
  36029. $values = (array) $values;
  36030. foreach ($this->tokens as $token) {
  36031. foreach ($values as $value) {
  36032. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36033. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  36034. return true;
  36035. }
  36036. }
  36037. }
  36038. return false;
  36039. }
  36040. public function getParameterOption($values, $default = false)
  36041. {
  36042. $values = (array) $values;
  36043. $tokens = $this->tokens;
  36044. while (0 < \count($tokens)) {
  36045. $token = array_shift($tokens);
  36046. foreach ($values as $value) {
  36047. if ($token === $value) {
  36048. return array_shift($tokens);
  36049. }
  36050. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36051. if ('' !== $leading && 0 === strpos($token, $leading)) {
  36052. return substr($token, \strlen($leading));
  36053. }
  36054. }
  36055. }
  36056. return $default;
  36057. }
  36058. public function __toString()
  36059. {
  36060. $self = $this;
  36061. $tokens = array_map(function ($token) use ($self) {
  36062. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  36063. return $match[1].$self->escapeToken($match[2]);
  36064. }
  36065. if ($token && '-' !== $token[0]) {
  36066. return $self->escapeToken($token);
  36067. }
  36068. return $token;
  36069. }, $this->tokens);
  36070. return implode(' ', $tokens);
  36071. }
  36072. }
  36073. <?php
  36074. namespace Symfony\Component\Console\Input;
  36075. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36076. use Symfony\Component\Console\Exception\InvalidOptionException;
  36077. class ArrayInput extends Input
  36078. {
  36079. private $parameters;
  36080. public function __construct(array $parameters, InputDefinition $definition = null)
  36081. {
  36082. $this->parameters = $parameters;
  36083. parent::__construct($definition);
  36084. }
  36085. public function getFirstArgument()
  36086. {
  36087. foreach ($this->parameters as $key => $value) {
  36088. if ($key && '-' === $key[0]) {
  36089. continue;
  36090. }
  36091. return $value;
  36092. }
  36093. }
  36094. public function hasParameterOption($values)
  36095. {
  36096. $values = (array) $values;
  36097. foreach ($this->parameters as $k => $v) {
  36098. if (!\is_int($k)) {
  36099. $v = $k;
  36100. }
  36101. if (\in_array($v, $values)) {
  36102. return true;
  36103. }
  36104. }
  36105. return false;
  36106. }
  36107. public function getParameterOption($values, $default = false)
  36108. {
  36109. $values = (array) $values;
  36110. foreach ($this->parameters as $k => $v) {
  36111. if (\is_int($k)) {
  36112. if (\in_array($v, $values)) {
  36113. return true;
  36114. }
  36115. } elseif (\in_array($k, $values)) {
  36116. return $v;
  36117. }
  36118. }
  36119. return $default;
  36120. }
  36121. public function __toString()
  36122. {
  36123. $params = array();
  36124. foreach ($this->parameters as $param => $val) {
  36125. if ($param && '-' === $param[0]) {
  36126. if (\is_array($val)) {
  36127. foreach ($val as $v) {
  36128. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  36129. }
  36130. } else {
  36131. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  36132. }
  36133. } else {
  36134. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  36135. }
  36136. }
  36137. return implode(' ', $params);
  36138. }
  36139. protected function parse()
  36140. {
  36141. foreach ($this->parameters as $key => $value) {
  36142. if (0 === strpos($key, '--')) {
  36143. $this->addLongOption(substr($key, 2), $value);
  36144. } elseif ('-' === $key[0]) {
  36145. $this->addShortOption(substr($key, 1), $value);
  36146. } else {
  36147. $this->addArgument($key, $value);
  36148. }
  36149. }
  36150. }
  36151. private function addShortOption($shortcut, $value)
  36152. {
  36153. if (!$this->definition->hasShortcut($shortcut)) {
  36154. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  36155. }
  36156. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36157. }
  36158. private function addLongOption($name, $value)
  36159. {
  36160. if (!$this->definition->hasOption($name)) {
  36161. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  36162. }
  36163. $option = $this->definition->getOption($name);
  36164. if (null === $value) {
  36165. if ($option->isValueRequired()) {
  36166. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  36167. }
  36168. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36169. }
  36170. $this->options[$name] = $value;
  36171. }
  36172. private function addArgument($name, $value)
  36173. {
  36174. if (!$this->definition->hasArgument($name)) {
  36175. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36176. }
  36177. $this->arguments[$name] = $value;
  36178. }
  36179. }
  36180. <?php
  36181. namespace Symfony\Component\Console\Input;
  36182. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36183. use Symfony\Component\Console\Exception\RuntimeException;
  36184. abstract class Input implements InputInterface
  36185. {
  36186. protected $definition;
  36187. protected $options = array();
  36188. protected $arguments = array();
  36189. protected $interactive = true;
  36190. public function __construct(InputDefinition $definition = null)
  36191. {
  36192. if (null === $definition) {
  36193. $this->definition = new InputDefinition();
  36194. } else {
  36195. $this->bind($definition);
  36196. $this->validate();
  36197. }
  36198. }
  36199. public function bind(InputDefinition $definition)
  36200. {
  36201. $this->arguments = array();
  36202. $this->options = array();
  36203. $this->definition = $definition;
  36204. $this->parse();
  36205. }
  36206. abstract protected function parse();
  36207. public function validate()
  36208. {
  36209. $definition = $this->definition;
  36210. $givenArguments = $this->arguments;
  36211. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  36212. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  36213. });
  36214. if (\count($missingArguments) > 0) {
  36215. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  36216. }
  36217. }
  36218. public function isInteractive()
  36219. {
  36220. return $this->interactive;
  36221. }
  36222. public function setInteractive($interactive)
  36223. {
  36224. $this->interactive = (bool) $interactive;
  36225. }
  36226. public function getArguments()
  36227. {
  36228. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  36229. }
  36230. public function getArgument($name)
  36231. {
  36232. if (!$this->definition->hasArgument($name)) {
  36233. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36234. }
  36235. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  36236. }
  36237. public function setArgument($name, $value)
  36238. {
  36239. if (!$this->definition->hasArgument($name)) {
  36240. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36241. }
  36242. $this->arguments[$name] = $value;
  36243. }
  36244. public function hasArgument($name)
  36245. {
  36246. return $this->definition->hasArgument($name);
  36247. }
  36248. public function getOptions()
  36249. {
  36250. return array_merge($this->definition->getOptionDefaults(), $this->options);
  36251. }
  36252. public function getOption($name)
  36253. {
  36254. if (!$this->definition->hasOption($name)) {
  36255. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36256. }
  36257. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  36258. }
  36259. public function setOption($name, $value)
  36260. {
  36261. if (!$this->definition->hasOption($name)) {
  36262. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36263. }
  36264. $this->options[$name] = $value;
  36265. }
  36266. public function hasOption($name)
  36267. {
  36268. return $this->definition->hasOption($name);
  36269. }
  36270. public function escapeToken($token)
  36271. {
  36272. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  36273. }
  36274. }
  36275. <?php
  36276. namespace Symfony\Component\Console\Input;
  36277. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36278. use Symfony\Component\Console\Exception\LogicException;
  36279. class InputArgument
  36280. {
  36281. const REQUIRED = 1;
  36282. const OPTIONAL = 2;
  36283. const IS_ARRAY = 4;
  36284. private $name;
  36285. private $mode;
  36286. private $default;
  36287. private $description;
  36288. public function __construct($name, $mode = null, $description = '', $default = null)
  36289. {
  36290. if (null === $mode) {
  36291. $mode = self::OPTIONAL;
  36292. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  36293. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  36294. }
  36295. $this->name = $name;
  36296. $this->mode = $mode;
  36297. $this->description = $description;
  36298. $this->setDefault($default);
  36299. }
  36300. public function getName()
  36301. {
  36302. return $this->name;
  36303. }
  36304. public function isRequired()
  36305. {
  36306. return self::REQUIRED === (self::REQUIRED & $this->mode);
  36307. }
  36308. public function isArray()
  36309. {
  36310. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  36311. }
  36312. public function setDefault($default = null)
  36313. {
  36314. if (self::REQUIRED === $this->mode && null !== $default) {
  36315. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  36316. }
  36317. if ($this->isArray()) {
  36318. if (null === $default) {
  36319. $default = array();
  36320. } elseif (!\is_array($default)) {
  36321. throw new LogicException('A default value for an array argument must be an array.');
  36322. }
  36323. }
  36324. $this->default = $default;
  36325. }
  36326. public function getDefault()
  36327. {
  36328. return $this->default;
  36329. }
  36330. public function getDescription()
  36331. {
  36332. return $this->description;
  36333. }
  36334. }
  36335. <?php
  36336. namespace Symfony\Component\Console\Input;
  36337. interface InputAwareInterface
  36338. {
  36339. public function setInput(InputInterface $input);
  36340. }
  36341. <?php
  36342. namespace Symfony\Component\Console\Input;
  36343. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36344. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36345. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36346. use Symfony\Component\Console\Exception\LogicException;
  36347. use Symfony\Component\Console\Output\BufferedOutput;
  36348. class InputDefinition
  36349. {
  36350. private $arguments;
  36351. private $requiredCount;
  36352. private $hasAnArrayArgument = false;
  36353. private $hasOptional;
  36354. private $options;
  36355. private $shortcuts;
  36356. public function __construct(array $definition = array())
  36357. {
  36358. $this->setDefinition($definition);
  36359. }
  36360. public function setDefinition(array $definition)
  36361. {
  36362. $arguments = array();
  36363. $options = array();
  36364. foreach ($definition as $item) {
  36365. if ($item instanceof InputOption) {
  36366. $options[] = $item;
  36367. } else {
  36368. $arguments[] = $item;
  36369. }
  36370. }
  36371. $this->setArguments($arguments);
  36372. $this->setOptions($options);
  36373. }
  36374. public function setArguments($arguments = array())
  36375. {
  36376. $this->arguments = array();
  36377. $this->requiredCount = 0;
  36378. $this->hasOptional = false;
  36379. $this->hasAnArrayArgument = false;
  36380. $this->addArguments($arguments);
  36381. }
  36382. public function addArguments($arguments = array())
  36383. {
  36384. if (null !== $arguments) {
  36385. foreach ($arguments as $argument) {
  36386. $this->addArgument($argument);
  36387. }
  36388. }
  36389. }
  36390. public function addArgument(InputArgument $argument)
  36391. {
  36392. if (isset($this->arguments[$argument->getName()])) {
  36393. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  36394. }
  36395. if ($this->hasAnArrayArgument) {
  36396. throw new LogicException('Cannot add an argument after an array argument.');
  36397. }
  36398. if ($argument->isRequired() && $this->hasOptional) {
  36399. throw new LogicException('Cannot add a required argument after an optional one.');
  36400. }
  36401. if ($argument->isArray()) {
  36402. $this->hasAnArrayArgument = true;
  36403. }
  36404. if ($argument->isRequired()) {
  36405. ++$this->requiredCount;
  36406. } else {
  36407. $this->hasOptional = true;
  36408. }
  36409. $this->arguments[$argument->getName()] = $argument;
  36410. }
  36411. public function getArgument($name)
  36412. {
  36413. if (!$this->hasArgument($name)) {
  36414. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36415. }
  36416. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36417. return $arguments[$name];
  36418. }
  36419. public function hasArgument($name)
  36420. {
  36421. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36422. return isset($arguments[$name]);
  36423. }
  36424. public function getArguments()
  36425. {
  36426. return $this->arguments;
  36427. }
  36428. public function getArgumentCount()
  36429. {
  36430. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  36431. }
  36432. public function getArgumentRequiredCount()
  36433. {
  36434. return $this->requiredCount;
  36435. }
  36436. public function getArgumentDefaults()
  36437. {
  36438. $values = array();
  36439. foreach ($this->arguments as $argument) {
  36440. $values[$argument->getName()] = $argument->getDefault();
  36441. }
  36442. return $values;
  36443. }
  36444. public function setOptions($options = array())
  36445. {
  36446. $this->options = array();
  36447. $this->shortcuts = array();
  36448. $this->addOptions($options);
  36449. }
  36450. public function addOptions($options = array())
  36451. {
  36452. foreach ($options as $option) {
  36453. $this->addOption($option);
  36454. }
  36455. }
  36456. public function addOption(InputOption $option)
  36457. {
  36458. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  36459. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  36460. }
  36461. if ($option->getShortcut()) {
  36462. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36463. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  36464. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  36465. }
  36466. }
  36467. }
  36468. $this->options[$option->getName()] = $option;
  36469. if ($option->getShortcut()) {
  36470. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36471. $this->shortcuts[$shortcut] = $option->getName();
  36472. }
  36473. }
  36474. }
  36475. public function getOption($name)
  36476. {
  36477. if (!$this->hasOption($name)) {
  36478. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  36479. }
  36480. return $this->options[$name];
  36481. }
  36482. public function hasOption($name)
  36483. {
  36484. return isset($this->options[$name]);
  36485. }
  36486. public function getOptions()
  36487. {
  36488. return $this->options;
  36489. }
  36490. public function hasShortcut($name)
  36491. {
  36492. return isset($this->shortcuts[$name]);
  36493. }
  36494. public function getOptionForShortcut($shortcut)
  36495. {
  36496. return $this->getOption($this->shortcutToName($shortcut));
  36497. }
  36498. public function getOptionDefaults()
  36499. {
  36500. $values = array();
  36501. foreach ($this->options as $option) {
  36502. $values[$option->getName()] = $option->getDefault();
  36503. }
  36504. return $values;
  36505. }
  36506. private function shortcutToName($shortcut)
  36507. {
  36508. if (!isset($this->shortcuts[$shortcut])) {
  36509. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  36510. }
  36511. return $this->shortcuts[$shortcut];
  36512. }
  36513. public function getSynopsis($short = false)
  36514. {
  36515. $elements = array();
  36516. if ($short && $this->getOptions()) {
  36517. $elements[] = '[options]';
  36518. } elseif (!$short) {
  36519. foreach ($this->getOptions() as $option) {
  36520. $value = '';
  36521. if ($option->acceptValue()) {
  36522. $value = sprintf(
  36523. ' %s%s%s',
  36524. $option->isValueOptional() ? '[' : '',
  36525. strtoupper($option->getName()),
  36526. $option->isValueOptional() ? ']' : ''
  36527. );
  36528. }
  36529. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  36530. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  36531. }
  36532. }
  36533. if (\count($elements) && $this->getArguments()) {
  36534. $elements[] = '[--]';
  36535. }
  36536. foreach ($this->getArguments() as $argument) {
  36537. $element = '<'.$argument->getName().'>';
  36538. if (!$argument->isRequired()) {
  36539. $element = '['.$element.']';
  36540. } elseif ($argument->isArray()) {
  36541. $element .= ' ('.$element.')';
  36542. }
  36543. if ($argument->isArray()) {
  36544. $element .= '...';
  36545. }
  36546. $elements[] = $element;
  36547. }
  36548. return implode(' ', $elements);
  36549. }
  36550. public function asText()
  36551. {
  36552. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36553. $descriptor = new TextDescriptor();
  36554. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  36555. $descriptor->describe($output, $this, array('raw_output' => true));
  36556. return $output->fetch();
  36557. }
  36558. public function asXml($asDom = false)
  36559. {
  36560. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36561. $descriptor = new XmlDescriptor();
  36562. if ($asDom) {
  36563. return $descriptor->getInputDefinitionDocument($this);
  36564. }
  36565. $output = new BufferedOutput();
  36566. $descriptor->describe($output, $this);
  36567. return $output->fetch();
  36568. }
  36569. }
  36570. <?php
  36571. namespace Symfony\Component\Console\Input;
  36572. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36573. use Symfony\Component\Console\Exception\RuntimeException;
  36574. interface InputInterface
  36575. {
  36576. public function getFirstArgument();
  36577. public function hasParameterOption($values);
  36578. public function getParameterOption($values, $default = false);
  36579. public function bind(InputDefinition $definition);
  36580. public function validate();
  36581. public function getArguments();
  36582. public function getArgument($name);
  36583. public function setArgument($name, $value);
  36584. public function hasArgument($name);
  36585. public function getOptions();
  36586. public function getOption($name);
  36587. public function setOption($name, $value);
  36588. public function hasOption($name);
  36589. public function isInteractive();
  36590. public function setInteractive($interactive);
  36591. }
  36592. <?php
  36593. namespace Symfony\Component\Console\Input;
  36594. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36595. use Symfony\Component\Console\Exception\LogicException;
  36596. class InputOption
  36597. {
  36598. const VALUE_NONE = 1;
  36599. const VALUE_REQUIRED = 2;
  36600. const VALUE_OPTIONAL = 4;
  36601. const VALUE_IS_ARRAY = 8;
  36602. private $name;
  36603. private $shortcut;
  36604. private $mode;
  36605. private $default;
  36606. private $description;
  36607. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  36608. {
  36609. if (0 === strpos($name, '--')) {
  36610. $name = substr($name, 2);
  36611. }
  36612. if (empty($name)) {
  36613. throw new InvalidArgumentException('An option name cannot be empty.');
  36614. }
  36615. if (empty($shortcut)) {
  36616. $shortcut = null;
  36617. }
  36618. if (null !== $shortcut) {
  36619. if (\is_array($shortcut)) {
  36620. $shortcut = implode('|', $shortcut);
  36621. }
  36622. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  36623. $shortcuts = array_filter($shortcuts);
  36624. $shortcut = implode('|', $shortcuts);
  36625. if (empty($shortcut)) {
  36626. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  36627. }
  36628. }
  36629. if (null === $mode) {
  36630. $mode = self::VALUE_NONE;
  36631. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  36632. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  36633. }
  36634. $this->name = $name;
  36635. $this->shortcut = $shortcut;
  36636. $this->mode = $mode;
  36637. $this->description = $description;
  36638. if ($this->isArray() && !$this->acceptValue()) {
  36639. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  36640. }
  36641. $this->setDefault($default);
  36642. }
  36643. public function getShortcut()
  36644. {
  36645. return $this->shortcut;
  36646. }
  36647. public function getName()
  36648. {
  36649. return $this->name;
  36650. }
  36651. public function acceptValue()
  36652. {
  36653. return $this->isValueRequired() || $this->isValueOptional();
  36654. }
  36655. public function isValueRequired()
  36656. {
  36657. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  36658. }
  36659. public function isValueOptional()
  36660. {
  36661. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  36662. }
  36663. public function isArray()
  36664. {
  36665. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  36666. }
  36667. public function setDefault($default = null)
  36668. {
  36669. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  36670. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  36671. }
  36672. if ($this->isArray()) {
  36673. if (null === $default) {
  36674. $default = array();
  36675. } elseif (!\is_array($default)) {
  36676. throw new LogicException('A default value for an array option must be an array.');
  36677. }
  36678. }
  36679. $this->default = $this->acceptValue() ? $default : false;
  36680. }
  36681. public function getDefault()
  36682. {
  36683. return $this->default;
  36684. }
  36685. public function getDescription()
  36686. {
  36687. return $this->description;
  36688. }
  36689. public function equals(self $option)
  36690. {
  36691. return $option->getName() === $this->getName()
  36692. && $option->getShortcut() === $this->getShortcut()
  36693. && $option->getDefault() === $this->getDefault()
  36694. && $option->isArray() === $this->isArray()
  36695. && $option->isValueRequired() === $this->isValueRequired()
  36696. && $option->isValueOptional() === $this->isValueOptional()
  36697. ;
  36698. }
  36699. }
  36700. <?php
  36701. namespace Symfony\Component\Console\Input;
  36702. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36703. class StringInput extends ArgvInput
  36704. {
  36705. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  36706. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  36707. public function __construct($input, InputDefinition $definition = null)
  36708. {
  36709. if ($definition) {
  36710. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  36711. }
  36712. parent::__construct(array(), null);
  36713. $this->setTokens($this->tokenize($input));
  36714. if (null !== $definition) {
  36715. $this->bind($definition);
  36716. }
  36717. }
  36718. private function tokenize($input)
  36719. {
  36720. $tokens = array();
  36721. $length = \strlen($input);
  36722. $cursor = 0;
  36723. while ($cursor < $length) {
  36724. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  36725. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  36726. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  36727. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  36728. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  36729. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  36730. $tokens[] = stripcslashes($match[1]);
  36731. } else {
  36732. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  36733. }
  36734. $cursor += \strlen($match[0]);
  36735. }
  36736. return $tokens;
  36737. }
  36738. }
  36739. Copyright (c) 2004-2018 Fabien Potencier
  36740. Permission is hereby granted, free of charge, to any person obtaining a copy
  36741. of this software and associated documentation files (the "Software"), to deal
  36742. in the Software without restriction, including without limitation the rights
  36743. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36744. copies of the Software, and to permit persons to whom the Software is furnished
  36745. to do so, subject to the following conditions:
  36746. The above copyright notice and this permission notice shall be included in all
  36747. copies or substantial portions of the Software.
  36748. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36749. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36750. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36751. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36752. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36753. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36754. THE SOFTWARE.
  36755. <?php
  36756. namespace Symfony\Component\Console\Logger;
  36757. use Psr\Log\AbstractLogger;
  36758. use Psr\Log\InvalidArgumentException;
  36759. use Psr\Log\LogLevel;
  36760. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36761. use Symfony\Component\Console\Output\OutputInterface;
  36762. class ConsoleLogger extends AbstractLogger
  36763. {
  36764. const INFO = 'info';
  36765. const ERROR = 'error';
  36766. private $output;
  36767. private $verbosityLevelMap = array(
  36768. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  36769. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  36770. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  36771. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  36772. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  36773. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  36774. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  36775. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  36776. );
  36777. private $formatLevelMap = array(
  36778. LogLevel::EMERGENCY => self::ERROR,
  36779. LogLevel::ALERT => self::ERROR,
  36780. LogLevel::CRITICAL => self::ERROR,
  36781. LogLevel::ERROR => self::ERROR,
  36782. LogLevel::WARNING => self::INFO,
  36783. LogLevel::NOTICE => self::INFO,
  36784. LogLevel::INFO => self::INFO,
  36785. LogLevel::DEBUG => self::INFO,
  36786. );
  36787. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  36788. {
  36789. $this->output = $output;
  36790. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  36791. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  36792. }
  36793. public function log($level, $message, array $context = array())
  36794. {
  36795. if (!isset($this->verbosityLevelMap[$level])) {
  36796. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  36797. }
  36798. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  36799. $output = $this->output->getErrorOutput();
  36800. } else {
  36801. $output = $this->output;
  36802. }
  36803. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  36804. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  36805. }
  36806. }
  36807. private function interpolate($message, array $context)
  36808. {
  36809. $replace = array();
  36810. foreach ($context as $key => $val) {
  36811. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  36812. $replace[sprintf('{%s}', $key)] = $val;
  36813. }
  36814. }
  36815. return strtr($message, $replace);
  36816. }
  36817. }
  36818. <?php
  36819. namespace Symfony\Component\Console\Output;
  36820. class BufferedOutput extends Output
  36821. {
  36822. private $buffer = '';
  36823. public function fetch()
  36824. {
  36825. $content = $this->buffer;
  36826. $this->buffer = '';
  36827. return $content;
  36828. }
  36829. protected function doWrite($message, $newline)
  36830. {
  36831. $this->buffer .= $message;
  36832. if ($newline) {
  36833. $this->buffer .= PHP_EOL;
  36834. }
  36835. }
  36836. }
  36837. <?php
  36838. namespace Symfony\Component\Console\Output;
  36839. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36840. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  36841. {
  36842. private $stderr;
  36843. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36844. {
  36845. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  36846. $actualDecorated = $this->isDecorated();
  36847. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  36848. if (null === $decorated) {
  36849. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  36850. }
  36851. }
  36852. public function setDecorated($decorated)
  36853. {
  36854. parent::setDecorated($decorated);
  36855. $this->stderr->setDecorated($decorated);
  36856. }
  36857. public function setFormatter(OutputFormatterInterface $formatter)
  36858. {
  36859. parent::setFormatter($formatter);
  36860. $this->stderr->setFormatter($formatter);
  36861. }
  36862. public function setVerbosity($level)
  36863. {
  36864. parent::setVerbosity($level);
  36865. $this->stderr->setVerbosity($level);
  36866. }
  36867. public function getErrorOutput()
  36868. {
  36869. return $this->stderr;
  36870. }
  36871. public function setErrorOutput(OutputInterface $error)
  36872. {
  36873. $this->stderr = $error;
  36874. }
  36875. protected function hasStdoutSupport()
  36876. {
  36877. return false === $this->isRunningOS400();
  36878. }
  36879. protected function hasStderrSupport()
  36880. {
  36881. return false === $this->isRunningOS400();
  36882. }
  36883. private function isRunningOS400()
  36884. {
  36885. $checks = array(
  36886. \function_exists('php_uname') ? php_uname('s') : '',
  36887. getenv('OSTYPE'),
  36888. PHP_OS,
  36889. );
  36890. return false !== stripos(implode(';', $checks), 'OS400');
  36891. }
  36892. private function openOutputStream()
  36893. {
  36894. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  36895. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  36896. }
  36897. private function openErrorStream()
  36898. {
  36899. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  36900. return fopen($errorStream, 'w');
  36901. }
  36902. }
  36903. <?php
  36904. namespace Symfony\Component\Console\Output;
  36905. interface ConsoleOutputInterface extends OutputInterface
  36906. {
  36907. public function getErrorOutput();
  36908. public function setErrorOutput(OutputInterface $error);
  36909. }
  36910. <?php
  36911. namespace Symfony\Component\Console\Output;
  36912. use Symfony\Component\Console\Formatter\OutputFormatter;
  36913. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36914. class NullOutput implements OutputInterface
  36915. {
  36916. public function setFormatter(OutputFormatterInterface $formatter)
  36917. {
  36918. }
  36919. public function getFormatter()
  36920. {
  36921. return new OutputFormatter();
  36922. }
  36923. public function setDecorated($decorated)
  36924. {
  36925. }
  36926. public function isDecorated()
  36927. {
  36928. return false;
  36929. }
  36930. public function setVerbosity($level)
  36931. {
  36932. }
  36933. public function getVerbosity()
  36934. {
  36935. return self::VERBOSITY_QUIET;
  36936. }
  36937. public function isQuiet()
  36938. {
  36939. return true;
  36940. }
  36941. public function isVerbose()
  36942. {
  36943. return false;
  36944. }
  36945. public function isVeryVerbose()
  36946. {
  36947. return false;
  36948. }
  36949. public function isDebug()
  36950. {
  36951. return false;
  36952. }
  36953. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36954. {
  36955. }
  36956. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36957. {
  36958. }
  36959. }
  36960. <?php
  36961. namespace Symfony\Component\Console\Output;
  36962. use Symfony\Component\Console\Formatter\OutputFormatter;
  36963. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36964. abstract class Output implements OutputInterface
  36965. {
  36966. private $verbosity;
  36967. private $formatter;
  36968. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  36969. {
  36970. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36971. $this->formatter = $formatter ?: new OutputFormatter();
  36972. $this->formatter->setDecorated($decorated);
  36973. }
  36974. public function setFormatter(OutputFormatterInterface $formatter)
  36975. {
  36976. $this->formatter = $formatter;
  36977. }
  36978. public function getFormatter()
  36979. {
  36980. return $this->formatter;
  36981. }
  36982. public function setDecorated($decorated)
  36983. {
  36984. $this->formatter->setDecorated($decorated);
  36985. }
  36986. public function isDecorated()
  36987. {
  36988. return $this->formatter->isDecorated();
  36989. }
  36990. public function setVerbosity($level)
  36991. {
  36992. $this->verbosity = (int) $level;
  36993. }
  36994. public function getVerbosity()
  36995. {
  36996. return $this->verbosity;
  36997. }
  36998. public function isQuiet()
  36999. {
  37000. return self::VERBOSITY_QUIET === $this->verbosity;
  37001. }
  37002. public function isVerbose()
  37003. {
  37004. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  37005. }
  37006. public function isVeryVerbose()
  37007. {
  37008. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  37009. }
  37010. public function isDebug()
  37011. {
  37012. return self::VERBOSITY_DEBUG <= $this->verbosity;
  37013. }
  37014. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37015. {
  37016. $this->write($messages, true, $options);
  37017. }
  37018. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37019. {
  37020. $messages = (array) $messages;
  37021. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  37022. $type = $types & $options ?: self::OUTPUT_NORMAL;
  37023. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  37024. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  37025. if ($verbosity > $this->getVerbosity()) {
  37026. return;
  37027. }
  37028. foreach ($messages as $message) {
  37029. switch ($type) {
  37030. case OutputInterface::OUTPUT_NORMAL:
  37031. $message = $this->formatter->format($message);
  37032. break;
  37033. case OutputInterface::OUTPUT_RAW:
  37034. break;
  37035. case OutputInterface::OUTPUT_PLAIN:
  37036. $message = strip_tags($this->formatter->format($message));
  37037. break;
  37038. }
  37039. $this->doWrite($message, $newline);
  37040. }
  37041. }
  37042. abstract protected function doWrite($message, $newline);
  37043. }
  37044. <?php
  37045. namespace Symfony\Component\Console\Output;
  37046. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37047. interface OutputInterface
  37048. {
  37049. const VERBOSITY_QUIET = 16;
  37050. const VERBOSITY_NORMAL = 32;
  37051. const VERBOSITY_VERBOSE = 64;
  37052. const VERBOSITY_VERY_VERBOSE = 128;
  37053. const VERBOSITY_DEBUG = 256;
  37054. const OUTPUT_NORMAL = 1;
  37055. const OUTPUT_RAW = 2;
  37056. const OUTPUT_PLAIN = 4;
  37057. public function write($messages, $newline = false, $options = 0);
  37058. public function writeln($messages, $options = 0);
  37059. public function setVerbosity($level);
  37060. public function getVerbosity();
  37061. public function setDecorated($decorated);
  37062. public function isDecorated();
  37063. public function setFormatter(OutputFormatterInterface $formatter);
  37064. public function getFormatter();
  37065. }
  37066. <?php
  37067. namespace Symfony\Component\Console\Output;
  37068. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37069. use Symfony\Component\Console\Exception\RuntimeException;
  37070. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37071. class StreamOutput extends Output
  37072. {
  37073. private $stream;
  37074. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37075. {
  37076. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  37077. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  37078. }
  37079. $this->stream = $stream;
  37080. if (null === $decorated) {
  37081. $decorated = $this->hasColorSupport();
  37082. }
  37083. parent::__construct($verbosity, $decorated, $formatter);
  37084. }
  37085. public function getStream()
  37086. {
  37087. return $this->stream;
  37088. }
  37089. protected function doWrite($message, $newline)
  37090. {
  37091. if ($newline) {
  37092. $message .= PHP_EOL;
  37093. }
  37094. if (false === @fwrite($this->stream, $message)) {
  37095. throw new RuntimeException('Unable to write output.');
  37096. }
  37097. fflush($this->stream);
  37098. }
  37099. protected function hasColorSupport()
  37100. {
  37101. if ('Hyper' === getenv('TERM_PROGRAM')) {
  37102. return true;
  37103. }
  37104. if (\DIRECTORY_SEPARATOR === '\\') {
  37105. return (\function_exists('sapi_windows_vt100_support')
  37106. && @sapi_windows_vt100_support($this->stream))
  37107. || false !== getenv('ANSICON')
  37108. || 'ON' === getenv('ConEmuANSI')
  37109. || 'xterm' === getenv('TERM');
  37110. }
  37111. if (\function_exists('stream_isatty')) {
  37112. return @stream_isatty($this->stream);
  37113. }
  37114. if (\function_exists('posix_isatty')) {
  37115. return @posix_isatty($this->stream);
  37116. }
  37117. $stat = @fstat($this->stream);
  37118. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  37119. }
  37120. }
  37121. <?php
  37122. namespace Symfony\Component\Console\Question;
  37123. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37124. class ChoiceQuestion extends Question
  37125. {
  37126. private $choices;
  37127. private $multiselect = false;
  37128. private $prompt = ' > ';
  37129. private $errorMessage = 'Value "%s" is invalid';
  37130. public function __construct($question, array $choices, $default = null)
  37131. {
  37132. if (!$choices) {
  37133. throw new \LogicException('Choice question must have at least 1 choice available.');
  37134. }
  37135. parent::__construct($question, $default);
  37136. $this->choices = $choices;
  37137. $this->setValidator($this->getDefaultValidator());
  37138. $this->setAutocompleterValues($choices);
  37139. }
  37140. public function getChoices()
  37141. {
  37142. return $this->choices;
  37143. }
  37144. public function setMultiselect($multiselect)
  37145. {
  37146. $this->multiselect = $multiselect;
  37147. $this->setValidator($this->getDefaultValidator());
  37148. return $this;
  37149. }
  37150. public function isMultiselect()
  37151. {
  37152. return $this->multiselect;
  37153. }
  37154. public function getPrompt()
  37155. {
  37156. return $this->prompt;
  37157. }
  37158. public function setPrompt($prompt)
  37159. {
  37160. $this->prompt = $prompt;
  37161. return $this;
  37162. }
  37163. public function setErrorMessage($errorMessage)
  37164. {
  37165. $this->errorMessage = $errorMessage;
  37166. $this->setValidator($this->getDefaultValidator());
  37167. return $this;
  37168. }
  37169. private function getDefaultValidator()
  37170. {
  37171. $choices = $this->choices;
  37172. $errorMessage = $this->errorMessage;
  37173. $multiselect = $this->multiselect;
  37174. $isAssoc = $this->isAssoc($choices);
  37175. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  37176. $selectedChoices = str_replace(' ', '', $selected);
  37177. if ($multiselect) {
  37178. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  37179. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  37180. }
  37181. $selectedChoices = explode(',', $selectedChoices);
  37182. } else {
  37183. $selectedChoices = array($selected);
  37184. }
  37185. $multiselectChoices = array();
  37186. foreach ($selectedChoices as $value) {
  37187. $results = array();
  37188. foreach ($choices as $key => $choice) {
  37189. if ($choice === $value) {
  37190. $results[] = $key;
  37191. }
  37192. }
  37193. if (\count($results) > 1) {
  37194. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  37195. }
  37196. $result = array_search($value, $choices);
  37197. if (!$isAssoc) {
  37198. if (false !== $result) {
  37199. $result = $choices[$result];
  37200. } elseif (isset($choices[$value])) {
  37201. $result = $choices[$value];
  37202. }
  37203. } elseif (false === $result && isset($choices[$value])) {
  37204. $result = $value;
  37205. }
  37206. if (false === $result) {
  37207. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  37208. }
  37209. $multiselectChoices[] = (string) $result;
  37210. }
  37211. if ($multiselect) {
  37212. return $multiselectChoices;
  37213. }
  37214. return current($multiselectChoices);
  37215. };
  37216. }
  37217. }
  37218. <?php
  37219. namespace Symfony\Component\Console\Question;
  37220. class ConfirmationQuestion extends Question
  37221. {
  37222. private $trueAnswerRegex;
  37223. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  37224. {
  37225. parent::__construct($question, (bool) $default);
  37226. $this->trueAnswerRegex = $trueAnswerRegex;
  37227. $this->setNormalizer($this->getDefaultNormalizer());
  37228. }
  37229. private function getDefaultNormalizer()
  37230. {
  37231. $default = $this->getDefault();
  37232. $regex = $this->trueAnswerRegex;
  37233. return function ($answer) use ($default, $regex) {
  37234. if (\is_bool($answer)) {
  37235. return $answer;
  37236. }
  37237. $answerIsTrue = (bool) preg_match($regex, $answer);
  37238. if (false === $default) {
  37239. return $answer && $answerIsTrue;
  37240. }
  37241. return !$answer || $answerIsTrue;
  37242. };
  37243. }
  37244. }
  37245. <?php
  37246. namespace Symfony\Component\Console\Question;
  37247. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37248. use Symfony\Component\Console\Exception\LogicException;
  37249. class Question
  37250. {
  37251. private $question;
  37252. private $attempts;
  37253. private $hidden = false;
  37254. private $hiddenFallback = true;
  37255. private $autocompleterValues;
  37256. private $validator;
  37257. private $default;
  37258. private $normalizer;
  37259. public function __construct($question, $default = null)
  37260. {
  37261. $this->question = $question;
  37262. $this->default = $default;
  37263. }
  37264. public function getQuestion()
  37265. {
  37266. return $this->question;
  37267. }
  37268. public function getDefault()
  37269. {
  37270. return $this->default;
  37271. }
  37272. public function isHidden()
  37273. {
  37274. return $this->hidden;
  37275. }
  37276. public function setHidden($hidden)
  37277. {
  37278. if ($this->autocompleterValues) {
  37279. throw new LogicException('A hidden question cannot use the autocompleter.');
  37280. }
  37281. $this->hidden = (bool) $hidden;
  37282. return $this;
  37283. }
  37284. public function isHiddenFallback()
  37285. {
  37286. return $this->hiddenFallback;
  37287. }
  37288. public function setHiddenFallback($fallback)
  37289. {
  37290. $this->hiddenFallback = (bool) $fallback;
  37291. return $this;
  37292. }
  37293. public function getAutocompleterValues()
  37294. {
  37295. return $this->autocompleterValues;
  37296. }
  37297. public function setAutocompleterValues($values)
  37298. {
  37299. if (\is_array($values)) {
  37300. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  37301. }
  37302. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  37303. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  37304. }
  37305. if ($this->hidden) {
  37306. throw new LogicException('A hidden question cannot use the autocompleter.');
  37307. }
  37308. $this->autocompleterValues = $values;
  37309. return $this;
  37310. }
  37311. public function setValidator($validator)
  37312. {
  37313. $this->validator = $validator;
  37314. return $this;
  37315. }
  37316. public function getValidator()
  37317. {
  37318. return $this->validator;
  37319. }
  37320. public function setMaxAttempts($attempts)
  37321. {
  37322. if (null !== $attempts && $attempts < 1) {
  37323. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  37324. }
  37325. $this->attempts = $attempts;
  37326. return $this;
  37327. }
  37328. public function getMaxAttempts()
  37329. {
  37330. return $this->attempts;
  37331. }
  37332. public function setNormalizer($normalizer)
  37333. {
  37334. $this->normalizer = $normalizer;
  37335. return $this;
  37336. }
  37337. public function getNormalizer()
  37338. {
  37339. return $this->normalizer;
  37340. }
  37341. protected function isAssoc($array)
  37342. {
  37343. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  37344. }
  37345. }
  37346. <?php
  37347. namespace Symfony\Component\Console;
  37348. use Symfony\Component\Console\Exception\RuntimeException;
  37349. use Symfony\Component\Console\Input\StringInput;
  37350. use Symfony\Component\Console\Output\ConsoleOutput;
  37351. use Symfony\Component\Process\PhpExecutableFinder;
  37352. use Symfony\Component\Process\ProcessBuilder;
  37353. class Shell
  37354. {
  37355. private $application;
  37356. private $history;
  37357. private $output;
  37358. private $hasReadline;
  37359. private $processIsolation = false;
  37360. public function __construct(Application $application)
  37361. {
  37362. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37363. $this->hasReadline = \function_exists('readline');
  37364. $this->application = $application;
  37365. $this->history = getenv('HOME').'/.history_'.$application->getName();
  37366. $this->output = new ConsoleOutput();
  37367. }
  37368. public function run()
  37369. {
  37370. $this->application->setAutoExit(false);
  37371. $this->application->setCatchExceptions(true);
  37372. if ($this->hasReadline) {
  37373. readline_read_history($this->history);
  37374. readline_completion_function(array($this, 'autocompleter'));
  37375. }
  37376. $this->output->writeln($this->getHeader());
  37377. $php = null;
  37378. if ($this->processIsolation) {
  37379. $finder = new PhpExecutableFinder();
  37380. $php = $finder->find();
  37381. $this->output->writeln(<<<'EOF'
  37382. <info>Running with process isolation, you should consider this:</info>
  37383. * each command is executed as separate process,
  37384. * commands don't support interactivity, all params must be passed explicitly,
  37385. * commands output is not colorized.
  37386. EOF
  37387. );
  37388. }
  37389. while (true) {
  37390. $command = $this->readline();
  37391. if (false === $command) {
  37392. $this->output->writeln("\n");
  37393. break;
  37394. }
  37395. if ($this->hasReadline) {
  37396. readline_add_history($command);
  37397. readline_write_history($this->history);
  37398. }
  37399. if ($this->processIsolation) {
  37400. $pb = new ProcessBuilder();
  37401. $process = $pb
  37402. ->add($php)
  37403. ->add($_SERVER['argv'][0])
  37404. ->add($command)
  37405. ->inheritEnvironmentVariables(true)
  37406. ->getProcess()
  37407. ;
  37408. $output = $this->output;
  37409. $process->run(function ($type, $data) use ($output) {
  37410. $output->writeln($data);
  37411. });
  37412. $ret = $process->getExitCode();
  37413. } else {
  37414. $ret = $this->application->run(new StringInput($command), $this->output);
  37415. }
  37416. if (0 !== $ret) {
  37417. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  37418. }
  37419. }
  37420. }
  37421. protected function getHeader()
  37422. {
  37423. return <<<EOF
  37424. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  37425. At the prompt, type <comment>help</comment> for some help,
  37426. or <comment>list</comment> to get a list of available commands.
  37427. To exit the shell, type <comment>^D</comment>.
  37428. EOF;
  37429. }
  37430. protected function getPrompt()
  37431. {
  37432. return $this->output->getFormatter()->format($this->application->getName().' > ');
  37433. }
  37434. protected function getOutput()
  37435. {
  37436. return $this->output;
  37437. }
  37438. protected function getApplication()
  37439. {
  37440. return $this->application;
  37441. }
  37442. private function autocompleter($text)
  37443. {
  37444. $info = readline_info();
  37445. $text = substr($info['line_buffer'], 0, $info['end']);
  37446. if ($info['point'] !== $info['end']) {
  37447. return true;
  37448. }
  37449. if (false === strpos($text, ' ') || !$text) {
  37450. return array_keys($this->application->all());
  37451. }
  37452. try {
  37453. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  37454. } catch (\Exception $e) {
  37455. return true;
  37456. }
  37457. $list = array('--help');
  37458. foreach ($command->getDefinition()->getOptions() as $option) {
  37459. $list[] = '--'.$option->getName();
  37460. }
  37461. return $list;
  37462. }
  37463. private function readline()
  37464. {
  37465. if ($this->hasReadline) {
  37466. $line = readline($this->getPrompt());
  37467. } else {
  37468. $this->output->write($this->getPrompt());
  37469. $line = fgets(STDIN, 1024);
  37470. $line = (false === $line || '' === $line) ? false : rtrim($line);
  37471. }
  37472. return $line;
  37473. }
  37474. public function getProcessIsolation()
  37475. {
  37476. return $this->processIsolation;
  37477. }
  37478. public function setProcessIsolation($processIsolation)
  37479. {
  37480. $this->processIsolation = (bool) $processIsolation;
  37481. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  37482. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  37483. }
  37484. }
  37485. }
  37486. <?php
  37487. namespace Symfony\Component\Console\Style;
  37488. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37489. use Symfony\Component\Console\Helper\ProgressBar;
  37490. use Symfony\Component\Console\Output\OutputInterface;
  37491. abstract class OutputStyle implements OutputInterface, StyleInterface
  37492. {
  37493. private $output;
  37494. public function __construct(OutputInterface $output)
  37495. {
  37496. $this->output = $output;
  37497. }
  37498. public function newLine($count = 1)
  37499. {
  37500. $this->output->write(str_repeat(PHP_EOL, $count));
  37501. }
  37502. public function createProgressBar($max = 0)
  37503. {
  37504. return new ProgressBar($this->output, $max);
  37505. }
  37506. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37507. {
  37508. $this->output->write($messages, $newline, $type);
  37509. }
  37510. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37511. {
  37512. $this->output->writeln($messages, $type);
  37513. }
  37514. public function setVerbosity($level)
  37515. {
  37516. $this->output->setVerbosity($level);
  37517. }
  37518. public function getVerbosity()
  37519. {
  37520. return $this->output->getVerbosity();
  37521. }
  37522. public function setDecorated($decorated)
  37523. {
  37524. $this->output->setDecorated($decorated);
  37525. }
  37526. public function isDecorated()
  37527. {
  37528. return $this->output->isDecorated();
  37529. }
  37530. public function setFormatter(OutputFormatterInterface $formatter)
  37531. {
  37532. $this->output->setFormatter($formatter);
  37533. }
  37534. public function getFormatter()
  37535. {
  37536. return $this->output->getFormatter();
  37537. }
  37538. }
  37539. <?php
  37540. namespace Symfony\Component\Console\Style;
  37541. interface StyleInterface
  37542. {
  37543. public function title($message);
  37544. public function section($message);
  37545. public function listing(array $elements);
  37546. public function text($message);
  37547. public function success($message);
  37548. public function error($message);
  37549. public function warning($message);
  37550. public function note($message);
  37551. public function caution($message);
  37552. public function table(array $headers, array $rows);
  37553. public function ask($question, $default = null, $validator = null);
  37554. public function askHidden($question, $validator = null);
  37555. public function confirm($question, $default = true);
  37556. public function choice($question, array $choices, $default = null);
  37557. public function newLine($count = 1);
  37558. public function progressStart($max = 0);
  37559. public function progressAdvance($step = 1);
  37560. public function progressFinish();
  37561. }
  37562. <?php
  37563. namespace Symfony\Component\Console\Style;
  37564. use Symfony\Component\Console\Application;
  37565. use Symfony\Component\Console\Exception\RuntimeException;
  37566. use Symfony\Component\Console\Formatter\OutputFormatter;
  37567. use Symfony\Component\Console\Helper\Helper;
  37568. use Symfony\Component\Console\Helper\ProgressBar;
  37569. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  37570. use Symfony\Component\Console\Helper\Table;
  37571. use Symfony\Component\Console\Input\InputInterface;
  37572. use Symfony\Component\Console\Output\BufferedOutput;
  37573. use Symfony\Component\Console\Output\OutputInterface;
  37574. use Symfony\Component\Console\Question\ChoiceQuestion;
  37575. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37576. use Symfony\Component\Console\Question\Question;
  37577. class SymfonyStyle extends OutputStyle
  37578. {
  37579. const MAX_LINE_LENGTH = 120;
  37580. private $input;
  37581. private $questionHelper;
  37582. private $progressBar;
  37583. private $lineLength;
  37584. private $bufferedOutput;
  37585. public function __construct(InputInterface $input, OutputInterface $output)
  37586. {
  37587. $this->input = $input;
  37588. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  37589. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  37590. parent::__construct($output);
  37591. }
  37592. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  37593. {
  37594. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  37595. $this->autoPrependBlock();
  37596. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  37597. $this->newLine();
  37598. }
  37599. public function title($message)
  37600. {
  37601. $this->autoPrependBlock();
  37602. $this->writeln(array(
  37603. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37604. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37605. ));
  37606. $this->newLine();
  37607. }
  37608. public function section($message)
  37609. {
  37610. $this->autoPrependBlock();
  37611. $this->writeln(array(
  37612. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37613. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37614. ));
  37615. $this->newLine();
  37616. }
  37617. public function listing(array $elements)
  37618. {
  37619. $this->autoPrependText();
  37620. $elements = array_map(function ($element) {
  37621. return sprintf(' * %s', $element);
  37622. }, $elements);
  37623. $this->writeln($elements);
  37624. $this->newLine();
  37625. }
  37626. public function text($message)
  37627. {
  37628. $this->autoPrependText();
  37629. $messages = \is_array($message) ? array_values($message) : array($message);
  37630. foreach ($messages as $message) {
  37631. $this->writeln(sprintf(' %s', $message));
  37632. }
  37633. }
  37634. public function comment($message)
  37635. {
  37636. $messages = \is_array($message) ? array_values($message) : array($message);
  37637. $this->autoPrependBlock();
  37638. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  37639. $this->newLine();
  37640. }
  37641. public function success($message)
  37642. {
  37643. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  37644. }
  37645. public function error($message)
  37646. {
  37647. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  37648. }
  37649. public function warning($message)
  37650. {
  37651. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  37652. }
  37653. public function note($message)
  37654. {
  37655. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  37656. }
  37657. public function caution($message)
  37658. {
  37659. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  37660. }
  37661. public function table(array $headers, array $rows)
  37662. {
  37663. $style = clone Table::getStyleDefinition('symfony-style-guide');
  37664. $style->setCellHeaderFormat('<info>%s</info>');
  37665. $table = new Table($this);
  37666. $table->setHeaders($headers);
  37667. $table->setRows($rows);
  37668. $table->setStyle($style);
  37669. $table->render();
  37670. $this->newLine();
  37671. }
  37672. public function ask($question, $default = null, $validator = null)
  37673. {
  37674. $question = new Question($question, $default);
  37675. $question->setValidator($validator);
  37676. return $this->askQuestion($question);
  37677. }
  37678. public function askHidden($question, $validator = null)
  37679. {
  37680. $question = new Question($question);
  37681. $question->setHidden(true);
  37682. $question->setValidator($validator);
  37683. return $this->askQuestion($question);
  37684. }
  37685. public function confirm($question, $default = true)
  37686. {
  37687. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  37688. }
  37689. public function choice($question, array $choices, $default = null)
  37690. {
  37691. if (null !== $default) {
  37692. $values = array_flip($choices);
  37693. $default = $values[$default];
  37694. }
  37695. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  37696. }
  37697. public function progressStart($max = 0)
  37698. {
  37699. $this->progressBar = $this->createProgressBar($max);
  37700. $this->progressBar->start();
  37701. }
  37702. public function progressAdvance($step = 1)
  37703. {
  37704. $this->getProgressBar()->advance($step);
  37705. }
  37706. public function progressFinish()
  37707. {
  37708. $this->getProgressBar()->finish();
  37709. $this->newLine(2);
  37710. $this->progressBar = null;
  37711. }
  37712. public function createProgressBar($max = 0)
  37713. {
  37714. $progressBar = parent::createProgressBar($max);
  37715. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  37716. $progressBar->setEmptyBarCharacter('â–‘');
  37717. $progressBar->setProgressCharacter('');
  37718. $progressBar->setBarCharacter('â–“');
  37719. }
  37720. return $progressBar;
  37721. }
  37722. public function askQuestion(Question $question)
  37723. {
  37724. if ($this->input->isInteractive()) {
  37725. $this->autoPrependBlock();
  37726. }
  37727. if (!$this->questionHelper) {
  37728. $this->questionHelper = new SymfonyQuestionHelper();
  37729. }
  37730. $answer = $this->questionHelper->ask($this->input, $this, $question);
  37731. if ($this->input->isInteractive()) {
  37732. $this->newLine();
  37733. $this->bufferedOutput->write("\n");
  37734. }
  37735. return $answer;
  37736. }
  37737. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37738. {
  37739. parent::writeln($messages, $type);
  37740. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  37741. }
  37742. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37743. {
  37744. parent::write($messages, $newline, $type);
  37745. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  37746. }
  37747. public function newLine($count = 1)
  37748. {
  37749. parent::newLine($count);
  37750. $this->bufferedOutput->write(str_repeat("\n", $count));
  37751. }
  37752. private function getProgressBar()
  37753. {
  37754. if (!$this->progressBar) {
  37755. throw new RuntimeException('The ProgressBar is not started.');
  37756. }
  37757. return $this->progressBar;
  37758. }
  37759. private function getTerminalWidth()
  37760. {
  37761. $application = new Application();
  37762. $dimensions = $application->getTerminalDimensions();
  37763. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  37764. }
  37765. private function autoPrependBlock()
  37766. {
  37767. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  37768. if (!isset($chars[0])) {
  37769. return $this->newLine();
  37770. }
  37771. $this->newLine(2 - substr_count($chars, "\n"));
  37772. }
  37773. private function autoPrependText()
  37774. {
  37775. $fetched = $this->bufferedOutput->fetch();
  37776. if ("\n" !== substr($fetched, -1)) {
  37777. $this->newLine();
  37778. }
  37779. }
  37780. private function reduceBuffer($messages)
  37781. {
  37782. return array_map(function ($value) {
  37783. return substr($value, -4);
  37784. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  37785. }
  37786. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  37787. {
  37788. $indentLength = 0;
  37789. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  37790. $lines = array();
  37791. if (null !== $type) {
  37792. $type = sprintf('[%s] ', $type);
  37793. $indentLength = \strlen($type);
  37794. $lineIndentation = str_repeat(' ', $indentLength);
  37795. }
  37796. foreach ($messages as $key => $message) {
  37797. if ($escape) {
  37798. $message = OutputFormatter::escape($message);
  37799. }
  37800. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  37801. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  37802. $lines[] = '';
  37803. }
  37804. }
  37805. $firstLineIndex = 0;
  37806. if ($padding && $this->isDecorated()) {
  37807. $firstLineIndex = 1;
  37808. array_unshift($lines, '');
  37809. $lines[] = '';
  37810. }
  37811. foreach ($lines as $i => &$line) {
  37812. if (null !== $type) {
  37813. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  37814. }
  37815. $line = $prefix.$line;
  37816. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  37817. if ($style) {
  37818. $line = sprintf('<%s>%s</>', $style, $line);
  37819. }
  37820. }
  37821. return $lines;
  37822. }
  37823. }
  37824. <?php
  37825. namespace Symfony\Component\Console\Tester;
  37826. use Symfony\Component\Console\Application;
  37827. use Symfony\Component\Console\Input\ArrayInput;
  37828. use Symfony\Component\Console\Input\InputInterface;
  37829. use Symfony\Component\Console\Output\OutputInterface;
  37830. use Symfony\Component\Console\Output\StreamOutput;
  37831. class ApplicationTester
  37832. {
  37833. private $application;
  37834. private $input;
  37835. private $output;
  37836. private $statusCode;
  37837. public function __construct(Application $application)
  37838. {
  37839. $this->application = $application;
  37840. }
  37841. public function run(array $input, $options = array())
  37842. {
  37843. $this->input = new ArrayInput($input);
  37844. if (isset($options['interactive'])) {
  37845. $this->input->setInteractive($options['interactive']);
  37846. }
  37847. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37848. if (isset($options['decorated'])) {
  37849. $this->output->setDecorated($options['decorated']);
  37850. }
  37851. if (isset($options['verbosity'])) {
  37852. $this->output->setVerbosity($options['verbosity']);
  37853. }
  37854. return $this->statusCode = $this->application->run($this->input, $this->output);
  37855. }
  37856. public function getDisplay($normalize = false)
  37857. {
  37858. rewind($this->output->getStream());
  37859. $display = stream_get_contents($this->output->getStream());
  37860. if ($normalize) {
  37861. $display = str_replace(PHP_EOL, "\n", $display);
  37862. }
  37863. return $display;
  37864. }
  37865. public function getInput()
  37866. {
  37867. return $this->input;
  37868. }
  37869. public function getOutput()
  37870. {
  37871. return $this->output;
  37872. }
  37873. public function getStatusCode()
  37874. {
  37875. return $this->statusCode;
  37876. }
  37877. }
  37878. <?php
  37879. namespace Symfony\Component\Console\Tester;
  37880. use Symfony\Component\Console\Command\Command;
  37881. use Symfony\Component\Console\Input\ArrayInput;
  37882. use Symfony\Component\Console\Input\InputInterface;
  37883. use Symfony\Component\Console\Output\OutputInterface;
  37884. use Symfony\Component\Console\Output\StreamOutput;
  37885. class CommandTester
  37886. {
  37887. private $command;
  37888. private $input;
  37889. private $output;
  37890. private $statusCode;
  37891. public function __construct(Command $command)
  37892. {
  37893. $this->command = $command;
  37894. }
  37895. public function execute(array $input, array $options = array())
  37896. {
  37897. if (!isset($input['command'])
  37898. && (null !== $application = $this->command->getApplication())
  37899. && $application->getDefinition()->hasArgument('command')
  37900. ) {
  37901. $input = array_merge(array('command' => $this->command->getName()), $input);
  37902. }
  37903. $this->input = new ArrayInput($input);
  37904. if (isset($options['interactive'])) {
  37905. $this->input->setInteractive($options['interactive']);
  37906. }
  37907. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37908. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  37909. if (isset($options['verbosity'])) {
  37910. $this->output->setVerbosity($options['verbosity']);
  37911. }
  37912. return $this->statusCode = $this->command->run($this->input, $this->output);
  37913. }
  37914. public function getDisplay($normalize = false)
  37915. {
  37916. rewind($this->output->getStream());
  37917. $display = stream_get_contents($this->output->getStream());
  37918. if ($normalize) {
  37919. $display = str_replace(PHP_EOL, "\n", $display);
  37920. }
  37921. return $display;
  37922. }
  37923. public function getInput()
  37924. {
  37925. return $this->input;
  37926. }
  37927. public function getOutput()
  37928. {
  37929. return $this->output;
  37930. }
  37931. public function getStatusCode()
  37932. {
  37933. return $this->statusCode;
  37934. }
  37935. }
  37936. <?php
  37937. namespace Symfony\Component\Debug;
  37938. use Psr\Log\AbstractLogger;
  37939. class BufferingLogger extends AbstractLogger
  37940. {
  37941. private $logs = array();
  37942. public function log($level, $message, array $context = array())
  37943. {
  37944. $this->logs[] = array($level, $message, $context);
  37945. }
  37946. public function cleanLogs()
  37947. {
  37948. $logs = $this->logs;
  37949. $this->logs = array();
  37950. return $logs;
  37951. }
  37952. }
  37953. <?php
  37954. namespace Symfony\Component\Debug;
  37955. class Debug
  37956. {
  37957. private static $enabled = false;
  37958. public static function enable($errorReportingLevel = null, $displayErrors = true)
  37959. {
  37960. if (static::$enabled) {
  37961. return;
  37962. }
  37963. static::$enabled = true;
  37964. if (null !== $errorReportingLevel) {
  37965. error_reporting($errorReportingLevel);
  37966. } else {
  37967. error_reporting(-1);
  37968. }
  37969. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  37970. ini_set('display_errors', 0);
  37971. ExceptionHandler::register();
  37972. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  37973. ini_set('display_errors', 1);
  37974. }
  37975. if ($displayErrors) {
  37976. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  37977. } else {
  37978. ErrorHandler::register()->throwAt(0, true);
  37979. }
  37980. DebugClassLoader::enable();
  37981. }
  37982. }
  37983. <?php
  37984. namespace Symfony\Component\Debug;
  37985. class DebugClassLoader
  37986. {
  37987. private $classLoader;
  37988. private $isFinder;
  37989. private $loaded = array();
  37990. private $wasFinder;
  37991. private static $caseCheck;
  37992. private static $deprecated = array();
  37993. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37994. private static $darwinCache = array('/' => array('/', array()));
  37995. public function __construct($classLoader)
  37996. {
  37997. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  37998. if ($this->wasFinder) {
  37999. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  38000. $this->classLoader = array($classLoader, 'loadClass');
  38001. $this->isFinder = true;
  38002. } else {
  38003. $this->classLoader = $classLoader;
  38004. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  38005. }
  38006. if (!isset(self::$caseCheck)) {
  38007. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  38008. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  38009. $dir = substr($file, 0, 1 + $i);
  38010. $file = substr($file, 1 + $i);
  38011. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  38012. $test = realpath($dir.$test);
  38013. if (false === $test || false === $i) {
  38014. self::$caseCheck = 0;
  38015. } elseif (substr($test, -\strlen($file)) === $file) {
  38016. self::$caseCheck = 1;
  38017. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  38018. self::$caseCheck = 2;
  38019. } else {
  38020. self::$caseCheck = 0;
  38021. }
  38022. }
  38023. }
  38024. public function getClassLoader()
  38025. {
  38026. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  38027. }
  38028. public static function enable()
  38029. {
  38030. class_exists('Symfony\Component\Debug\ErrorHandler');
  38031. class_exists('Psr\Log\LogLevel');
  38032. if (!\is_array($functions = spl_autoload_functions())) {
  38033. return;
  38034. }
  38035. foreach ($functions as $function) {
  38036. spl_autoload_unregister($function);
  38037. }
  38038. foreach ($functions as $function) {
  38039. if (!\is_array($function) || !$function[0] instanceof self) {
  38040. $function = array(new static($function), 'loadClass');
  38041. }
  38042. spl_autoload_register($function);
  38043. }
  38044. }
  38045. public static function disable()
  38046. {
  38047. if (!\is_array($functions = spl_autoload_functions())) {
  38048. return;
  38049. }
  38050. foreach ($functions as $function) {
  38051. spl_autoload_unregister($function);
  38052. }
  38053. foreach ($functions as $function) {
  38054. if (\is_array($function) && $function[0] instanceof self) {
  38055. $function = $function[0]->getClassLoader();
  38056. }
  38057. spl_autoload_register($function);
  38058. }
  38059. }
  38060. public function findFile($class)
  38061. {
  38062. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38063. if ($this->wasFinder) {
  38064. return $this->classLoader[0]->findFile($class);
  38065. }
  38066. }
  38067. public function loadClass($class)
  38068. {
  38069. ErrorHandler::stackErrors();
  38070. try {
  38071. if ($this->isFinder && !isset($this->loaded[$class])) {
  38072. $this->loaded[$class] = true;
  38073. if ($file = $this->classLoader[0]->findFile($class)) {
  38074. require $file;
  38075. }
  38076. } else {
  38077. \call_user_func($this->classLoader, $class);
  38078. $file = false;
  38079. }
  38080. } catch (\Exception $e) {
  38081. ErrorHandler::unstackErrors();
  38082. throw $e;
  38083. } catch (\Throwable $e) {
  38084. ErrorHandler::unstackErrors();
  38085. throw $e;
  38086. }
  38087. ErrorHandler::unstackErrors();
  38088. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  38089. if ($class && '\\' === $class[0]) {
  38090. $class = substr($class, 1);
  38091. }
  38092. if ($exists) {
  38093. $refl = new \ReflectionClass($class);
  38094. $name = $refl->getName();
  38095. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  38096. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  38097. }
  38098. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  38099. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  38100. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  38101. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  38102. } else {
  38103. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  38104. $len = 0;
  38105. $ns = '';
  38106. } else {
  38107. $ns = substr($name, 0, $len);
  38108. }
  38109. $parent = get_parent_class($class);
  38110. if (!$parent || strncmp($ns, $parent, $len)) {
  38111. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  38112. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  38113. }
  38114. $parentInterfaces = array();
  38115. $deprecatedInterfaces = array();
  38116. if ($parent) {
  38117. foreach (class_implements($parent) as $interface) {
  38118. $parentInterfaces[$interface] = 1;
  38119. }
  38120. }
  38121. foreach ($refl->getInterfaceNames() as $interface) {
  38122. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  38123. $deprecatedInterfaces[] = $interface;
  38124. }
  38125. foreach (class_implements($interface) as $interface) {
  38126. $parentInterfaces[$interface] = 1;
  38127. }
  38128. }
  38129. foreach ($deprecatedInterfaces as $interface) {
  38130. if (!isset($parentInterfaces[$interface])) {
  38131. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  38132. }
  38133. }
  38134. }
  38135. }
  38136. }
  38137. if ($file) {
  38138. if (!$exists) {
  38139. if (false !== strpos($class, '/')) {
  38140. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  38141. }
  38142. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  38143. }
  38144. if (self::$caseCheck) {
  38145. $real = explode('\\', $class.strrchr($file, '.'));
  38146. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  38147. $i = \count($tail) - 1;
  38148. $j = \count($real) - 1;
  38149. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  38150. --$i;
  38151. --$j;
  38152. }
  38153. array_splice($tail, 0, $i + 1);
  38154. }
  38155. if (self::$caseCheck && $tail) {
  38156. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  38157. $tailLen = \strlen($tail);
  38158. $real = $refl->getFileName();
  38159. if (2 === self::$caseCheck) {
  38160. $i = 1 + strrpos($real, '/');
  38161. $file = substr($real, $i);
  38162. $real = substr($real, 0, $i);
  38163. if (isset(self::$darwinCache[$real])) {
  38164. $kDir = $real;
  38165. } else {
  38166. $kDir = strtolower($real);
  38167. if (isset(self::$darwinCache[$kDir])) {
  38168. $real = self::$darwinCache[$kDir][0];
  38169. } else {
  38170. $dir = getcwd();
  38171. chdir($real);
  38172. $real = getcwd().'/';
  38173. chdir($dir);
  38174. $dir = $real;
  38175. $k = $kDir;
  38176. $i = \strlen($dir) - 1;
  38177. while (!isset(self::$darwinCache[$k])) {
  38178. self::$darwinCache[$k] = array($dir, array());
  38179. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  38180. while ('/' !== $dir[--$i]) {
  38181. }
  38182. $k = substr($k, 0, ++$i);
  38183. $dir = substr($dir, 0, $i--);
  38184. }
  38185. }
  38186. }
  38187. $dirFiles = self::$darwinCache[$kDir][1];
  38188. if (isset($dirFiles[$file])) {
  38189. $kFile = $file;
  38190. } else {
  38191. $kFile = strtolower($file);
  38192. if (!isset($dirFiles[$kFile])) {
  38193. foreach (scandir($real, 2) as $f) {
  38194. if ('.' !== $f[0]) {
  38195. $dirFiles[$f] = $f;
  38196. if ($f === $file) {
  38197. $kFile = $k = $file;
  38198. } elseif ($f !== $k = strtolower($f)) {
  38199. $dirFiles[$k] = $f;
  38200. }
  38201. }
  38202. }
  38203. self::$darwinCache[$kDir][1] = $dirFiles;
  38204. }
  38205. }
  38206. $real .= $dirFiles[$kFile];
  38207. }
  38208. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  38209. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  38210. ) {
  38211. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  38212. }
  38213. }
  38214. return true;
  38215. }
  38216. }
  38217. }
  38218. <?php
  38219. namespace Symfony\Component\Debug;
  38220. use Psr\Log\LoggerInterface;
  38221. use Psr\Log\LogLevel;
  38222. use Symfony\Component\Debug\Exception\ContextErrorException;
  38223. use Symfony\Component\Debug\Exception\FatalErrorException;
  38224. use Symfony\Component\Debug\Exception\FatalThrowableError;
  38225. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38226. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  38227. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  38228. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  38229. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  38230. class ErrorHandler
  38231. {
  38232. const TYPE_DEPRECATION = -100;
  38233. private $levels = array(
  38234. E_DEPRECATED => 'Deprecated',
  38235. E_USER_DEPRECATED => 'User Deprecated',
  38236. E_NOTICE => 'Notice',
  38237. E_USER_NOTICE => 'User Notice',
  38238. E_STRICT => 'Runtime Notice',
  38239. E_WARNING => 'Warning',
  38240. E_USER_WARNING => 'User Warning',
  38241. E_COMPILE_WARNING => 'Compile Warning',
  38242. E_CORE_WARNING => 'Core Warning',
  38243. E_USER_ERROR => 'User Error',
  38244. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  38245. E_COMPILE_ERROR => 'Compile Error',
  38246. E_PARSE => 'Parse Error',
  38247. E_ERROR => 'Error',
  38248. E_CORE_ERROR => 'Core Error',
  38249. );
  38250. private $loggers = array(
  38251. E_DEPRECATED => array(null, LogLevel::INFO),
  38252. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  38253. E_NOTICE => array(null, LogLevel::WARNING),
  38254. E_USER_NOTICE => array(null, LogLevel::WARNING),
  38255. E_STRICT => array(null, LogLevel::WARNING),
  38256. E_WARNING => array(null, LogLevel::WARNING),
  38257. E_USER_WARNING => array(null, LogLevel::WARNING),
  38258. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  38259. E_CORE_WARNING => array(null, LogLevel::WARNING),
  38260. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  38261. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  38262. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  38263. E_PARSE => array(null, LogLevel::CRITICAL),
  38264. E_ERROR => array(null, LogLevel::CRITICAL),
  38265. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  38266. );
  38267. private $thrownErrors = 0x1FFF;
  38268. private $scopedErrors = 0x1FFF;
  38269. private $tracedErrors = 0x77FB;
  38270. private $screamedErrors = 0x55;
  38271. private $loggedErrors = 0;
  38272. private $loggedTraces = array();
  38273. private $isRecursive = 0;
  38274. private $isRoot = false;
  38275. private $exceptionHandler;
  38276. private $bootstrappingLogger;
  38277. private static $reservedMemory;
  38278. private static $stackedErrors = array();
  38279. private static $stackedErrorLevels = array();
  38280. private static $toStringException = null;
  38281. private static $exitCode = 0;
  38282. private $displayErrors = 0x1FFF;
  38283. public static function register($handler = null, $replace = true)
  38284. {
  38285. if (null === self::$reservedMemory) {
  38286. self::$reservedMemory = str_repeat('x', 10240);
  38287. register_shutdown_function(__CLASS__.'::handleFatalError');
  38288. }
  38289. $levels = -1;
  38290. if ($handlerIsNew = !$handler instanceof self) {
  38291. if (null !== $handler) {
  38292. $levels = $replace ? $handler : 0;
  38293. $replace = true;
  38294. }
  38295. $handler = new static();
  38296. }
  38297. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  38298. restore_error_handler();
  38299. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  38300. $handler->isRoot = true;
  38301. }
  38302. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  38303. $handler = $prev[0];
  38304. $replace = false;
  38305. }
  38306. if (!$replace && $prev) {
  38307. restore_error_handler();
  38308. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  38309. } else {
  38310. $handlerIsRegistered = true;
  38311. }
  38312. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  38313. restore_exception_handler();
  38314. if (!$handlerIsRegistered) {
  38315. $handler = $prev[0];
  38316. } elseif ($handler !== $prev[0] && $replace) {
  38317. set_exception_handler(array($handler, 'handleException'));
  38318. $p = $prev[0]->setExceptionHandler(null);
  38319. $handler->setExceptionHandler($p);
  38320. $prev[0]->setExceptionHandler($p);
  38321. }
  38322. } else {
  38323. $handler->setExceptionHandler($prev);
  38324. }
  38325. $handler->throwAt($levels & $handler->thrownErrors, true);
  38326. return $handler;
  38327. }
  38328. public function __construct(BufferingLogger $bootstrappingLogger = null)
  38329. {
  38330. if ($bootstrappingLogger) {
  38331. $this->bootstrappingLogger = $bootstrappingLogger;
  38332. $this->setDefaultLogger($bootstrappingLogger);
  38333. }
  38334. }
  38335. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  38336. {
  38337. $loggers = array();
  38338. if (\is_array($levels)) {
  38339. foreach ($levels as $type => $logLevel) {
  38340. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  38341. $loggers[$type] = array($logger, $logLevel);
  38342. }
  38343. }
  38344. } else {
  38345. if (null === $levels) {
  38346. $levels = E_ALL | E_STRICT;
  38347. }
  38348. foreach ($this->loggers as $type => $log) {
  38349. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  38350. $log[0] = $logger;
  38351. $loggers[$type] = $log;
  38352. }
  38353. }
  38354. }
  38355. $this->setLoggers($loggers);
  38356. }
  38357. public function setLoggers(array $loggers)
  38358. {
  38359. $prevLogged = $this->loggedErrors;
  38360. $prev = $this->loggers;
  38361. $flush = array();
  38362. foreach ($loggers as $type => $log) {
  38363. if (!isset($prev[$type])) {
  38364. throw new \InvalidArgumentException('Unknown error type: '.$type);
  38365. }
  38366. if (!\is_array($log)) {
  38367. $log = array($log);
  38368. } elseif (!array_key_exists(0, $log)) {
  38369. throw new \InvalidArgumentException('No logger provided');
  38370. }
  38371. if (null === $log[0]) {
  38372. $this->loggedErrors &= ~$type;
  38373. } elseif ($log[0] instanceof LoggerInterface) {
  38374. $this->loggedErrors |= $type;
  38375. } else {
  38376. throw new \InvalidArgumentException('Invalid logger provided');
  38377. }
  38378. $this->loggers[$type] = $log + $prev[$type];
  38379. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  38380. $flush[$type] = $type;
  38381. }
  38382. }
  38383. $this->reRegister($prevLogged | $this->thrownErrors);
  38384. if ($flush) {
  38385. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  38386. $type = $log[2]['type'];
  38387. if (!isset($flush[$type])) {
  38388. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  38389. } elseif ($this->loggers[$type][0]) {
  38390. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  38391. }
  38392. }
  38393. }
  38394. return $prev;
  38395. }
  38396. public function setExceptionHandler($handler)
  38397. {
  38398. if (null !== $handler && !\is_callable($handler)) {
  38399. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38400. }
  38401. $prev = $this->exceptionHandler;
  38402. $this->exceptionHandler = $handler;
  38403. return $prev;
  38404. }
  38405. public function throwAt($levels, $replace = false)
  38406. {
  38407. $prev = $this->thrownErrors;
  38408. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  38409. if (!$replace) {
  38410. $this->thrownErrors |= $prev;
  38411. }
  38412. $this->reRegister($prev | $this->loggedErrors);
  38413. $this->displayErrors = $this->thrownErrors;
  38414. return $prev;
  38415. }
  38416. public function scopeAt($levels, $replace = false)
  38417. {
  38418. $prev = $this->scopedErrors;
  38419. $this->scopedErrors = (int) $levels;
  38420. if (!$replace) {
  38421. $this->scopedErrors |= $prev;
  38422. }
  38423. return $prev;
  38424. }
  38425. public function traceAt($levels, $replace = false)
  38426. {
  38427. $prev = $this->tracedErrors;
  38428. $this->tracedErrors = (int) $levels;
  38429. if (!$replace) {
  38430. $this->tracedErrors |= $prev;
  38431. }
  38432. return $prev;
  38433. }
  38434. public function screamAt($levels, $replace = false)
  38435. {
  38436. $prev = $this->screamedErrors;
  38437. $this->screamedErrors = (int) $levels;
  38438. if (!$replace) {
  38439. $this->screamedErrors |= $prev;
  38440. }
  38441. return $prev;
  38442. }
  38443. private function reRegister($prev)
  38444. {
  38445. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  38446. $handler = set_error_handler('var_dump');
  38447. $handler = \is_array($handler) ? $handler[0] : null;
  38448. restore_error_handler();
  38449. if ($handler === $this) {
  38450. restore_error_handler();
  38451. if ($this->isRoot) {
  38452. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  38453. } else {
  38454. set_error_handler(array($this, 'handleError'));
  38455. }
  38456. }
  38457. }
  38458. }
  38459. public function handleError($type, $message, $file, $line)
  38460. {
  38461. $level = error_reporting();
  38462. $silenced = 0 === ($level & $type);
  38463. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  38464. $log = $this->loggedErrors & $type;
  38465. $throw = $this->thrownErrors & $type & $level;
  38466. $type &= $level | $this->screamedErrors;
  38467. if (!$type || (!$log && !$throw)) {
  38468. return !$silenced && $type && $log;
  38469. }
  38470. $scope = $this->scopedErrors & $type;
  38471. if (4 < $numArgs = \func_num_args()) {
  38472. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  38473. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  38474. } else {
  38475. $context = array();
  38476. $backtrace = null;
  38477. }
  38478. if (isset($context['GLOBALS']) && $scope) {
  38479. $e = $context;
  38480. unset($e['GLOBALS'], $context);
  38481. $context = $e;
  38482. }
  38483. if (null !== $backtrace && $type & E_ERROR) {
  38484. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  38485. return true;
  38486. }
  38487. if ($throw) {
  38488. if (null !== self::$toStringException) {
  38489. $throw = self::$toStringException;
  38490. self::$toStringException = null;
  38491. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  38492. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  38493. } else {
  38494. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  38495. }
  38496. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  38497. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  38498. }
  38499. if (E_USER_ERROR & $type) {
  38500. $backtrace = $backtrace ?: $throw->getTrace();
  38501. for ($i = 1; isset($backtrace[$i]); ++$i) {
  38502. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  38503. && '__toString' === $backtrace[$i]['function']
  38504. && '->' === $backtrace[$i]['type']
  38505. && !isset($backtrace[$i - 1]['class'])
  38506. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  38507. ) {
  38508. foreach ($context as $e) {
  38509. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  38510. if (1 === $i) {
  38511. $throw = $e;
  38512. break;
  38513. }
  38514. self::$toStringException = $e;
  38515. return true;
  38516. }
  38517. }
  38518. if (1 < $i) {
  38519. $this->handleException($throw);
  38520. return false;
  38521. }
  38522. }
  38523. }
  38524. }
  38525. throw $throw;
  38526. }
  38527. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  38528. $trace = true;
  38529. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  38530. $trace = false;
  38531. } else {
  38532. $this->loggedTraces[$e] = 1;
  38533. }
  38534. $e = compact('type', 'file', 'line', 'level');
  38535. if ($type & $level) {
  38536. if ($scope) {
  38537. $e['scope_vars'] = $context;
  38538. if ($trace) {
  38539. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  38540. }
  38541. } elseif ($trace) {
  38542. if (null === $backtrace) {
  38543. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  38544. } else {
  38545. foreach ($backtrace as &$frame) {
  38546. unset($frame['args'], $frame);
  38547. }
  38548. $e['stack'] = $backtrace;
  38549. }
  38550. }
  38551. }
  38552. if ($this->isRecursive) {
  38553. $log = 0;
  38554. } elseif (self::$stackedErrorLevels) {
  38555. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38556. } else {
  38557. try {
  38558. $this->isRecursive = true;
  38559. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38560. $this->isRecursive = false;
  38561. } catch (\Exception $e) {
  38562. $this->isRecursive = false;
  38563. throw $e;
  38564. } catch (\Throwable $e) {
  38565. $this->isRecursive = false;
  38566. throw $e;
  38567. }
  38568. }
  38569. return !$silenced && $type && $log;
  38570. }
  38571. public function handleException($exception, array $error = null)
  38572. {
  38573. if (null === $error) {
  38574. self::$exitCode = 255;
  38575. }
  38576. if (!$exception instanceof \Exception) {
  38577. $exception = new FatalThrowableError($exception);
  38578. }
  38579. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  38580. $handlerException = null;
  38581. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  38582. $e = array(
  38583. 'type' => $type,
  38584. 'file' => $exception->getFile(),
  38585. 'line' => $exception->getLine(),
  38586. 'level' => error_reporting(),
  38587. 'stack' => $exception->getTrace(),
  38588. );
  38589. if ($exception instanceof FatalErrorException) {
  38590. if ($exception instanceof FatalThrowableError) {
  38591. $error = array(
  38592. 'type' => $type,
  38593. 'message' => $message = $exception->getMessage(),
  38594. 'file' => $e['file'],
  38595. 'line' => $e['line'],
  38596. );
  38597. } else {
  38598. $message = 'Fatal '.$exception->getMessage();
  38599. }
  38600. } elseif ($exception instanceof \ErrorException) {
  38601. $message = 'Uncaught '.$exception->getMessage();
  38602. if ($exception instanceof ContextErrorException) {
  38603. $e['context'] = $exception->getContext();
  38604. }
  38605. } else {
  38606. $message = 'Uncaught Exception: '.$exception->getMessage();
  38607. }
  38608. }
  38609. if ($this->loggedErrors & $type) {
  38610. try {
  38611. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  38612. } catch (\Exception $handlerException) {
  38613. } catch (\Throwable $handlerException) {
  38614. }
  38615. }
  38616. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  38617. foreach ($this->getFatalErrorHandlers() as $handler) {
  38618. if ($e = $handler->handleError($error, $exception)) {
  38619. $exception = $e;
  38620. break;
  38621. }
  38622. }
  38623. }
  38624. $exceptionHandler = $this->exceptionHandler;
  38625. $this->exceptionHandler = null;
  38626. try {
  38627. if (null !== $exceptionHandler) {
  38628. return \call_user_func($exceptionHandler, $exception);
  38629. }
  38630. $handlerException = $handlerException ?: $exception;
  38631. } catch (\Exception $handlerException) {
  38632. } catch (\Throwable $handlerException) {
  38633. }
  38634. if ($exception === $handlerException) {
  38635. self::$reservedMemory = null;
  38636. throw $exception;
  38637. }
  38638. $this->handleException($handlerException);
  38639. }
  38640. public static function handleFatalError(array $error = null)
  38641. {
  38642. if (null === self::$reservedMemory) {
  38643. return;
  38644. }
  38645. $handler = self::$reservedMemory = null;
  38646. $handlers = array();
  38647. $previousHandler = null;
  38648. $sameHandlerLimit = 10;
  38649. while (!\is_array($handler) || !$handler[0] instanceof self) {
  38650. $handler = set_exception_handler('var_dump');
  38651. restore_exception_handler();
  38652. if (!$handler) {
  38653. break;
  38654. }
  38655. restore_exception_handler();
  38656. if ($handler !== $previousHandler) {
  38657. array_unshift($handlers, $handler);
  38658. $previousHandler = $handler;
  38659. } elseif (0 === --$sameHandlerLimit) {
  38660. $handler = null;
  38661. break;
  38662. }
  38663. }
  38664. foreach ($handlers as $h) {
  38665. set_exception_handler($h);
  38666. }
  38667. if (!$handler) {
  38668. return;
  38669. }
  38670. if ($handler !== $h) {
  38671. $handler[0]->setExceptionHandler($h);
  38672. }
  38673. $handler = $handler[0];
  38674. $handlers = array();
  38675. if ($exit = null === $error) {
  38676. $error = error_get_last();
  38677. }
  38678. try {
  38679. while (self::$stackedErrorLevels) {
  38680. static::unstackErrors();
  38681. }
  38682. } catch (\Exception $exception) {
  38683. } catch (\Throwable $exception) {
  38684. }
  38685. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  38686. $handler->throwAt(0, true);
  38687. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  38688. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  38689. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  38690. } else {
  38691. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  38692. }
  38693. }
  38694. try {
  38695. if (isset($exception)) {
  38696. self::$exitCode = 255;
  38697. $handler->handleException($exception, $error);
  38698. }
  38699. } catch (FatalErrorException $e) {
  38700. }
  38701. if ($exit && self::$exitCode) {
  38702. $exitCode = self::$exitCode;
  38703. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  38704. }
  38705. }
  38706. public static function stackErrors()
  38707. {
  38708. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38709. }
  38710. public static function unstackErrors()
  38711. {
  38712. $level = array_pop(self::$stackedErrorLevels);
  38713. if (null !== $level) {
  38714. $e = error_reporting($level);
  38715. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  38716. error_reporting($e);
  38717. }
  38718. }
  38719. if (empty(self::$stackedErrorLevels)) {
  38720. $errors = self::$stackedErrors;
  38721. self::$stackedErrors = array();
  38722. foreach ($errors as $e) {
  38723. $e[0]->log($e[1], $e[2], $e[3]);
  38724. }
  38725. }
  38726. }
  38727. protected function getFatalErrorHandlers()
  38728. {
  38729. return array(
  38730. new UndefinedFunctionFatalErrorHandler(),
  38731. new UndefinedMethodFatalErrorHandler(),
  38732. new ClassNotFoundFatalErrorHandler(),
  38733. );
  38734. }
  38735. public function setLevel($level)
  38736. {
  38737. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38738. $level = null === $level ? error_reporting() : $level;
  38739. $this->throwAt($level, true);
  38740. }
  38741. public function setDisplayErrors($displayErrors)
  38742. {
  38743. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38744. if ($displayErrors) {
  38745. $this->throwAt($this->displayErrors, true);
  38746. } else {
  38747. $displayErrors = $this->displayErrors;
  38748. $this->throwAt(0, true);
  38749. $this->displayErrors = $displayErrors;
  38750. }
  38751. }
  38752. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  38753. {
  38754. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  38755. $handler = set_error_handler('var_dump');
  38756. $handler = \is_array($handler) ? $handler[0] : null;
  38757. restore_error_handler();
  38758. if (!$handler instanceof self) {
  38759. return;
  38760. }
  38761. if ('deprecation' === $channel) {
  38762. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  38763. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  38764. } elseif ('scream' === $channel) {
  38765. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  38766. $handler->screamAt(E_ALL | E_STRICT);
  38767. } elseif ('emergency' === $channel) {
  38768. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  38769. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38770. }
  38771. }
  38772. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  38773. {
  38774. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  38775. return $this->handleError($level, $message, $file, $line, (array) $context);
  38776. }
  38777. public function handleFatal()
  38778. {
  38779. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  38780. static::handleFatalError();
  38781. }
  38782. }
  38783. class ErrorHandlerCanary
  38784. {
  38785. private static $displayErrors = null;
  38786. public function __construct()
  38787. {
  38788. if (null === self::$displayErrors) {
  38789. self::$displayErrors = ini_set('display_errors', 1);
  38790. }
  38791. }
  38792. public function __destruct()
  38793. {
  38794. if (null !== self::$displayErrors) {
  38795. ini_set('display_errors', self::$displayErrors);
  38796. self::$displayErrors = null;
  38797. }
  38798. }
  38799. }
  38800. <?php
  38801. namespace Symfony\Component\Debug\Exception;
  38802. class ClassNotFoundException extends FatalErrorException
  38803. {
  38804. public function __construct($message, \ErrorException $previous)
  38805. {
  38806. parent::__construct(
  38807. $message,
  38808. $previous->getCode(),
  38809. $previous->getSeverity(),
  38810. $previous->getFile(),
  38811. $previous->getLine(),
  38812. null,
  38813. true,
  38814. null,
  38815. $previous->getPrevious()
  38816. );
  38817. $this->setTrace($previous->getTrace());
  38818. }
  38819. }
  38820. <?php
  38821. namespace Symfony\Component\Debug\Exception;
  38822. class ContextErrorException extends \ErrorException
  38823. {
  38824. private $context = array();
  38825. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  38826. {
  38827. parent::__construct($message, $code, $severity, $filename, $lineno);
  38828. $this->context = $context;
  38829. }
  38830. public function getContext()
  38831. {
  38832. return $this->context;
  38833. }
  38834. }
  38835. <?php
  38836. namespace Symfony\Component\Debug\Exception;
  38837. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38838. class DummyException extends \ErrorException
  38839. {
  38840. }
  38841. <?php
  38842. namespace Symfony\Component\HttpKernel\Exception;
  38843. class FatalErrorException extends \ErrorException
  38844. {
  38845. }
  38846. namespace Symfony\Component\Debug\Exception;
  38847. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  38848. class FatalErrorException extends LegacyFatalErrorException
  38849. {
  38850. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  38851. {
  38852. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  38853. if (null !== $trace) {
  38854. if (!$traceArgs) {
  38855. foreach ($trace as &$frame) {
  38856. unset($frame['args'], $frame['this'], $frame);
  38857. }
  38858. }
  38859. $this->setTrace($trace);
  38860. } elseif (null !== $traceOffset) {
  38861. if (\function_exists('xdebug_get_function_stack')) {
  38862. $trace = xdebug_get_function_stack();
  38863. if (0 < $traceOffset) {
  38864. array_splice($trace, -$traceOffset);
  38865. }
  38866. foreach ($trace as &$frame) {
  38867. if (!isset($frame['type'])) {
  38868. if (isset($frame['class'])) {
  38869. $frame['type'] = '::';
  38870. }
  38871. } elseif ('dynamic' === $frame['type']) {
  38872. $frame['type'] = '->';
  38873. } elseif ('static' === $frame['type']) {
  38874. $frame['type'] = '::';
  38875. }
  38876. if (!$traceArgs) {
  38877. unset($frame['params'], $frame['args']);
  38878. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  38879. $frame['args'] = $frame['params'];
  38880. unset($frame['params']);
  38881. }
  38882. }
  38883. unset($frame);
  38884. $trace = array_reverse($trace);
  38885. } elseif (\function_exists('symfony_debug_backtrace')) {
  38886. $trace = symfony_debug_backtrace();
  38887. if (0 < $traceOffset) {
  38888. array_splice($trace, 0, $traceOffset);
  38889. }
  38890. } else {
  38891. $trace = array();
  38892. }
  38893. $this->setTrace($trace);
  38894. }
  38895. }
  38896. protected function setTrace($trace)
  38897. {
  38898. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  38899. $traceReflector->setAccessible(true);
  38900. $traceReflector->setValue($this, $trace);
  38901. }
  38902. }
  38903. <?php
  38904. namespace Symfony\Component\Debug\Exception;
  38905. class FatalThrowableError extends FatalErrorException
  38906. {
  38907. public function __construct(\Throwable $e)
  38908. {
  38909. if ($e instanceof \ParseError) {
  38910. $message = 'Parse error: '.$e->getMessage();
  38911. $severity = E_PARSE;
  38912. } elseif ($e instanceof \TypeError) {
  38913. $message = 'Type error: '.$e->getMessage();
  38914. $severity = E_RECOVERABLE_ERROR;
  38915. } else {
  38916. $message = $e->getMessage();
  38917. $severity = E_ERROR;
  38918. }
  38919. \ErrorException::__construct(
  38920. $message,
  38921. $e->getCode(),
  38922. $severity,
  38923. $e->getFile(),
  38924. $e->getLine(),
  38925. $e->getPrevious()
  38926. );
  38927. $this->setTrace($e->getTrace());
  38928. }
  38929. }
  38930. <?php
  38931. namespace Symfony\Component\HttpKernel\Exception;
  38932. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  38933. class FlattenException
  38934. {
  38935. private $handler;
  38936. public static function __callStatic($method, $args)
  38937. {
  38938. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  38939. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  38940. }
  38941. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  38942. }
  38943. public function __call($method, $args)
  38944. {
  38945. if (!isset($this->handler)) {
  38946. $this->handler = new DebugFlattenException();
  38947. }
  38948. if (!method_exists($this->handler, $method)) {
  38949. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  38950. }
  38951. return \call_user_func_array(array($this->handler, $method), $args);
  38952. }
  38953. }
  38954. namespace Symfony\Component\Debug\Exception;
  38955. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  38956. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  38957. class FlattenException extends LegacyFlattenException
  38958. {
  38959. private $message;
  38960. private $code;
  38961. private $previous;
  38962. private $trace;
  38963. private $class;
  38964. private $statusCode;
  38965. private $headers;
  38966. private $file;
  38967. private $line;
  38968. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  38969. {
  38970. $e = new static();
  38971. $e->setMessage($exception->getMessage());
  38972. $e->setCode($exception->getCode());
  38973. if ($exception instanceof HttpExceptionInterface) {
  38974. $statusCode = $exception->getStatusCode();
  38975. $headers = array_merge($headers, $exception->getHeaders());
  38976. }
  38977. if (null === $statusCode) {
  38978. $statusCode = 500;
  38979. }
  38980. $e->setStatusCode($statusCode);
  38981. $e->setHeaders($headers);
  38982. $e->setTraceFromException($exception);
  38983. $e->setClass(\get_class($exception));
  38984. $e->setFile($exception->getFile());
  38985. $e->setLine($exception->getLine());
  38986. $previous = $exception->getPrevious();
  38987. if ($previous instanceof \Exception) {
  38988. $e->setPrevious(static::create($previous));
  38989. } elseif ($previous instanceof \Throwable) {
  38990. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  38991. }
  38992. return $e;
  38993. }
  38994. public function toArray()
  38995. {
  38996. $exceptions = array();
  38997. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  38998. $exceptions[] = array(
  38999. 'message' => $exception->getMessage(),
  39000. 'class' => $exception->getClass(),
  39001. 'trace' => $exception->getTrace(),
  39002. );
  39003. }
  39004. return $exceptions;
  39005. }
  39006. public function getStatusCode()
  39007. {
  39008. return $this->statusCode;
  39009. }
  39010. public function setStatusCode($code)
  39011. {
  39012. $this->statusCode = $code;
  39013. }
  39014. public function getHeaders()
  39015. {
  39016. return $this->headers;
  39017. }
  39018. public function setHeaders(array $headers)
  39019. {
  39020. $this->headers = $headers;
  39021. }
  39022. public function getClass()
  39023. {
  39024. return $this->class;
  39025. }
  39026. public function setClass($class)
  39027. {
  39028. $this->class = $class;
  39029. }
  39030. public function getFile()
  39031. {
  39032. return $this->file;
  39033. }
  39034. public function setFile($file)
  39035. {
  39036. $this->file = $file;
  39037. }
  39038. public function getLine()
  39039. {
  39040. return $this->line;
  39041. }
  39042. public function setLine($line)
  39043. {
  39044. $this->line = $line;
  39045. }
  39046. public function getMessage()
  39047. {
  39048. return $this->message;
  39049. }
  39050. public function setMessage($message)
  39051. {
  39052. $this->message = $message;
  39053. }
  39054. public function getCode()
  39055. {
  39056. return $this->code;
  39057. }
  39058. public function setCode($code)
  39059. {
  39060. $this->code = $code;
  39061. }
  39062. public function getPrevious()
  39063. {
  39064. return $this->previous;
  39065. }
  39066. public function setPrevious(FlattenException $previous)
  39067. {
  39068. $this->previous = $previous;
  39069. }
  39070. public function getAllPrevious()
  39071. {
  39072. $exceptions = array();
  39073. $e = $this;
  39074. while ($e = $e->getPrevious()) {
  39075. $exceptions[] = $e;
  39076. }
  39077. return $exceptions;
  39078. }
  39079. public function getTrace()
  39080. {
  39081. return $this->trace;
  39082. }
  39083. public function setTraceFromException(\Exception $exception)
  39084. {
  39085. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  39086. }
  39087. public function setTrace($trace, $file, $line)
  39088. {
  39089. $this->trace = array();
  39090. $this->trace[] = array(
  39091. 'namespace' => '',
  39092. 'short_class' => '',
  39093. 'class' => '',
  39094. 'type' => '',
  39095. 'function' => '',
  39096. 'file' => $file,
  39097. 'line' => $line,
  39098. 'args' => array(),
  39099. );
  39100. foreach ($trace as $entry) {
  39101. $class = '';
  39102. $namespace = '';
  39103. if (isset($entry['class'])) {
  39104. $parts = explode('\\', $entry['class']);
  39105. $class = array_pop($parts);
  39106. $namespace = implode('\\', $parts);
  39107. }
  39108. $this->trace[] = array(
  39109. 'namespace' => $namespace,
  39110. 'short_class' => $class,
  39111. 'class' => isset($entry['class']) ? $entry['class'] : '',
  39112. 'type' => isset($entry['type']) ? $entry['type'] : '',
  39113. 'function' => isset($entry['function']) ? $entry['function'] : null,
  39114. 'file' => isset($entry['file']) ? $entry['file'] : null,
  39115. 'line' => isset($entry['line']) ? $entry['line'] : null,
  39116. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  39117. );
  39118. }
  39119. }
  39120. private function flattenArgs($args, $level = 0, &$count = 0)
  39121. {
  39122. $result = array();
  39123. foreach ($args as $key => $value) {
  39124. if (++$count > 1e4) {
  39125. return array('array', '*SKIPPED over 10000 entries*');
  39126. }
  39127. if ($value instanceof \__PHP_Incomplete_Class) {
  39128. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  39129. } elseif (\is_object($value)) {
  39130. $result[$key] = array('object', \get_class($value));
  39131. } elseif (\is_array($value)) {
  39132. if ($level > 10) {
  39133. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  39134. } else {
  39135. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  39136. }
  39137. } elseif (null === $value) {
  39138. $result[$key] = array('null', null);
  39139. } elseif (\is_bool($value)) {
  39140. $result[$key] = array('boolean', $value);
  39141. } elseif (\is_resource($value)) {
  39142. $result[$key] = array('resource', get_resource_type($value));
  39143. } else {
  39144. $result[$key] = array('string', (string) $value);
  39145. }
  39146. }
  39147. return $result;
  39148. }
  39149. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  39150. {
  39151. $array = new \ArrayObject($value);
  39152. return $array['__PHP_Incomplete_Class_Name'];
  39153. }
  39154. }
  39155. <?php
  39156. namespace Symfony\Component\Debug\Exception;
  39157. class OutOfMemoryException extends FatalErrorException
  39158. {
  39159. }
  39160. <?php
  39161. namespace Symfony\Component\Debug\Exception;
  39162. class UndefinedFunctionException extends FatalErrorException
  39163. {
  39164. public function __construct($message, \ErrorException $previous)
  39165. {
  39166. parent::__construct(
  39167. $message,
  39168. $previous->getCode(),
  39169. $previous->getSeverity(),
  39170. $previous->getFile(),
  39171. $previous->getLine(),
  39172. null,
  39173. true,
  39174. null,
  39175. $previous->getPrevious()
  39176. );
  39177. $this->setTrace($previous->getTrace());
  39178. }
  39179. }
  39180. <?php
  39181. namespace Symfony\Component\Debug\Exception;
  39182. class UndefinedMethodException extends FatalErrorException
  39183. {
  39184. public function __construct($message, \ErrorException $previous)
  39185. {
  39186. parent::__construct(
  39187. $message,
  39188. $previous->getCode(),
  39189. $previous->getSeverity(),
  39190. $previous->getFile(),
  39191. $previous->getLine(),
  39192. null,
  39193. true,
  39194. null,
  39195. $previous->getPrevious()
  39196. );
  39197. $this->setTrace($previous->getTrace());
  39198. }
  39199. }
  39200. <?php
  39201. namespace Symfony\Component\Debug;
  39202. use Symfony\Component\Debug\Exception\FlattenException;
  39203. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  39204. use Symfony\Component\HttpFoundation\Response;
  39205. class ExceptionHandler
  39206. {
  39207. private $debug;
  39208. private $charset;
  39209. private $handler;
  39210. private $caughtBuffer;
  39211. private $caughtLength;
  39212. private $fileLinkFormat;
  39213. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  39214. {
  39215. if (false !== strpos($charset, '%')) {
  39216. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  39217. $pivot = $fileLinkFormat;
  39218. $fileLinkFormat = $charset;
  39219. $charset = $pivot;
  39220. }
  39221. $this->debug = $debug;
  39222. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  39223. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  39224. }
  39225. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  39226. {
  39227. $handler = new static($debug, $charset, $fileLinkFormat);
  39228. $prev = set_exception_handler(array($handler, 'handle'));
  39229. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  39230. restore_exception_handler();
  39231. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  39232. }
  39233. return $handler;
  39234. }
  39235. public function setHandler($handler)
  39236. {
  39237. if (null !== $handler && !\is_callable($handler)) {
  39238. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39239. }
  39240. $old = $this->handler;
  39241. $this->handler = $handler;
  39242. return $old;
  39243. }
  39244. public function setFileLinkFormat($format)
  39245. {
  39246. $old = $this->fileLinkFormat;
  39247. $this->fileLinkFormat = $format;
  39248. return $old;
  39249. }
  39250. public function handle(\Exception $exception)
  39251. {
  39252. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  39253. $this->failSafeHandle($exception);
  39254. return;
  39255. }
  39256. $caughtLength = $this->caughtLength = 0;
  39257. ob_start(array($this, 'catchOutput'));
  39258. $this->failSafeHandle($exception);
  39259. while (null === $this->caughtBuffer && ob_end_flush()) {
  39260. }
  39261. if (isset($this->caughtBuffer[0])) {
  39262. ob_start(array($this, 'cleanOutput'));
  39263. echo $this->caughtBuffer;
  39264. $caughtLength = ob_get_length();
  39265. }
  39266. $this->caughtBuffer = null;
  39267. try {
  39268. \call_user_func($this->handler, $exception);
  39269. $this->caughtLength = $caughtLength;
  39270. } catch (\Exception $e) {
  39271. if (!$caughtLength) {
  39272. throw $exception;
  39273. }
  39274. }
  39275. }
  39276. private function failSafeHandle(\Exception $exception)
  39277. {
  39278. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  39279. && __CLASS__ !== \get_class($this)
  39280. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  39281. && __CLASS__ !== $reflector->class
  39282. ) {
  39283. $response = $this->createResponse($exception);
  39284. $response->sendHeaders();
  39285. $response->sendContent();
  39286. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  39287. return;
  39288. }
  39289. $this->sendPhpResponse($exception);
  39290. }
  39291. public function sendPhpResponse($exception)
  39292. {
  39293. if (!$exception instanceof FlattenException) {
  39294. $exception = FlattenException::create($exception);
  39295. }
  39296. if (!headers_sent()) {
  39297. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  39298. foreach ($exception->getHeaders() as $name => $value) {
  39299. header($name.': '.$value, false);
  39300. }
  39301. header('Content-Type: text/html; charset='.$this->charset);
  39302. }
  39303. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39304. }
  39305. public function createResponse($exception)
  39306. {
  39307. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39308. if (!$exception instanceof FlattenException) {
  39309. $exception = FlattenException::create($exception);
  39310. }
  39311. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  39312. }
  39313. public function getHtml($exception)
  39314. {
  39315. if (!$exception instanceof FlattenException) {
  39316. $exception = FlattenException::create($exception);
  39317. }
  39318. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39319. }
  39320. public function getContent(FlattenException $exception)
  39321. {
  39322. switch ($exception->getStatusCode()) {
  39323. case 404:
  39324. $title = 'Sorry, the page you are looking for could not be found.';
  39325. break;
  39326. default:
  39327. $title = 'Whoops, looks like something went wrong.';
  39328. }
  39329. $content = '';
  39330. if ($this->debug) {
  39331. try {
  39332. $count = \count($exception->getAllPrevious());
  39333. $total = $count + 1;
  39334. foreach ($exception->toArray() as $position => $e) {
  39335. $ind = $count - $position + 1;
  39336. $class = $this->formatClass($e['class']);
  39337. $message = nl2br($this->escapeHtml($e['message']));
  39338. $content .= sprintf(<<<'EOF'
  39339. <h2 class="block_exception clear_fix">
  39340. <span class="exception_counter">%d/%d</span>
  39341. <span class="exception_title">%s%s:</span>
  39342. <span class="exception_message">%s</span>
  39343. </h2>
  39344. <div class="block">
  39345. <ol class="traces list_exception">
  39346. EOF
  39347. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  39348. foreach ($e['trace'] as $trace) {
  39349. $content .= ' <li>';
  39350. if ($trace['function']) {
  39351. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  39352. }
  39353. if (isset($trace['file']) && isset($trace['line'])) {
  39354. $content .= $this->formatPath($trace['file'], $trace['line']);
  39355. }
  39356. $content .= "</li>\n";
  39357. }
  39358. $content .= " </ol>\n</div>\n";
  39359. }
  39360. } catch (\Exception $e) {
  39361. if ($this->debug) {
  39362. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  39363. } else {
  39364. $title = 'Whoops, looks like something went wrong.';
  39365. }
  39366. }
  39367. }
  39368. return <<<EOF
  39369. <div id="sf-resetcontent" class="sf-reset">
  39370. <h1>$title</h1>
  39371. $content
  39372. </div>
  39373. EOF;
  39374. }
  39375. public function getStylesheet(FlattenException $exception)
  39376. {
  39377. return <<<'EOF'
  39378. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  39379. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  39380. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  39381. .sf-reset .clear_fix { display:inline-block; }
  39382. .sf-reset * html .clear_fix { height:1%; }
  39383. .sf-reset .clear_fix { display:block; }
  39384. .sf-reset, .sf-reset .block { margin: auto }
  39385. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  39386. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  39387. .sf-reset strong { font-weight:bold; }
  39388. .sf-reset a { color:#6c6159; cursor: default; }
  39389. .sf-reset a img { border:none; }
  39390. .sf-reset a:hover { text-decoration:underline; }
  39391. .sf-reset em { font-style:italic; }
  39392. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  39393. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  39394. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  39395. .sf-reset .exception_message { margin-left: 3em; display: block; }
  39396. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  39397. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  39398. -webkit-border-bottom-right-radius: 16px;
  39399. -webkit-border-bottom-left-radius: 16px;
  39400. -moz-border-radius-bottomright: 16px;
  39401. -moz-border-radius-bottomleft: 16px;
  39402. border-bottom-right-radius: 16px;
  39403. border-bottom-left-radius: 16px;
  39404. border-bottom:1px solid #ccc;
  39405. border-right:1px solid #ccc;
  39406. border-left:1px solid #ccc;
  39407. word-wrap: break-word;
  39408. }
  39409. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  39410. -webkit-border-top-left-radius: 16px;
  39411. -webkit-border-top-right-radius: 16px;
  39412. -moz-border-radius-topleft: 16px;
  39413. -moz-border-radius-topright: 16px;
  39414. border-top-left-radius: 16px;
  39415. border-top-right-radius: 16px;
  39416. border-top:1px solid #ccc;
  39417. border-right:1px solid #ccc;
  39418. border-left:1px solid #ccc;
  39419. overflow: hidden;
  39420. word-wrap: break-word;
  39421. }
  39422. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  39423. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  39424. .sf-reset ol { padding: 10px 0; }
  39425. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  39426. -webkit-border-radius: 10px;
  39427. -moz-border-radius: 10px;
  39428. border-radius: 10px;
  39429. border: 1px solid #ccc;
  39430. }
  39431. EOF;
  39432. }
  39433. private function decorate($content, $css)
  39434. {
  39435. return <<<EOF
  39436. <!DOCTYPE html>
  39437. <html>
  39438. <head>
  39439. <meta charset="{$this->charset}" />
  39440. <meta name="robots" content="noindex,nofollow" />
  39441. <style>
  39442. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  39443. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  39444. html { background: #eee; padding: 10px }
  39445. img { border: 0; }
  39446. #sf-resetcontent { width:970px; margin:0 auto; }
  39447. $css
  39448. </style>
  39449. </head>
  39450. <body>
  39451. $content
  39452. </body>
  39453. </html>
  39454. EOF;
  39455. }
  39456. private function formatClass($class)
  39457. {
  39458. $parts = explode('\\', $class);
  39459. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  39460. }
  39461. private function formatPath($path, $line)
  39462. {
  39463. $path = $this->escapeHtml($path);
  39464. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  39465. if ($linkFormat = $this->fileLinkFormat) {
  39466. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  39467. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  39468. }
  39469. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  39470. }
  39471. private function formatArgs(array $args)
  39472. {
  39473. $result = array();
  39474. foreach ($args as $key => $item) {
  39475. if ('object' === $item[0]) {
  39476. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  39477. } elseif ('array' === $item[0]) {
  39478. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  39479. } elseif ('string' === $item[0]) {
  39480. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  39481. } elseif ('null' === $item[0]) {
  39482. $formattedValue = '<em>null</em>';
  39483. } elseif ('boolean' === $item[0]) {
  39484. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  39485. } elseif ('resource' === $item[0]) {
  39486. $formattedValue = '<em>resource</em>';
  39487. } else {
  39488. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  39489. }
  39490. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  39491. }
  39492. return implode(', ', $result);
  39493. }
  39494. protected static function utf8Htmlize($str)
  39495. {
  39496. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  39497. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  39498. }
  39499. private function escapeHtml($str)
  39500. {
  39501. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  39502. }
  39503. public function catchOutput($buffer)
  39504. {
  39505. $this->caughtBuffer = $buffer;
  39506. return '';
  39507. }
  39508. public function cleanOutput($buffer)
  39509. {
  39510. if ($this->caughtLength) {
  39511. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  39512. if (isset($cleanBuffer[0])) {
  39513. $buffer = $cleanBuffer;
  39514. }
  39515. }
  39516. return $buffer;
  39517. }
  39518. }
  39519. <?php
  39520. namespace Symfony\Component\Debug\FatalErrorHandler;
  39521. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  39522. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  39523. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  39524. use Symfony\Component\Debug\DebugClassLoader;
  39525. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  39526. use Symfony\Component\Debug\Exception\FatalErrorException;
  39527. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  39528. {
  39529. public function handleError(array $error, FatalErrorException $exception)
  39530. {
  39531. $messageLen = \strlen($error['message']);
  39532. $notFoundSuffix = '\' not found';
  39533. $notFoundSuffixLen = \strlen($notFoundSuffix);
  39534. if ($notFoundSuffixLen > $messageLen) {
  39535. return;
  39536. }
  39537. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39538. return;
  39539. }
  39540. foreach (array('class', 'interface', 'trait') as $typeName) {
  39541. $prefix = ucfirst($typeName).' \'';
  39542. $prefixLen = \strlen($prefix);
  39543. if (0 !== strpos($error['message'], $prefix)) {
  39544. continue;
  39545. }
  39546. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39547. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  39548. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  39549. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  39550. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  39551. $tail = ' for another namespace?';
  39552. } else {
  39553. $className = $fullyQualifiedClassName;
  39554. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  39555. $tail = '?';
  39556. }
  39557. if ($candidates = $this->getClassCandidates($className)) {
  39558. $tail = array_pop($candidates).'"?';
  39559. if ($candidates) {
  39560. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  39561. } else {
  39562. $tail = ' for "'.$tail;
  39563. }
  39564. }
  39565. $message .= "\nDid you forget a \"use\" statement".$tail;
  39566. return new ClassNotFoundException($message, $exception);
  39567. }
  39568. }
  39569. private function getClassCandidates($class)
  39570. {
  39571. if (!\is_array($functions = spl_autoload_functions())) {
  39572. return array();
  39573. }
  39574. $classes = array();
  39575. foreach ($functions as $function) {
  39576. if (!\is_array($function)) {
  39577. continue;
  39578. }
  39579. if ($function[0] instanceof DebugClassLoader) {
  39580. $function = $function[0]->getClassLoader();
  39581. if (\is_object($function)) {
  39582. $function = array($function);
  39583. }
  39584. if (!\is_array($function)) {
  39585. continue;
  39586. }
  39587. }
  39588. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  39589. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  39590. foreach ($paths as $path) {
  39591. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39592. }
  39593. }
  39594. }
  39595. if ($function[0] instanceof ComposerClassLoader) {
  39596. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  39597. foreach ($paths as $path) {
  39598. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39599. }
  39600. }
  39601. }
  39602. }
  39603. return array_unique($classes);
  39604. }
  39605. private function findClassInPath($path, $class, $prefix)
  39606. {
  39607. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  39608. return array();
  39609. }
  39610. $classes = array();
  39611. $filename = $class.'.php';
  39612. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  39613. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  39614. $classes[] = $class;
  39615. }
  39616. }
  39617. return $classes;
  39618. }
  39619. private function convertFileToClass($path, $file, $prefix)
  39620. {
  39621. $candidates = array(
  39622. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  39623. $prefix.$namespacedClass,
  39624. $prefix.'\\'.$namespacedClass,
  39625. str_replace('\\', '_', $namespacedClass),
  39626. str_replace('\\', '_', $prefix.$namespacedClass),
  39627. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  39628. );
  39629. if ($prefix) {
  39630. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  39631. }
  39632. foreach ($candidates as $candidate) {
  39633. if ($this->classExists($candidate)) {
  39634. return $candidate;
  39635. }
  39636. }
  39637. require_once $file;
  39638. foreach ($candidates as $candidate) {
  39639. if ($this->classExists($candidate)) {
  39640. return $candidate;
  39641. }
  39642. }
  39643. }
  39644. private function classExists($class)
  39645. {
  39646. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  39647. }
  39648. }
  39649. <?php
  39650. namespace Symfony\Component\Debug\FatalErrorHandler;
  39651. use Symfony\Component\Debug\Exception\FatalErrorException;
  39652. interface FatalErrorHandlerInterface
  39653. {
  39654. public function handleError(array $error, FatalErrorException $exception);
  39655. }
  39656. <?php
  39657. namespace Symfony\Component\Debug\FatalErrorHandler;
  39658. use Symfony\Component\Debug\Exception\FatalErrorException;
  39659. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  39660. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  39661. {
  39662. public function handleError(array $error, FatalErrorException $exception)
  39663. {
  39664. $messageLen = \strlen($error['message']);
  39665. $notFoundSuffix = '()';
  39666. $notFoundSuffixLen = \strlen($notFoundSuffix);
  39667. if ($notFoundSuffixLen > $messageLen) {
  39668. return;
  39669. }
  39670. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39671. return;
  39672. }
  39673. $prefix = 'Call to undefined function ';
  39674. $prefixLen = \strlen($prefix);
  39675. if (0 !== strpos($error['message'], $prefix)) {
  39676. return;
  39677. }
  39678. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39679. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  39680. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  39681. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  39682. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  39683. } else {
  39684. $functionName = $fullyQualifiedFunctionName;
  39685. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  39686. }
  39687. $candidates = array();
  39688. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  39689. foreach ($definedFunctionNames as $definedFunctionName) {
  39690. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  39691. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  39692. } else {
  39693. $definedFunctionNameBasename = $definedFunctionName;
  39694. }
  39695. if ($definedFunctionNameBasename === $functionName) {
  39696. $candidates[] = '\\'.$definedFunctionName;
  39697. }
  39698. }
  39699. }
  39700. if ($candidates) {
  39701. sort($candidates);
  39702. $last = array_pop($candidates).'"?';
  39703. if ($candidates) {
  39704. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39705. } else {
  39706. $candidates = '"'.$last;
  39707. }
  39708. $message .= "\nDid you mean to call ".$candidates;
  39709. }
  39710. return new UndefinedFunctionException($message, $exception);
  39711. }
  39712. }
  39713. <?php
  39714. namespace Symfony\Component\Debug\FatalErrorHandler;
  39715. use Symfony\Component\Debug\Exception\FatalErrorException;
  39716. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  39717. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  39718. {
  39719. public function handleError(array $error, FatalErrorException $exception)
  39720. {
  39721. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  39722. if (!$matches) {
  39723. return;
  39724. }
  39725. $className = $matches[1];
  39726. $methodName = $matches[2];
  39727. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  39728. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  39729. return new UndefinedMethodException($message, $exception);
  39730. }
  39731. $candidates = array();
  39732. foreach ($methods as $definedMethodName) {
  39733. $lev = levenshtein($methodName, $definedMethodName);
  39734. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  39735. $candidates[] = $definedMethodName;
  39736. }
  39737. }
  39738. if ($candidates) {
  39739. sort($candidates);
  39740. $last = array_pop($candidates).'"?';
  39741. if ($candidates) {
  39742. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39743. } else {
  39744. $candidates = '"'.$last;
  39745. }
  39746. $message .= "\nDid you mean to call ".$candidates;
  39747. }
  39748. return new UndefinedMethodException($message, $exception);
  39749. }
  39750. }
  39751. Copyright (c) 2004-2018 Fabien Potencier
  39752. Permission is hereby granted, free of charge, to any person obtaining a copy
  39753. of this software and associated documentation files (the "Software"), to deal
  39754. in the Software without restriction, including without limitation the rights
  39755. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39756. copies of the Software, and to permit persons to whom the Software is furnished
  39757. to do so, subject to the following conditions:
  39758. The above copyright notice and this permission notice shall be included in all
  39759. copies or substantial portions of the Software.
  39760. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39761. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39762. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39763. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39764. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39765. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39766. THE SOFTWARE.
  39767. <?php
  39768. namespace Symfony\Component\Filesystem\Exception;
  39769. interface ExceptionInterface
  39770. {
  39771. }
  39772. <?php
  39773. namespace Symfony\Component\Filesystem\Exception;
  39774. class FileNotFoundException extends IOException
  39775. {
  39776. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  39777. {
  39778. if (null === $message) {
  39779. if (null === $path) {
  39780. $message = 'File could not be found.';
  39781. } else {
  39782. $message = sprintf('File "%s" could not be found.', $path);
  39783. }
  39784. }
  39785. parent::__construct($message, $code, $previous, $path);
  39786. }
  39787. }
  39788. <?php
  39789. namespace Symfony\Component\Filesystem\Exception;
  39790. class IOException extends \RuntimeException implements IOExceptionInterface
  39791. {
  39792. private $path;
  39793. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  39794. {
  39795. $this->path = $path;
  39796. parent::__construct($message, $code, $previous);
  39797. }
  39798. public function getPath()
  39799. {
  39800. return $this->path;
  39801. }
  39802. }
  39803. <?php
  39804. namespace Symfony\Component\Filesystem\Exception;
  39805. interface IOExceptionInterface extends ExceptionInterface
  39806. {
  39807. public function getPath();
  39808. }
  39809. <?php
  39810. namespace Symfony\Component\Filesystem;
  39811. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  39812. use Symfony\Component\Filesystem\Exception\IOException;
  39813. class Filesystem
  39814. {
  39815. private static $lastError;
  39816. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  39817. {
  39818. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  39819. if ($originIsLocal && !is_file($originFile)) {
  39820. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  39821. }
  39822. $this->mkdir(\dirname($targetFile));
  39823. $doCopy = true;
  39824. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  39825. $doCopy = filemtime($originFile) > filemtime($targetFile);
  39826. }
  39827. if ($doCopy) {
  39828. if (false === $source = @fopen($originFile, 'r')) {
  39829. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  39830. }
  39831. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  39832. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  39833. }
  39834. $bytesCopied = stream_copy_to_stream($source, $target);
  39835. fclose($source);
  39836. fclose($target);
  39837. unset($source, $target);
  39838. if (!is_file($targetFile)) {
  39839. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  39840. }
  39841. if ($originIsLocal) {
  39842. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  39843. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  39844. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  39845. }
  39846. }
  39847. }
  39848. }
  39849. public function mkdir($dirs, $mode = 0777)
  39850. {
  39851. foreach ($this->toIterator($dirs) as $dir) {
  39852. if (is_dir($dir)) {
  39853. continue;
  39854. }
  39855. if (!self::box('mkdir', $dir, $mode, true)) {
  39856. if (!is_dir($dir)) {
  39857. if (self::$lastError) {
  39858. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  39859. }
  39860. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  39861. }
  39862. }
  39863. }
  39864. }
  39865. public function exists($files)
  39866. {
  39867. $maxPathLength = PHP_MAXPATHLEN - 2;
  39868. foreach ($this->toIterator($files) as $file) {
  39869. if (\strlen($file) > $maxPathLength) {
  39870. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  39871. }
  39872. if (!file_exists($file)) {
  39873. return false;
  39874. }
  39875. }
  39876. return true;
  39877. }
  39878. public function touch($files, $time = null, $atime = null)
  39879. {
  39880. foreach ($this->toIterator($files) as $file) {
  39881. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  39882. if (true !== $touch) {
  39883. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  39884. }
  39885. }
  39886. }
  39887. public function remove($files)
  39888. {
  39889. if ($files instanceof \Traversable) {
  39890. $files = iterator_to_array($files, false);
  39891. } elseif (!\is_array($files)) {
  39892. $files = array($files);
  39893. }
  39894. $files = array_reverse($files);
  39895. foreach ($files as $file) {
  39896. if (is_link($file)) {
  39897. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  39898. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  39899. }
  39900. } elseif (is_dir($file)) {
  39901. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  39902. if (!self::box('rmdir', $file) && file_exists($file)) {
  39903. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  39904. }
  39905. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  39906. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  39907. }
  39908. }
  39909. }
  39910. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  39911. {
  39912. foreach ($this->toIterator($files) as $file) {
  39913. if (true !== @chmod($file, $mode & ~$umask)) {
  39914. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  39915. }
  39916. if ($recursive && is_dir($file) && !is_link($file)) {
  39917. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  39918. }
  39919. }
  39920. }
  39921. public function chown($files, $user, $recursive = false)
  39922. {
  39923. foreach ($this->toIterator($files) as $file) {
  39924. if ($recursive && is_dir($file) && !is_link($file)) {
  39925. $this->chown(new \FilesystemIterator($file), $user, true);
  39926. }
  39927. if (is_link($file) && \function_exists('lchown')) {
  39928. if (true !== @lchown($file, $user)) {
  39929. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39930. }
  39931. } else {
  39932. if (true !== @chown($file, $user)) {
  39933. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39934. }
  39935. }
  39936. }
  39937. }
  39938. public function chgrp($files, $group, $recursive = false)
  39939. {
  39940. foreach ($this->toIterator($files) as $file) {
  39941. if ($recursive && is_dir($file) && !is_link($file)) {
  39942. $this->chgrp(new \FilesystemIterator($file), $group, true);
  39943. }
  39944. if (is_link($file) && \function_exists('lchgrp')) {
  39945. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  39946. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39947. }
  39948. } else {
  39949. if (true !== @chgrp($file, $group)) {
  39950. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39951. }
  39952. }
  39953. }
  39954. }
  39955. public function rename($origin, $target, $overwrite = false)
  39956. {
  39957. if (!$overwrite && $this->isReadable($target)) {
  39958. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  39959. }
  39960. if (true !== @rename($origin, $target)) {
  39961. if (is_dir($origin)) {
  39962. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  39963. $this->remove($origin);
  39964. return;
  39965. }
  39966. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  39967. }
  39968. }
  39969. private function isReadable($filename)
  39970. {
  39971. $maxPathLength = PHP_MAXPATHLEN - 2;
  39972. if (\strlen($filename) > $maxPathLength) {
  39973. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  39974. }
  39975. return is_readable($filename);
  39976. }
  39977. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  39978. {
  39979. if ('\\' === \DIRECTORY_SEPARATOR) {
  39980. $originDir = strtr($originDir, '/', '\\');
  39981. $targetDir = strtr($targetDir, '/', '\\');
  39982. if ($copyOnWindows) {
  39983. $this->mirror($originDir, $targetDir);
  39984. return;
  39985. }
  39986. }
  39987. $this->mkdir(\dirname($targetDir));
  39988. if (is_link($targetDir)) {
  39989. if (readlink($targetDir) === $originDir) {
  39990. return;
  39991. }
  39992. $this->remove($targetDir);
  39993. }
  39994. if (!self::box('symlink', $originDir, $targetDir)) {
  39995. if (null !== self::$lastError) {
  39996. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  39997. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  39998. }
  39999. }
  40000. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  40001. }
  40002. }
  40003. public function makePathRelative($endPath, $startPath)
  40004. {
  40005. if ('\\' === \DIRECTORY_SEPARATOR) {
  40006. $endPath = str_replace('\\', '/', $endPath);
  40007. $startPath = str_replace('\\', '/', $startPath);
  40008. }
  40009. $stripDriveLetter = function ($path) {
  40010. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  40011. return substr($path, 2);
  40012. }
  40013. return $path;
  40014. };
  40015. $endPath = $stripDriveLetter($endPath);
  40016. $startPath = $stripDriveLetter($startPath);
  40017. $startPathArr = explode('/', trim($startPath, '/'));
  40018. $endPathArr = explode('/', trim($endPath, '/'));
  40019. $normalizePathArray = function ($pathSegments, $absolute) {
  40020. $result = array();
  40021. foreach ($pathSegments as $segment) {
  40022. if ('..' === $segment && ($absolute || \count($result))) {
  40023. array_pop($result);
  40024. } elseif ('.' !== $segment) {
  40025. $result[] = $segment;
  40026. }
  40027. }
  40028. return $result;
  40029. };
  40030. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  40031. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  40032. $index = 0;
  40033. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  40034. ++$index;
  40035. }
  40036. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  40037. $depth = 0;
  40038. } else {
  40039. $depth = \count($startPathArr) - $index;
  40040. }
  40041. $traverser = str_repeat('../', $depth);
  40042. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  40043. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  40044. return '' === $relativePath ? './' : $relativePath;
  40045. }
  40046. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  40047. {
  40048. $targetDir = rtrim($targetDir, '/\\');
  40049. $originDir = rtrim($originDir, '/\\');
  40050. $originDirLen = \strlen($originDir);
  40051. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  40052. $deleteIterator = $iterator;
  40053. if (null === $deleteIterator) {
  40054. $flags = \FilesystemIterator::SKIP_DOTS;
  40055. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  40056. }
  40057. $targetDirLen = \strlen($targetDir);
  40058. foreach ($deleteIterator as $file) {
  40059. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  40060. if (!$this->exists($origin)) {
  40061. $this->remove($file);
  40062. }
  40063. }
  40064. }
  40065. $copyOnWindows = false;
  40066. if (isset($options['copy_on_windows'])) {
  40067. $copyOnWindows = $options['copy_on_windows'];
  40068. }
  40069. if (null === $iterator) {
  40070. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  40071. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  40072. }
  40073. if ($this->exists($originDir)) {
  40074. $this->mkdir($targetDir);
  40075. }
  40076. foreach ($iterator as $file) {
  40077. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  40078. if ($copyOnWindows) {
  40079. if (is_file($file)) {
  40080. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40081. } elseif (is_dir($file)) {
  40082. $this->mkdir($target);
  40083. } else {
  40084. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40085. }
  40086. } else {
  40087. if (is_link($file)) {
  40088. $this->symlink($file->getLinkTarget(), $target);
  40089. } elseif (is_dir($file)) {
  40090. $this->mkdir($target);
  40091. } elseif (is_file($file)) {
  40092. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40093. } else {
  40094. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40095. }
  40096. }
  40097. }
  40098. }
  40099. public function isAbsolutePath($file)
  40100. {
  40101. return strspn($file, '/\\', 0, 1)
  40102. || (\strlen($file) > 3 && ctype_alpha($file[0])
  40103. && ':' === substr($file, 1, 1)
  40104. && strspn($file, '/\\', 2, 1)
  40105. )
  40106. || null !== parse_url($file, PHP_URL_SCHEME)
  40107. ;
  40108. }
  40109. public function tempnam($dir, $prefix)
  40110. {
  40111. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  40112. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  40113. $tmpFile = @tempnam($hierarchy, $prefix);
  40114. if (false !== $tmpFile) {
  40115. if (null !== $scheme && 'gs' !== $scheme) {
  40116. return $scheme.'://'.$tmpFile;
  40117. }
  40118. return $tmpFile;
  40119. }
  40120. throw new IOException('A temporary file could not be created.');
  40121. }
  40122. for ($i = 0; $i < 10; ++$i) {
  40123. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  40124. $handle = @fopen($tmpFile, 'x+');
  40125. if (false === $handle) {
  40126. continue;
  40127. }
  40128. @fclose($handle);
  40129. return $tmpFile;
  40130. }
  40131. throw new IOException('A temporary file could not be created.');
  40132. }
  40133. public function dumpFile($filename, $content, $mode = 0666)
  40134. {
  40135. $dir = \dirname($filename);
  40136. if (!is_dir($dir)) {
  40137. $this->mkdir($dir);
  40138. }
  40139. if (!is_writable($dir)) {
  40140. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  40141. }
  40142. $tmpFile = $this->tempnam($dir, basename($filename));
  40143. if (false === @file_put_contents($tmpFile, $content)) {
  40144. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  40145. }
  40146. if (null !== $mode) {
  40147. if (\func_num_args() > 2) {
  40148. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  40149. }
  40150. $this->chmod($tmpFile, $mode);
  40151. } elseif (file_exists($filename)) {
  40152. @chmod($tmpFile, fileperms($filename));
  40153. }
  40154. $this->rename($tmpFile, $filename, true);
  40155. }
  40156. private function toIterator($files)
  40157. {
  40158. if (!$files instanceof \Traversable) {
  40159. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  40160. }
  40161. return $files;
  40162. }
  40163. private function getSchemeAndHierarchy($filename)
  40164. {
  40165. $components = explode('://', $filename, 2);
  40166. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  40167. }
  40168. private static function box($func)
  40169. {
  40170. self::$lastError = null;
  40171. \set_error_handler(__CLASS__.'::handleError');
  40172. try {
  40173. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  40174. \restore_error_handler();
  40175. return $result;
  40176. } catch (\Throwable $e) {
  40177. } catch (\Exception $e) {
  40178. }
  40179. \restore_error_handler();
  40180. throw $e;
  40181. }
  40182. public static function handleError($type, $msg)
  40183. {
  40184. self::$lastError = $msg;
  40185. }
  40186. }
  40187. Copyright (c) 2004-2018 Fabien Potencier
  40188. Permission is hereby granted, free of charge, to any person obtaining a copy
  40189. of this software and associated documentation files (the "Software"), to deal
  40190. in the Software without restriction, including without limitation the rights
  40191. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40192. copies of the Software, and to permit persons to whom the Software is furnished
  40193. to do so, subject to the following conditions:
  40194. The above copyright notice and this permission notice shall be included in all
  40195. copies or substantial portions of the Software.
  40196. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40197. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40198. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40199. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40200. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40201. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40202. THE SOFTWARE.
  40203. <?php
  40204. namespace Symfony\Component\Filesystem;
  40205. use Symfony\Component\Filesystem\Exception\IOException;
  40206. class LockHandler
  40207. {
  40208. private $file;
  40209. private $handle;
  40210. public function __construct($name, $lockPath = null)
  40211. {
  40212. $lockPath = $lockPath ?: sys_get_temp_dir();
  40213. if (!is_dir($lockPath)) {
  40214. $fs = new Filesystem();
  40215. $fs->mkdir($lockPath);
  40216. }
  40217. if (!is_writable($lockPath)) {
  40218. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  40219. }
  40220. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  40221. }
  40222. public function lock($blocking = false)
  40223. {
  40224. if ($this->handle) {
  40225. return true;
  40226. }
  40227. $error = null;
  40228. set_error_handler(function ($errno, $msg) use (&$error) {
  40229. $error = $msg;
  40230. });
  40231. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40232. if ($this->handle = fopen($this->file, 'x')) {
  40233. chmod($this->file, 0666);
  40234. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40235. usleep(100);
  40236. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  40237. }
  40238. }
  40239. restore_error_handler();
  40240. if (!$this->handle) {
  40241. throw new IOException($error, 0, null, $this->file);
  40242. }
  40243. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  40244. fclose($this->handle);
  40245. $this->handle = null;
  40246. return false;
  40247. }
  40248. return true;
  40249. }
  40250. public function release()
  40251. {
  40252. if ($this->handle) {
  40253. flock($this->handle, LOCK_UN | LOCK_NB);
  40254. fclose($this->handle);
  40255. $this->handle = null;
  40256. }
  40257. }
  40258. }
  40259. <?php
  40260. namespace Symfony\Component\Finder\Adapter;
  40261. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40262. abstract class AbstractAdapter implements AdapterInterface
  40263. {
  40264. protected $followLinks = false;
  40265. protected $mode = 0;
  40266. protected $minDepth = 0;
  40267. protected $maxDepth = PHP_INT_MAX;
  40268. protected $exclude = array();
  40269. protected $names = array();
  40270. protected $notNames = array();
  40271. protected $contains = array();
  40272. protected $notContains = array();
  40273. protected $sizes = array();
  40274. protected $dates = array();
  40275. protected $filters = array();
  40276. protected $sort = false;
  40277. protected $paths = array();
  40278. protected $notPaths = array();
  40279. protected $ignoreUnreadableDirs = false;
  40280. private static $areSupported = array();
  40281. public function isSupported()
  40282. {
  40283. $name = $this->getName();
  40284. if (!array_key_exists($name, self::$areSupported)) {
  40285. self::$areSupported[$name] = $this->canBeUsed();
  40286. }
  40287. return self::$areSupported[$name];
  40288. }
  40289. public function setFollowLinks($followLinks)
  40290. {
  40291. $this->followLinks = $followLinks;
  40292. return $this;
  40293. }
  40294. public function setMode($mode)
  40295. {
  40296. $this->mode = $mode;
  40297. return $this;
  40298. }
  40299. public function setDepths(array $depths)
  40300. {
  40301. $this->minDepth = 0;
  40302. $this->maxDepth = PHP_INT_MAX;
  40303. foreach ($depths as $comparator) {
  40304. switch ($comparator->getOperator()) {
  40305. case '>':
  40306. $this->minDepth = $comparator->getTarget() + 1;
  40307. break;
  40308. case '>=':
  40309. $this->minDepth = $comparator->getTarget();
  40310. break;
  40311. case '<':
  40312. $this->maxDepth = $comparator->getTarget() - 1;
  40313. break;
  40314. case '<=':
  40315. $this->maxDepth = $comparator->getTarget();
  40316. break;
  40317. default:
  40318. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  40319. }
  40320. }
  40321. return $this;
  40322. }
  40323. public function setExclude(array $exclude)
  40324. {
  40325. $this->exclude = $exclude;
  40326. return $this;
  40327. }
  40328. public function setNames(array $names)
  40329. {
  40330. $this->names = $names;
  40331. return $this;
  40332. }
  40333. public function setNotNames(array $notNames)
  40334. {
  40335. $this->notNames = $notNames;
  40336. return $this;
  40337. }
  40338. public function setContains(array $contains)
  40339. {
  40340. $this->contains = $contains;
  40341. return $this;
  40342. }
  40343. public function setNotContains(array $notContains)
  40344. {
  40345. $this->notContains = $notContains;
  40346. return $this;
  40347. }
  40348. public function setSizes(array $sizes)
  40349. {
  40350. $this->sizes = $sizes;
  40351. return $this;
  40352. }
  40353. public function setDates(array $dates)
  40354. {
  40355. $this->dates = $dates;
  40356. return $this;
  40357. }
  40358. public function setFilters(array $filters)
  40359. {
  40360. $this->filters = $filters;
  40361. return $this;
  40362. }
  40363. public function setSort($sort)
  40364. {
  40365. $this->sort = $sort;
  40366. return $this;
  40367. }
  40368. public function setPath(array $paths)
  40369. {
  40370. $this->paths = $paths;
  40371. return $this;
  40372. }
  40373. public function setNotPath(array $notPaths)
  40374. {
  40375. $this->notPaths = $notPaths;
  40376. return $this;
  40377. }
  40378. public function ignoreUnreadableDirs($ignore = true)
  40379. {
  40380. $this->ignoreUnreadableDirs = (bool) $ignore;
  40381. return $this;
  40382. }
  40383. abstract protected function canBeUsed();
  40384. }
  40385. <?php
  40386. namespace Symfony\Component\Finder\Adapter;
  40387. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40388. use Symfony\Component\Finder\Comparator\DateComparator;
  40389. use Symfony\Component\Finder\Comparator\NumberComparator;
  40390. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40391. use Symfony\Component\Finder\Expression\Expression;
  40392. use Symfony\Component\Finder\Iterator;
  40393. use Symfony\Component\Finder\Shell\Command;
  40394. use Symfony\Component\Finder\Shell\Shell;
  40395. abstract class AbstractFindAdapter extends AbstractAdapter
  40396. {
  40397. protected $shell;
  40398. public function __construct()
  40399. {
  40400. $this->shell = new Shell();
  40401. }
  40402. public function searchInDirectory($dir)
  40403. {
  40404. $dir = realpath($dir);
  40405. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  40406. return new Iterator\FilePathsIterator(array(), $dir);
  40407. }
  40408. $command = Command::create();
  40409. $find = $this->buildFindCommand($command, $dir);
  40410. if ($this->followLinks) {
  40411. $find->add('-follow');
  40412. }
  40413. $find->add('-mindepth')->add($this->minDepth + 1);
  40414. if (PHP_INT_MAX !== $this->maxDepth) {
  40415. $find->add('-maxdepth')->add($this->maxDepth + 1);
  40416. }
  40417. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  40418. $find->add('-type d');
  40419. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  40420. $find->add('-type f');
  40421. }
  40422. $this->buildNamesFiltering($find, $this->names);
  40423. $this->buildNamesFiltering($find, $this->notNames, true);
  40424. $this->buildPathsFiltering($find, $dir, $this->paths);
  40425. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  40426. $this->buildSizesFiltering($find, $this->sizes);
  40427. $this->buildDatesFiltering($find, $this->dates);
  40428. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  40429. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  40430. if ($useGrep && ($this->contains || $this->notContains)) {
  40431. $grep = $command->ins('grep');
  40432. $this->buildContentFiltering($grep, $this->contains);
  40433. $this->buildContentFiltering($grep, $this->notContains, true);
  40434. }
  40435. if ($useSort) {
  40436. $this->buildSorting($command, $this->sort);
  40437. }
  40438. $command->setErrorHandler(
  40439. $this->ignoreUnreadableDirs
  40440. ? function ($stderr) { }
  40441. : function ($stderr) { throw new AccessDeniedException($stderr); }
  40442. );
  40443. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  40444. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  40445. if ($this->exclude) {
  40446. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40447. }
  40448. if (!$useGrep && ($this->contains || $this->notContains)) {
  40449. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40450. }
  40451. if ($this->filters) {
  40452. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40453. }
  40454. if (!$useSort && $this->sort) {
  40455. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40456. $iterator = $iteratorAggregate->getIterator();
  40457. }
  40458. return $iterator;
  40459. }
  40460. protected function canBeUsed()
  40461. {
  40462. return $this->shell->testCommand('find');
  40463. }
  40464. protected function buildFindCommand(Command $command, $dir)
  40465. {
  40466. return $command
  40467. ->ins('find')
  40468. ->add('find ')
  40469. ->arg($dir)
  40470. ->add('-noleaf');
  40471. }
  40472. private function buildNamesFiltering(Command $command, array $names, $not = false)
  40473. {
  40474. if (0 === \count($names)) {
  40475. return;
  40476. }
  40477. $command->add($not ? '-not' : null)->cmd('(');
  40478. foreach ($names as $i => $name) {
  40479. $expr = Expression::create($name);
  40480. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40481. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40482. }
  40483. if ($expr->isRegex()) {
  40484. $regex = $expr->getRegex();
  40485. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  40486. ->setStartFlag(false)
  40487. ->setStartJoker(true)
  40488. ->replaceJokers('[^/]');
  40489. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  40490. $regex->setEndJoker(false)->append('[^/]*');
  40491. }
  40492. }
  40493. $command
  40494. ->add($i > 0 ? '-or' : null)
  40495. ->add($expr->isRegex()
  40496. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40497. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  40498. )
  40499. ->arg($expr->renderPattern());
  40500. }
  40501. $command->cmd(')');
  40502. }
  40503. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  40504. {
  40505. if (0 === \count($paths)) {
  40506. return;
  40507. }
  40508. $command->add($not ? '-not' : null)->cmd('(');
  40509. foreach ($paths as $i => $path) {
  40510. $expr = Expression::create($path);
  40511. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40512. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40513. }
  40514. if ($expr->isRegex()) {
  40515. $regex = $expr->getRegex();
  40516. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  40517. } else {
  40518. $expr->prepend('*')->append('*');
  40519. }
  40520. $command
  40521. ->add($i > 0 ? '-or' : null)
  40522. ->add($expr->isRegex()
  40523. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40524. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  40525. )
  40526. ->arg($expr->renderPattern());
  40527. }
  40528. $command->cmd(')');
  40529. }
  40530. private function buildSizesFiltering(Command $command, array $sizes)
  40531. {
  40532. foreach ($sizes as $i => $size) {
  40533. $command->add($i > 0 ? '-and' : null);
  40534. switch ($size->getOperator()) {
  40535. case '<=':
  40536. $command->add('-size -'.($size->getTarget() + 1).'c');
  40537. break;
  40538. case '>=':
  40539. $command->add('-size +'.($size->getTarget() - 1).'c');
  40540. break;
  40541. case '>':
  40542. $command->add('-size +'.$size->getTarget().'c');
  40543. break;
  40544. case '!=':
  40545. $command->add('-size -'.$size->getTarget().'c');
  40546. $command->add('-size +'.$size->getTarget().'c');
  40547. break;
  40548. case '<':
  40549. default:
  40550. $command->add('-size -'.$size->getTarget().'c');
  40551. }
  40552. }
  40553. }
  40554. private function buildDatesFiltering(Command $command, array $dates)
  40555. {
  40556. foreach ($dates as $i => $date) {
  40557. $command->add($i > 0 ? '-and' : null);
  40558. $mins = (int) round((time() - $date->getTarget()) / 60);
  40559. if (0 > $mins) {
  40560. $command->add(' -mmin -0');
  40561. return;
  40562. }
  40563. switch ($date->getOperator()) {
  40564. case '<=':
  40565. $command->add('-mmin +'.($mins - 1));
  40566. break;
  40567. case '>=':
  40568. $command->add('-mmin -'.($mins + 1));
  40569. break;
  40570. case '>':
  40571. $command->add('-mmin -'.$mins);
  40572. break;
  40573. case '!=':
  40574. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  40575. break;
  40576. case '<':
  40577. default:
  40578. $command->add('-mmin +'.$mins);
  40579. }
  40580. }
  40581. }
  40582. private function buildSorting(Command $command, $sort)
  40583. {
  40584. $this->buildFormatSorting($command, $sort);
  40585. }
  40586. abstract protected function buildFormatSorting(Command $command, $sort);
  40587. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  40588. }
  40589. <?php
  40590. namespace Symfony\Component\Finder\Adapter;
  40591. interface AdapterInterface
  40592. {
  40593. public function setFollowLinks($followLinks);
  40594. public function setMode($mode);
  40595. public function setExclude(array $exclude);
  40596. public function setDepths(array $depths);
  40597. public function setNames(array $names);
  40598. public function setNotNames(array $notNames);
  40599. public function setContains(array $contains);
  40600. public function setNotContains(array $notContains);
  40601. public function setSizes(array $sizes);
  40602. public function setDates(array $dates);
  40603. public function setFilters(array $filters);
  40604. public function setSort($sort);
  40605. public function setPath(array $paths);
  40606. public function setNotPath(array $notPaths);
  40607. public function ignoreUnreadableDirs($ignore = true);
  40608. public function searchInDirectory($dir);
  40609. public function isSupported();
  40610. public function getName();
  40611. }
  40612. <?php
  40613. namespace Symfony\Component\Finder\Adapter;
  40614. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40615. use Symfony\Component\Finder\Expression\Expression;
  40616. use Symfony\Component\Finder\Iterator\SortableIterator;
  40617. use Symfony\Component\Finder\Shell\Command;
  40618. use Symfony\Component\Finder\Shell\Shell;
  40619. class BsdFindAdapter extends AbstractFindAdapter
  40620. {
  40621. public function getName()
  40622. {
  40623. return 'bsd_find';
  40624. }
  40625. protected function canBeUsed()
  40626. {
  40627. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  40628. }
  40629. protected function buildFormatSorting(Command $command, $sort)
  40630. {
  40631. switch ($sort) {
  40632. case SortableIterator::SORT_BY_NAME:
  40633. $command->ins('sort')->add('| sort');
  40634. return;
  40635. case SortableIterator::SORT_BY_TYPE:
  40636. $format = '%HT';
  40637. break;
  40638. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40639. $format = '%a';
  40640. break;
  40641. case SortableIterator::SORT_BY_CHANGED_TIME:
  40642. $format = '%c';
  40643. break;
  40644. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40645. $format = '%m';
  40646. break;
  40647. default:
  40648. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40649. }
  40650. $command
  40651. ->add('-print0 | xargs -0 stat -f')
  40652. ->arg($format.'%t%N')
  40653. ->add('| sort | cut -f 2');
  40654. }
  40655. protected function buildFindCommand(Command $command, $dir)
  40656. {
  40657. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  40658. return $command;
  40659. }
  40660. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40661. {
  40662. foreach ($contains as $contain) {
  40663. $expr = Expression::create($contain);
  40664. $command
  40665. ->add('| grep -v \'^$\'')
  40666. ->add('| xargs -I{} grep -I')
  40667. ->add($expr->isCaseSensitive() ? null : '-i')
  40668. ->add($not ? '-L' : '-l')
  40669. ->add('-Ee')->arg($expr->renderPattern())
  40670. ->add('{}')
  40671. ;
  40672. }
  40673. }
  40674. }
  40675. <?php
  40676. namespace Symfony\Component\Finder\Adapter;
  40677. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40678. use Symfony\Component\Finder\Expression\Expression;
  40679. use Symfony\Component\Finder\Iterator\SortableIterator;
  40680. use Symfony\Component\Finder\Shell\Command;
  40681. use Symfony\Component\Finder\Shell\Shell;
  40682. class GnuFindAdapter extends AbstractFindAdapter
  40683. {
  40684. public function getName()
  40685. {
  40686. return 'gnu_find';
  40687. }
  40688. protected function buildFormatSorting(Command $command, $sort)
  40689. {
  40690. switch ($sort) {
  40691. case SortableIterator::SORT_BY_NAME:
  40692. $command->ins('sort')->add('| sort');
  40693. return;
  40694. case SortableIterator::SORT_BY_TYPE:
  40695. $format = '%y';
  40696. break;
  40697. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40698. $format = '%A@';
  40699. break;
  40700. case SortableIterator::SORT_BY_CHANGED_TIME:
  40701. $format = '%C@';
  40702. break;
  40703. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40704. $format = '%T@';
  40705. break;
  40706. default:
  40707. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40708. }
  40709. $command
  40710. ->get('find')
  40711. ->add('-printf')
  40712. ->arg($format.' %h/%f\\n')
  40713. ->add('| sort | cut')
  40714. ->arg('-d ')
  40715. ->arg('-f2-')
  40716. ;
  40717. }
  40718. protected function canBeUsed()
  40719. {
  40720. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  40721. }
  40722. protected function buildFindCommand(Command $command, $dir)
  40723. {
  40724. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  40725. }
  40726. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40727. {
  40728. foreach ($contains as $contain) {
  40729. $expr = Expression::create($contain);
  40730. $command
  40731. ->add('| xargs -I{} -r grep -I')
  40732. ->add($expr->isCaseSensitive() ? null : '-i')
  40733. ->add($not ? '-L' : '-l')
  40734. ->add('-Ee')->arg($expr->renderPattern())
  40735. ->add('{}')
  40736. ;
  40737. }
  40738. }
  40739. }
  40740. <?php
  40741. namespace Symfony\Component\Finder\Adapter;
  40742. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40743. use Symfony\Component\Finder\Iterator;
  40744. class PhpAdapter extends AbstractAdapter
  40745. {
  40746. public function searchInDirectory($dir)
  40747. {
  40748. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40749. if ($this->followLinks) {
  40750. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40751. }
  40752. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40753. if ($this->exclude) {
  40754. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40755. }
  40756. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40757. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  40758. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  40759. }
  40760. if ($this->mode) {
  40761. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40762. }
  40763. if ($this->names || $this->notNames) {
  40764. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40765. }
  40766. if ($this->contains || $this->notContains) {
  40767. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40768. }
  40769. if ($this->sizes) {
  40770. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40771. }
  40772. if ($this->dates) {
  40773. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40774. }
  40775. if ($this->filters) {
  40776. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40777. }
  40778. if ($this->paths || $this->notPaths) {
  40779. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40780. }
  40781. if ($this->sort) {
  40782. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40783. $iterator = $iteratorAggregate->getIterator();
  40784. }
  40785. return $iterator;
  40786. }
  40787. public function getName()
  40788. {
  40789. return 'php';
  40790. }
  40791. protected function canBeUsed()
  40792. {
  40793. return true;
  40794. }
  40795. }
  40796. <?php
  40797. namespace Symfony\Component\Finder\Comparator;
  40798. class Comparator
  40799. {
  40800. private $target;
  40801. private $operator = '==';
  40802. public function getTarget()
  40803. {
  40804. return $this->target;
  40805. }
  40806. public function setTarget($target)
  40807. {
  40808. $this->target = $target;
  40809. }
  40810. public function getOperator()
  40811. {
  40812. return $this->operator;
  40813. }
  40814. public function setOperator($operator)
  40815. {
  40816. if (!$operator) {
  40817. $operator = '==';
  40818. }
  40819. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  40820. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  40821. }
  40822. $this->operator = $operator;
  40823. }
  40824. public function test($test)
  40825. {
  40826. switch ($this->operator) {
  40827. case '>':
  40828. return $test > $this->target;
  40829. case '>=':
  40830. return $test >= $this->target;
  40831. case '<':
  40832. return $test < $this->target;
  40833. case '<=':
  40834. return $test <= $this->target;
  40835. case '!=':
  40836. return $test != $this->target;
  40837. }
  40838. return $test == $this->target;
  40839. }
  40840. }
  40841. <?php
  40842. namespace Symfony\Component\Finder\Comparator;
  40843. class DateComparator extends Comparator
  40844. {
  40845. public function __construct($test)
  40846. {
  40847. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  40848. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  40849. }
  40850. try {
  40851. $date = new \DateTime($matches[2]);
  40852. $target = $date->format('U');
  40853. } catch (\Exception $e) {
  40854. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  40855. }
  40856. $operator = isset($matches[1]) ? $matches[1] : '==';
  40857. if ('since' === $operator || 'after' === $operator) {
  40858. $operator = '>';
  40859. }
  40860. if ('until' === $operator || 'before' === $operator) {
  40861. $operator = '<';
  40862. }
  40863. $this->setOperator($operator);
  40864. $this->setTarget($target);
  40865. }
  40866. }
  40867. <?php
  40868. namespace Symfony\Component\Finder\Comparator;
  40869. class NumberComparator extends Comparator
  40870. {
  40871. public function __construct($test)
  40872. {
  40873. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  40874. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  40875. }
  40876. $target = $matches[2];
  40877. if (!is_numeric($target)) {
  40878. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  40879. }
  40880. if (isset($matches[3])) {
  40881. switch (strtolower($matches[3])) {
  40882. case 'k':
  40883. $target *= 1000;
  40884. break;
  40885. case 'ki':
  40886. $target *= 1024;
  40887. break;
  40888. case 'm':
  40889. $target *= 1000000;
  40890. break;
  40891. case 'mi':
  40892. $target *= 1024 * 1024;
  40893. break;
  40894. case 'g':
  40895. $target *= 1000000000;
  40896. break;
  40897. case 'gi':
  40898. $target *= 1024 * 1024 * 1024;
  40899. break;
  40900. }
  40901. }
  40902. $this->setTarget($target);
  40903. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  40904. }
  40905. }
  40906. <?php
  40907. namespace Symfony\Component\Finder\Exception;
  40908. class AccessDeniedException extends \UnexpectedValueException
  40909. {
  40910. }
  40911. <?php
  40912. namespace Symfony\Component\Finder\Exception;
  40913. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40914. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40915. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  40916. {
  40917. private $adapter;
  40918. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  40919. {
  40920. $this->adapter = $adapter;
  40921. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  40922. }
  40923. public function getAdapter()
  40924. {
  40925. return $this->adapter;
  40926. }
  40927. }
  40928. <?php
  40929. namespace Symfony\Component\Finder\Exception;
  40930. interface ExceptionInterface
  40931. {
  40932. public function getAdapter();
  40933. }
  40934. <?php
  40935. namespace Symfony\Component\Finder\Exception;
  40936. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40937. class OperationNotPermitedException extends AdapterFailureException
  40938. {
  40939. }
  40940. <?php
  40941. namespace Symfony\Component\Finder\Exception;
  40942. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40943. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40944. use Symfony\Component\Finder\Shell\Command;
  40945. class ShellCommandFailureException extends AdapterFailureException
  40946. {
  40947. private $command;
  40948. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  40949. {
  40950. $this->command = $command;
  40951. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  40952. }
  40953. public function getCommand()
  40954. {
  40955. return $this->command;
  40956. }
  40957. }
  40958. <?php
  40959. namespace Symfony\Component\Finder\Expression;
  40960. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40961. class Expression implements ValueInterface
  40962. {
  40963. const TYPE_REGEX = 1;
  40964. const TYPE_GLOB = 2;
  40965. private $value;
  40966. public static function create($expr)
  40967. {
  40968. return new self($expr);
  40969. }
  40970. public function __construct($expr)
  40971. {
  40972. try {
  40973. $this->value = Regex::create($expr);
  40974. } catch (\InvalidArgumentException $e) {
  40975. $this->value = new Glob($expr);
  40976. }
  40977. }
  40978. public function __toString()
  40979. {
  40980. return $this->render();
  40981. }
  40982. public function render()
  40983. {
  40984. return $this->value->render();
  40985. }
  40986. public function renderPattern()
  40987. {
  40988. return $this->value->renderPattern();
  40989. }
  40990. public function isCaseSensitive()
  40991. {
  40992. return $this->value->isCaseSensitive();
  40993. }
  40994. public function getType()
  40995. {
  40996. return $this->value->getType();
  40997. }
  40998. public function prepend($expr)
  40999. {
  41000. $this->value->prepend($expr);
  41001. return $this;
  41002. }
  41003. public function append($expr)
  41004. {
  41005. $this->value->append($expr);
  41006. return $this;
  41007. }
  41008. public function isRegex()
  41009. {
  41010. return self::TYPE_REGEX === $this->value->getType();
  41011. }
  41012. public function isGlob()
  41013. {
  41014. return self::TYPE_GLOB === $this->value->getType();
  41015. }
  41016. public function getGlob()
  41017. {
  41018. if (self::TYPE_GLOB !== $this->value->getType()) {
  41019. throw new \LogicException('Regex can\'t be transformed to glob.');
  41020. }
  41021. return $this->value;
  41022. }
  41023. public function getRegex()
  41024. {
  41025. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  41026. }
  41027. }
  41028. <?php
  41029. namespace Symfony\Component\Finder\Expression;
  41030. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41031. use Symfony\Component\Finder\Glob as FinderGlob;
  41032. class Glob implements ValueInterface
  41033. {
  41034. private $pattern;
  41035. public function __construct($pattern)
  41036. {
  41037. $this->pattern = $pattern;
  41038. }
  41039. public function render()
  41040. {
  41041. return $this->pattern;
  41042. }
  41043. public function renderPattern()
  41044. {
  41045. return $this->pattern;
  41046. }
  41047. public function getType()
  41048. {
  41049. return Expression::TYPE_GLOB;
  41050. }
  41051. public function isCaseSensitive()
  41052. {
  41053. return true;
  41054. }
  41055. public function prepend($expr)
  41056. {
  41057. $this->pattern = $expr.$this->pattern;
  41058. return $this;
  41059. }
  41060. public function append($expr)
  41061. {
  41062. $this->pattern .= $expr;
  41063. return $this;
  41064. }
  41065. public function isExpandable()
  41066. {
  41067. return false !== strpos($this->pattern, '{')
  41068. && false !== strpos($this->pattern, '}');
  41069. }
  41070. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  41071. {
  41072. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  41073. return new Regex($regex);
  41074. }
  41075. }
  41076. <?php
  41077. namespace Symfony\Component\Finder\Expression;
  41078. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41079. class Regex implements ValueInterface
  41080. {
  41081. const START_FLAG = '^';
  41082. const END_FLAG = '$';
  41083. const BOUNDARY = '~';
  41084. const JOKER = '.*';
  41085. const ESCAPING = '\\';
  41086. private $pattern;
  41087. private $options;
  41088. private $startFlag;
  41089. private $endFlag;
  41090. private $startJoker;
  41091. private $endJoker;
  41092. public static function create($expr)
  41093. {
  41094. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  41095. $start = substr($m[1], 0, 1);
  41096. $end = substr($m[1], -1);
  41097. if (
  41098. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  41099. || ('{' === $start && '}' === $end)
  41100. || ('(' === $start && ')' === $end)
  41101. ) {
  41102. return new self(substr($m[1], 1, -1), $m[2], $end);
  41103. }
  41104. }
  41105. throw new \InvalidArgumentException('Given expression is not a regex.');
  41106. }
  41107. public function __construct($pattern, $options = '', $delimiter = null)
  41108. {
  41109. if (null !== $delimiter) {
  41110. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  41111. }
  41112. $this->parsePattern($pattern);
  41113. $this->options = $options;
  41114. }
  41115. public function __toString()
  41116. {
  41117. return $this->render();
  41118. }
  41119. public function render()
  41120. {
  41121. return self::BOUNDARY
  41122. .$this->renderPattern()
  41123. .self::BOUNDARY
  41124. .$this->options;
  41125. }
  41126. public function renderPattern()
  41127. {
  41128. return ($this->startFlag ? self::START_FLAG : '')
  41129. .($this->startJoker ? self::JOKER : '')
  41130. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  41131. .($this->endJoker ? self::JOKER : '')
  41132. .($this->endFlag ? self::END_FLAG : '');
  41133. }
  41134. public function isCaseSensitive()
  41135. {
  41136. return !$this->hasOption('i');
  41137. }
  41138. public function getType()
  41139. {
  41140. return Expression::TYPE_REGEX;
  41141. }
  41142. public function prepend($expr)
  41143. {
  41144. $this->pattern = $expr.$this->pattern;
  41145. return $this;
  41146. }
  41147. public function append($expr)
  41148. {
  41149. $this->pattern .= $expr;
  41150. return $this;
  41151. }
  41152. public function hasOption($option)
  41153. {
  41154. return false !== strpos($this->options, $option);
  41155. }
  41156. public function addOption($option)
  41157. {
  41158. if (!$this->hasOption($option)) {
  41159. $this->options .= $option;
  41160. }
  41161. return $this;
  41162. }
  41163. public function removeOption($option)
  41164. {
  41165. $this->options = str_replace($option, '', $this->options);
  41166. return $this;
  41167. }
  41168. public function setStartFlag($startFlag)
  41169. {
  41170. $this->startFlag = $startFlag;
  41171. return $this;
  41172. }
  41173. public function hasStartFlag()
  41174. {
  41175. return $this->startFlag;
  41176. }
  41177. public function setEndFlag($endFlag)
  41178. {
  41179. $this->endFlag = (bool) $endFlag;
  41180. return $this;
  41181. }
  41182. public function hasEndFlag()
  41183. {
  41184. return $this->endFlag;
  41185. }
  41186. public function setStartJoker($startJoker)
  41187. {
  41188. $this->startJoker = $startJoker;
  41189. return $this;
  41190. }
  41191. public function hasStartJoker()
  41192. {
  41193. return $this->startJoker;
  41194. }
  41195. public function setEndJoker($endJoker)
  41196. {
  41197. $this->endJoker = (bool) $endJoker;
  41198. return $this;
  41199. }
  41200. public function hasEndJoker()
  41201. {
  41202. return $this->endJoker;
  41203. }
  41204. public function replaceJokers($replacement)
  41205. {
  41206. $replace = function ($subject) use ($replacement) {
  41207. $subject = $subject[0];
  41208. $replace = 0 === substr_count($subject, '\\') % 2;
  41209. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  41210. };
  41211. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  41212. return $this;
  41213. }
  41214. private function parsePattern($pattern)
  41215. {
  41216. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  41217. $pattern = substr($pattern, 1);
  41218. }
  41219. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  41220. $pattern = substr($pattern, 2);
  41221. }
  41222. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  41223. $pattern = substr($pattern, 0, -1);
  41224. }
  41225. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  41226. $pattern = substr($pattern, 0, -2);
  41227. }
  41228. $this->pattern = $pattern;
  41229. }
  41230. }
  41231. <?php
  41232. namespace Symfony\Component\Finder\Expression;
  41233. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41234. interface ValueInterface
  41235. {
  41236. public function render();
  41237. public function renderPattern();
  41238. public function isCaseSensitive();
  41239. public function getType();
  41240. public function prepend($expr);
  41241. public function append($expr);
  41242. }
  41243. <?php
  41244. namespace Symfony\Component\Finder;
  41245. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41246. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  41247. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  41248. use Symfony\Component\Finder\Adapter\PhpAdapter;
  41249. use Symfony\Component\Finder\Comparator\DateComparator;
  41250. use Symfony\Component\Finder\Comparator\NumberComparator;
  41251. use Symfony\Component\Finder\Exception\ExceptionInterface;
  41252. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  41253. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  41254. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  41255. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  41256. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  41257. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  41258. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  41259. use Symfony\Component\Finder\Iterator\SortableIterator;
  41260. class Finder implements \IteratorAggregate, \Countable
  41261. {
  41262. const IGNORE_VCS_FILES = 1;
  41263. const IGNORE_DOT_FILES = 2;
  41264. private $mode = 0;
  41265. private $names = array();
  41266. private $notNames = array();
  41267. private $exclude = array();
  41268. private $filters = array();
  41269. private $depths = array();
  41270. private $sizes = array();
  41271. private $followLinks = false;
  41272. private $sort = false;
  41273. private $ignore = 0;
  41274. private $dirs = array();
  41275. private $dates = array();
  41276. private $iterators = array();
  41277. private $contains = array();
  41278. private $notContains = array();
  41279. private $adapters = null;
  41280. private $paths = array();
  41281. private $notPaths = array();
  41282. private $ignoreUnreadableDirs = false;
  41283. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  41284. public function __construct()
  41285. {
  41286. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  41287. }
  41288. public static function create()
  41289. {
  41290. return new static();
  41291. }
  41292. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  41293. {
  41294. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41295. $this->initDefaultAdapters();
  41296. $this->adapters[$adapter->getName()] = array(
  41297. 'adapter' => $adapter,
  41298. 'priority' => $priority,
  41299. 'selected' => false,
  41300. );
  41301. return $this->sortAdapters();
  41302. }
  41303. public function useBestAdapter()
  41304. {
  41305. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41306. $this->initDefaultAdapters();
  41307. $this->resetAdapterSelection();
  41308. return $this->sortAdapters();
  41309. }
  41310. public function setAdapter($name)
  41311. {
  41312. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41313. $this->initDefaultAdapters();
  41314. if (!isset($this->adapters[$name])) {
  41315. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  41316. }
  41317. $this->resetAdapterSelection();
  41318. $this->adapters[$name]['selected'] = true;
  41319. return $this->sortAdapters();
  41320. }
  41321. public function removeAdapters()
  41322. {
  41323. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41324. $this->adapters = array();
  41325. return $this;
  41326. }
  41327. public function getAdapters()
  41328. {
  41329. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41330. $this->initDefaultAdapters();
  41331. return array_values(array_map(function (array $adapter) {
  41332. return $adapter['adapter'];
  41333. }, $this->adapters));
  41334. }
  41335. public function directories()
  41336. {
  41337. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  41338. return $this;
  41339. }
  41340. public function files()
  41341. {
  41342. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  41343. return $this;
  41344. }
  41345. public function depth($level)
  41346. {
  41347. $this->depths[] = new Comparator\NumberComparator($level);
  41348. return $this;
  41349. }
  41350. public function date($date)
  41351. {
  41352. $this->dates[] = new Comparator\DateComparator($date);
  41353. return $this;
  41354. }
  41355. public function name($pattern)
  41356. {
  41357. $this->names[] = $pattern;
  41358. return $this;
  41359. }
  41360. public function notName($pattern)
  41361. {
  41362. $this->notNames[] = $pattern;
  41363. return $this;
  41364. }
  41365. public function contains($pattern)
  41366. {
  41367. $this->contains[] = $pattern;
  41368. return $this;
  41369. }
  41370. public function notContains($pattern)
  41371. {
  41372. $this->notContains[] = $pattern;
  41373. return $this;
  41374. }
  41375. public function path($pattern)
  41376. {
  41377. $this->paths[] = $pattern;
  41378. return $this;
  41379. }
  41380. public function notPath($pattern)
  41381. {
  41382. $this->notPaths[] = $pattern;
  41383. return $this;
  41384. }
  41385. public function size($size)
  41386. {
  41387. $this->sizes[] = new Comparator\NumberComparator($size);
  41388. return $this;
  41389. }
  41390. public function exclude($dirs)
  41391. {
  41392. $this->exclude = array_merge($this->exclude, (array) $dirs);
  41393. return $this;
  41394. }
  41395. public function ignoreDotFiles($ignoreDotFiles)
  41396. {
  41397. if ($ignoreDotFiles) {
  41398. $this->ignore |= static::IGNORE_DOT_FILES;
  41399. } else {
  41400. $this->ignore &= ~static::IGNORE_DOT_FILES;
  41401. }
  41402. return $this;
  41403. }
  41404. public function ignoreVCS($ignoreVCS)
  41405. {
  41406. if ($ignoreVCS) {
  41407. $this->ignore |= static::IGNORE_VCS_FILES;
  41408. } else {
  41409. $this->ignore &= ~static::IGNORE_VCS_FILES;
  41410. }
  41411. return $this;
  41412. }
  41413. public static function addVCSPattern($pattern)
  41414. {
  41415. foreach ((array) $pattern as $p) {
  41416. self::$vcsPatterns[] = $p;
  41417. }
  41418. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  41419. }
  41420. public function sort(\Closure $closure)
  41421. {
  41422. $this->sort = $closure;
  41423. return $this;
  41424. }
  41425. public function sortByName()
  41426. {
  41427. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  41428. return $this;
  41429. }
  41430. public function sortByType()
  41431. {
  41432. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  41433. return $this;
  41434. }
  41435. public function sortByAccessedTime()
  41436. {
  41437. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41438. return $this;
  41439. }
  41440. public function sortByChangedTime()
  41441. {
  41442. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  41443. return $this;
  41444. }
  41445. public function sortByModifiedTime()
  41446. {
  41447. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  41448. return $this;
  41449. }
  41450. public function filter(\Closure $closure)
  41451. {
  41452. $this->filters[] = $closure;
  41453. return $this;
  41454. }
  41455. public function followLinks()
  41456. {
  41457. $this->followLinks = true;
  41458. return $this;
  41459. }
  41460. public function ignoreUnreadableDirs($ignore = true)
  41461. {
  41462. $this->ignoreUnreadableDirs = (bool) $ignore;
  41463. return $this;
  41464. }
  41465. public function in($dirs)
  41466. {
  41467. $resolvedDirs = array();
  41468. foreach ((array) $dirs as $dir) {
  41469. if (is_dir($dir)) {
  41470. $resolvedDirs[] = $this->normalizeDir($dir);
  41471. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  41472. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  41473. } else {
  41474. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  41475. }
  41476. }
  41477. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  41478. return $this;
  41479. }
  41480. public function getIterator()
  41481. {
  41482. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41483. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  41484. }
  41485. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41486. return $this->searchInDirectory($this->dirs[0]);
  41487. }
  41488. $iterator = new \AppendIterator();
  41489. foreach ($this->dirs as $dir) {
  41490. $iterator->append($this->searchInDirectory($dir));
  41491. }
  41492. foreach ($this->iterators as $it) {
  41493. $iterator->append($it);
  41494. }
  41495. return $iterator;
  41496. }
  41497. public function append($iterator)
  41498. {
  41499. if ($iterator instanceof \IteratorAggregate) {
  41500. $this->iterators[] = $iterator->getIterator();
  41501. } elseif ($iterator instanceof \Iterator) {
  41502. $this->iterators[] = $iterator;
  41503. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  41504. $it = new \ArrayIterator();
  41505. foreach ($iterator as $file) {
  41506. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  41507. }
  41508. $this->iterators[] = $it;
  41509. } else {
  41510. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  41511. }
  41512. return $this;
  41513. }
  41514. public function count()
  41515. {
  41516. return iterator_count($this->getIterator());
  41517. }
  41518. private function sortAdapters()
  41519. {
  41520. uasort($this->adapters, function (array $a, array $b) {
  41521. if ($a['selected'] || $b['selected']) {
  41522. return $a['selected'] ? -1 : 1;
  41523. }
  41524. return $a['priority'] > $b['priority'] ? -1 : 1;
  41525. });
  41526. return $this;
  41527. }
  41528. private function searchInDirectory($dir)
  41529. {
  41530. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  41531. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  41532. }
  41533. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  41534. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  41535. }
  41536. if ($this->adapters) {
  41537. foreach ($this->adapters as $adapter) {
  41538. if ($adapter['adapter']->isSupported()) {
  41539. try {
  41540. return $this
  41541. ->buildAdapter($adapter['adapter'])
  41542. ->searchInDirectory($dir);
  41543. } catch (ExceptionInterface $e) {
  41544. }
  41545. }
  41546. }
  41547. }
  41548. $minDepth = 0;
  41549. $maxDepth = PHP_INT_MAX;
  41550. foreach ($this->depths as $comparator) {
  41551. switch ($comparator->getOperator()) {
  41552. case '>':
  41553. $minDepth = $comparator->getTarget() + 1;
  41554. break;
  41555. case '>=':
  41556. $minDepth = $comparator->getTarget();
  41557. break;
  41558. case '<':
  41559. $maxDepth = $comparator->getTarget() - 1;
  41560. break;
  41561. case '<=':
  41562. $maxDepth = $comparator->getTarget();
  41563. break;
  41564. default:
  41565. $minDepth = $maxDepth = $comparator->getTarget();
  41566. }
  41567. }
  41568. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41569. if ($this->followLinks) {
  41570. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41571. }
  41572. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41573. if ($this->exclude) {
  41574. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41575. }
  41576. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41577. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  41578. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  41579. }
  41580. if ($this->mode) {
  41581. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41582. }
  41583. if ($this->names || $this->notNames) {
  41584. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41585. }
  41586. if ($this->contains || $this->notContains) {
  41587. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41588. }
  41589. if ($this->sizes) {
  41590. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41591. }
  41592. if ($this->dates) {
  41593. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41594. }
  41595. if ($this->filters) {
  41596. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41597. }
  41598. if ($this->paths || $this->notPaths) {
  41599. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41600. }
  41601. if ($this->sort) {
  41602. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41603. $iterator = $iteratorAggregate->getIterator();
  41604. }
  41605. return $iterator;
  41606. }
  41607. private function buildAdapter(AdapterInterface $adapter)
  41608. {
  41609. return $adapter
  41610. ->setFollowLinks($this->followLinks)
  41611. ->setDepths($this->depths)
  41612. ->setMode($this->mode)
  41613. ->setExclude($this->exclude)
  41614. ->setNames($this->names)
  41615. ->setNotNames($this->notNames)
  41616. ->setContains($this->contains)
  41617. ->setNotContains($this->notContains)
  41618. ->setSizes($this->sizes)
  41619. ->setDates($this->dates)
  41620. ->setFilters($this->filters)
  41621. ->setSort($this->sort)
  41622. ->setPath($this->paths)
  41623. ->setNotPath($this->notPaths)
  41624. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  41625. }
  41626. private function resetAdapterSelection()
  41627. {
  41628. $this->adapters = array_map(function (array $properties) {
  41629. $properties['selected'] = false;
  41630. return $properties;
  41631. }, $this->adapters);
  41632. }
  41633. private function initDefaultAdapters()
  41634. {
  41635. if (null === $this->adapters) {
  41636. $this->adapters = array();
  41637. $this
  41638. ->addAdapter(new GnuFindAdapter())
  41639. ->addAdapter(new BsdFindAdapter())
  41640. ->addAdapter(new PhpAdapter(), -50)
  41641. ->setAdapter('php')
  41642. ;
  41643. }
  41644. }
  41645. private function normalizeDir($dir)
  41646. {
  41647. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  41648. }
  41649. }
  41650. <?php
  41651. namespace Symfony\Component\Finder;
  41652. class Glob
  41653. {
  41654. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  41655. {
  41656. $firstByte = true;
  41657. $escaping = false;
  41658. $inCurlies = 0;
  41659. $regex = '';
  41660. $sizeGlob = \strlen($glob);
  41661. for ($i = 0; $i < $sizeGlob; ++$i) {
  41662. $car = $glob[$i];
  41663. if ($firstByte) {
  41664. if ($strictLeadingDot && '.' !== $car) {
  41665. $regex .= '(?=[^\.])';
  41666. }
  41667. $firstByte = false;
  41668. }
  41669. if ('/' === $car) {
  41670. $firstByte = true;
  41671. }
  41672. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  41673. $regex .= "\\$car";
  41674. } elseif ('*' === $car) {
  41675. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  41676. } elseif ('?' === $car) {
  41677. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  41678. } elseif ('{' === $car) {
  41679. $regex .= $escaping ? '\\{' : '(';
  41680. if (!$escaping) {
  41681. ++$inCurlies;
  41682. }
  41683. } elseif ('}' === $car && $inCurlies) {
  41684. $regex .= $escaping ? '}' : ')';
  41685. if (!$escaping) {
  41686. --$inCurlies;
  41687. }
  41688. } elseif (',' === $car && $inCurlies) {
  41689. $regex .= $escaping ? ',' : '|';
  41690. } elseif ('\\' === $car) {
  41691. if ($escaping) {
  41692. $regex .= '\\\\';
  41693. $escaping = false;
  41694. } else {
  41695. $escaping = true;
  41696. }
  41697. continue;
  41698. } else {
  41699. $regex .= $car;
  41700. }
  41701. $escaping = false;
  41702. }
  41703. return $delimiter.'^'.$regex.'$'.$delimiter;
  41704. }
  41705. }
  41706. <?php
  41707. namespace Symfony\Component\Finder\Iterator;
  41708. class CustomFilterIterator extends FilterIterator
  41709. {
  41710. private $filters = array();
  41711. public function __construct(\Iterator $iterator, array $filters)
  41712. {
  41713. foreach ($filters as $filter) {
  41714. if (!\is_callable($filter)) {
  41715. throw new \InvalidArgumentException('Invalid PHP callback.');
  41716. }
  41717. }
  41718. $this->filters = $filters;
  41719. parent::__construct($iterator);
  41720. }
  41721. public function accept()
  41722. {
  41723. $fileinfo = $this->current();
  41724. foreach ($this->filters as $filter) {
  41725. if (false === \call_user_func($filter, $fileinfo)) {
  41726. return false;
  41727. }
  41728. }
  41729. return true;
  41730. }
  41731. }
  41732. <?php
  41733. namespace Symfony\Component\Finder\Iterator;
  41734. use Symfony\Component\Finder\Comparator\DateComparator;
  41735. class DateRangeFilterIterator extends FilterIterator
  41736. {
  41737. private $comparators = array();
  41738. public function __construct(\Iterator $iterator, array $comparators)
  41739. {
  41740. $this->comparators = $comparators;
  41741. parent::__construct($iterator);
  41742. }
  41743. public function accept()
  41744. {
  41745. $fileinfo = $this->current();
  41746. if (!file_exists($fileinfo->getPathname())) {
  41747. return false;
  41748. }
  41749. $filedate = $fileinfo->getMTime();
  41750. foreach ($this->comparators as $compare) {
  41751. if (!$compare->test($filedate)) {
  41752. return false;
  41753. }
  41754. }
  41755. return true;
  41756. }
  41757. }
  41758. <?php
  41759. namespace Symfony\Component\Finder\Iterator;
  41760. class DepthRangeFilterIterator extends FilterIterator
  41761. {
  41762. private $minDepth = 0;
  41763. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  41764. {
  41765. $this->minDepth = $minDepth;
  41766. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  41767. parent::__construct($iterator);
  41768. }
  41769. public function accept()
  41770. {
  41771. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  41772. }
  41773. }
  41774. <?php
  41775. namespace Symfony\Component\Finder\Iterator;
  41776. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  41777. {
  41778. private $iterator;
  41779. private $isRecursive;
  41780. private $excludedDirs = array();
  41781. private $excludedPattern;
  41782. public function __construct(\Iterator $iterator, array $directories)
  41783. {
  41784. $this->iterator = $iterator;
  41785. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  41786. $patterns = array();
  41787. foreach ($directories as $directory) {
  41788. $directory = rtrim($directory, '/');
  41789. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  41790. $patterns[] = preg_quote($directory, '#');
  41791. } else {
  41792. $this->excludedDirs[$directory] = true;
  41793. }
  41794. }
  41795. if ($patterns) {
  41796. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  41797. }
  41798. parent::__construct($iterator);
  41799. }
  41800. public function accept()
  41801. {
  41802. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  41803. return false;
  41804. }
  41805. if ($this->excludedPattern) {
  41806. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  41807. $path = str_replace('\\', '/', $path);
  41808. return !preg_match($this->excludedPattern, $path);
  41809. }
  41810. return true;
  41811. }
  41812. public function hasChildren()
  41813. {
  41814. return $this->isRecursive && $this->iterator->hasChildren();
  41815. }
  41816. public function getChildren()
  41817. {
  41818. $children = new self($this->iterator->getChildren(), array());
  41819. $children->excludedDirs = $this->excludedDirs;
  41820. $children->excludedPattern = $this->excludedPattern;
  41821. return $children;
  41822. }
  41823. }
  41824. <?php
  41825. namespace Symfony\Component\Finder\Iterator;
  41826. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41827. use Symfony\Component\Finder\SplFileInfo;
  41828. class FilePathsIterator extends \ArrayIterator
  41829. {
  41830. private $baseDir;
  41831. private $baseDirLength;
  41832. private $subPath;
  41833. private $subPathname;
  41834. private $current;
  41835. public function __construct(array $paths, $baseDir)
  41836. {
  41837. $this->baseDir = $baseDir;
  41838. $this->baseDirLength = \strlen($baseDir);
  41839. parent::__construct($paths);
  41840. }
  41841. public function __call($name, array $arguments)
  41842. {
  41843. return \call_user_func_array(array($this->current(), $name), $arguments);
  41844. }
  41845. public function current()
  41846. {
  41847. return $this->current;
  41848. }
  41849. public function key()
  41850. {
  41851. return $this->current->getPathname();
  41852. }
  41853. public function next()
  41854. {
  41855. parent::next();
  41856. $this->buildProperties();
  41857. }
  41858. public function rewind()
  41859. {
  41860. parent::rewind();
  41861. $this->buildProperties();
  41862. }
  41863. public function getSubPath()
  41864. {
  41865. return $this->subPath;
  41866. }
  41867. public function getSubPathname()
  41868. {
  41869. return $this->subPathname;
  41870. }
  41871. private function buildProperties()
  41872. {
  41873. $absolutePath = parent::current();
  41874. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  41875. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  41876. $dir = \dirname($this->subPathname);
  41877. $this->subPath = '.' === $dir ? '' : $dir;
  41878. } else {
  41879. $this->subPath = $this->subPathname = '';
  41880. }
  41881. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  41882. }
  41883. }
  41884. <?php
  41885. namespace Symfony\Component\Finder\Iterator;
  41886. class FileTypeFilterIterator extends FilterIterator
  41887. {
  41888. const ONLY_FILES = 1;
  41889. const ONLY_DIRECTORIES = 2;
  41890. private $mode;
  41891. public function __construct(\Iterator $iterator, $mode)
  41892. {
  41893. $this->mode = $mode;
  41894. parent::__construct($iterator);
  41895. }
  41896. public function accept()
  41897. {
  41898. $fileinfo = $this->current();
  41899. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  41900. return false;
  41901. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  41902. return false;
  41903. }
  41904. return true;
  41905. }
  41906. }
  41907. <?php
  41908. namespace Symfony\Component\Finder\Iterator;
  41909. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  41910. {
  41911. public function accept()
  41912. {
  41913. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  41914. return true;
  41915. }
  41916. $fileinfo = $this->current();
  41917. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  41918. return false;
  41919. }
  41920. $content = $fileinfo->getContents();
  41921. if (!$content) {
  41922. return false;
  41923. }
  41924. return $this->isAccepted($content);
  41925. }
  41926. protected function toRegex($str)
  41927. {
  41928. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41929. }
  41930. }
  41931. <?php
  41932. namespace Symfony\Component\Finder\Iterator;
  41933. use Symfony\Component\Finder\Glob;
  41934. class FilenameFilterIterator extends MultiplePcreFilterIterator
  41935. {
  41936. public function accept()
  41937. {
  41938. return $this->isAccepted($this->current()->getFilename());
  41939. }
  41940. protected function toRegex($str)
  41941. {
  41942. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  41943. }
  41944. }
  41945. <?php
  41946. namespace Symfony\Component\Finder\Iterator;
  41947. abstract class FilterIterator extends \FilterIterator
  41948. {
  41949. public function rewind()
  41950. {
  41951. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  41952. parent::rewind();
  41953. return;
  41954. }
  41955. $iterator = $this;
  41956. while ($iterator instanceof \OuterIterator) {
  41957. $innerIterator = $iterator->getInnerIterator();
  41958. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  41959. if ($innerIterator->isRewindable()) {
  41960. $innerIterator->next();
  41961. $innerIterator->rewind();
  41962. }
  41963. } elseif ($innerIterator instanceof \FilesystemIterator) {
  41964. $innerIterator->next();
  41965. $innerIterator->rewind();
  41966. }
  41967. $iterator = $innerIterator;
  41968. }
  41969. parent::rewind();
  41970. }
  41971. }
  41972. <?php
  41973. namespace Symfony\Component\Finder\Iterator;
  41974. abstract class MultiplePcreFilterIterator extends FilterIterator
  41975. {
  41976. protected $matchRegexps = array();
  41977. protected $noMatchRegexps = array();
  41978. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  41979. {
  41980. foreach ($matchPatterns as $pattern) {
  41981. $this->matchRegexps[] = $this->toRegex($pattern);
  41982. }
  41983. foreach ($noMatchPatterns as $pattern) {
  41984. $this->noMatchRegexps[] = $this->toRegex($pattern);
  41985. }
  41986. parent::__construct($iterator);
  41987. }
  41988. protected function isAccepted($string)
  41989. {
  41990. foreach ($this->noMatchRegexps as $regex) {
  41991. if (preg_match($regex, $string)) {
  41992. return false;
  41993. }
  41994. }
  41995. if ($this->matchRegexps) {
  41996. foreach ($this->matchRegexps as $regex) {
  41997. if (preg_match($regex, $string)) {
  41998. return true;
  41999. }
  42000. }
  42001. return false;
  42002. }
  42003. return true;
  42004. }
  42005. protected function isRegex($str)
  42006. {
  42007. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  42008. $start = substr($m[1], 0, 1);
  42009. $end = substr($m[1], -1);
  42010. if ($start === $end) {
  42011. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  42012. }
  42013. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  42014. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  42015. return true;
  42016. }
  42017. }
  42018. }
  42019. return false;
  42020. }
  42021. abstract protected function toRegex($str);
  42022. }
  42023. <?php
  42024. namespace Symfony\Component\Finder\Iterator;
  42025. class PathFilterIterator extends MultiplePcreFilterIterator
  42026. {
  42027. public function accept()
  42028. {
  42029. $filename = $this->current()->getRelativePathname();
  42030. if ('\\' === \DIRECTORY_SEPARATOR) {
  42031. $filename = str_replace('\\', '/', $filename);
  42032. }
  42033. return $this->isAccepted($filename);
  42034. }
  42035. protected function toRegex($str)
  42036. {
  42037. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42038. }
  42039. }
  42040. <?php
  42041. namespace Symfony\Component\Finder\Iterator;
  42042. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42043. use Symfony\Component\Finder\SplFileInfo;
  42044. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  42045. {
  42046. private $ignoreUnreadableDirs;
  42047. private $rewindable;
  42048. private $rootPath;
  42049. private $subPath;
  42050. private $directorySeparator = '/';
  42051. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  42052. {
  42053. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  42054. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  42055. }
  42056. parent::__construct($path, $flags);
  42057. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  42058. $this->rootPath = (string) $path;
  42059. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  42060. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  42061. }
  42062. }
  42063. public function current()
  42064. {
  42065. if (null === $subPathname = $this->subPath) {
  42066. $subPathname = $this->subPath = (string) $this->getSubPath();
  42067. }
  42068. if ('' !== $subPathname) {
  42069. $subPathname .= $this->directorySeparator;
  42070. }
  42071. $subPathname .= $this->getFilename();
  42072. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  42073. }
  42074. public function getChildren()
  42075. {
  42076. try {
  42077. $children = parent::getChildren();
  42078. if ($children instanceof self) {
  42079. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  42080. $children->rewindable = &$this->rewindable;
  42081. $children->rootPath = $this->rootPath;
  42082. }
  42083. return $children;
  42084. } catch (\UnexpectedValueException $e) {
  42085. if ($this->ignoreUnreadableDirs) {
  42086. return new \RecursiveArrayIterator(array());
  42087. } else {
  42088. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  42089. }
  42090. }
  42091. }
  42092. public function rewind()
  42093. {
  42094. if (false === $this->isRewindable()) {
  42095. return;
  42096. }
  42097. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  42098. parent::next();
  42099. }
  42100. parent::rewind();
  42101. }
  42102. public function isRewindable()
  42103. {
  42104. if (null !== $this->rewindable) {
  42105. return $this->rewindable;
  42106. }
  42107. if ('' === $this->getPath()) {
  42108. return $this->rewindable = false;
  42109. }
  42110. if (false !== $stream = @opendir($this->getPath())) {
  42111. $infos = stream_get_meta_data($stream);
  42112. closedir($stream);
  42113. if ($infos['seekable']) {
  42114. return $this->rewindable = true;
  42115. }
  42116. }
  42117. return $this->rewindable = false;
  42118. }
  42119. }
  42120. <?php
  42121. namespace Symfony\Component\Finder\Iterator;
  42122. use Symfony\Component\Finder\Comparator\NumberComparator;
  42123. class SizeRangeFilterIterator extends FilterIterator
  42124. {
  42125. private $comparators = array();
  42126. public function __construct(\Iterator $iterator, array $comparators)
  42127. {
  42128. $this->comparators = $comparators;
  42129. parent::__construct($iterator);
  42130. }
  42131. public function accept()
  42132. {
  42133. $fileinfo = $this->current();
  42134. if (!$fileinfo->isFile()) {
  42135. return true;
  42136. }
  42137. $filesize = $fileinfo->getSize();
  42138. foreach ($this->comparators as $compare) {
  42139. if (!$compare->test($filesize)) {
  42140. return false;
  42141. }
  42142. }
  42143. return true;
  42144. }
  42145. }
  42146. <?php
  42147. namespace Symfony\Component\Finder\Iterator;
  42148. class SortableIterator implements \IteratorAggregate
  42149. {
  42150. const SORT_BY_NAME = 1;
  42151. const SORT_BY_TYPE = 2;
  42152. const SORT_BY_ACCESSED_TIME = 3;
  42153. const SORT_BY_CHANGED_TIME = 4;
  42154. const SORT_BY_MODIFIED_TIME = 5;
  42155. private $iterator;
  42156. private $sort;
  42157. public function __construct(\Traversable $iterator, $sort)
  42158. {
  42159. $this->iterator = $iterator;
  42160. if (self::SORT_BY_NAME === $sort) {
  42161. $this->sort = function ($a, $b) {
  42162. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42163. };
  42164. } elseif (self::SORT_BY_TYPE === $sort) {
  42165. $this->sort = function ($a, $b) {
  42166. if ($a->isDir() && $b->isFile()) {
  42167. return -1;
  42168. } elseif ($a->isFile() && $b->isDir()) {
  42169. return 1;
  42170. }
  42171. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42172. };
  42173. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  42174. $this->sort = function ($a, $b) {
  42175. return $a->getATime() - $b->getATime();
  42176. };
  42177. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  42178. $this->sort = function ($a, $b) {
  42179. return $a->getCTime() - $b->getCTime();
  42180. };
  42181. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  42182. $this->sort = function ($a, $b) {
  42183. return $a->getMTime() - $b->getMTime();
  42184. };
  42185. } elseif (\is_callable($sort)) {
  42186. $this->sort = $sort;
  42187. } else {
  42188. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  42189. }
  42190. }
  42191. public function getIterator()
  42192. {
  42193. $array = iterator_to_array($this->iterator, true);
  42194. uasort($array, $this->sort);
  42195. return new \ArrayIterator($array);
  42196. }
  42197. }
  42198. Copyright (c) 2004-2018 Fabien Potencier
  42199. Permission is hereby granted, free of charge, to any person obtaining a copy
  42200. of this software and associated documentation files (the "Software"), to deal
  42201. in the Software without restriction, including without limitation the rights
  42202. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42203. copies of the Software, and to permit persons to whom the Software is furnished
  42204. to do so, subject to the following conditions:
  42205. The above copyright notice and this permission notice shall be included in all
  42206. copies or substantial portions of the Software.
  42207. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42208. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42209. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42210. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42211. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42212. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42213. THE SOFTWARE.
  42214. <?php
  42215. namespace Symfony\Component\Finder\Shell;
  42216. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42217. class Command
  42218. {
  42219. private $parent;
  42220. private $bits = array();
  42221. private $labels = array();
  42222. private $errorHandler;
  42223. public function __construct(Command $parent = null)
  42224. {
  42225. $this->parent = $parent;
  42226. }
  42227. public function __toString()
  42228. {
  42229. return $this->join();
  42230. }
  42231. public static function create(Command $parent = null)
  42232. {
  42233. return new self($parent);
  42234. }
  42235. public static function escape($input)
  42236. {
  42237. return escapeshellcmd($input);
  42238. }
  42239. public static function quote($input)
  42240. {
  42241. return escapeshellarg($input);
  42242. }
  42243. public function add($bit)
  42244. {
  42245. $this->bits[] = $bit;
  42246. return $this;
  42247. }
  42248. public function top($bit)
  42249. {
  42250. array_unshift($this->bits, $bit);
  42251. foreach ($this->labels as $label => $index) {
  42252. ++$this->labels[$label];
  42253. }
  42254. return $this;
  42255. }
  42256. public function arg($arg)
  42257. {
  42258. $this->bits[] = self::quote($arg);
  42259. return $this;
  42260. }
  42261. public function cmd($esc)
  42262. {
  42263. $this->bits[] = self::escape($esc);
  42264. return $this;
  42265. }
  42266. public function ins($label)
  42267. {
  42268. if (isset($this->labels[$label])) {
  42269. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  42270. }
  42271. $this->bits[] = self::create($this);
  42272. $this->labels[$label] = \count($this->bits) - 1;
  42273. return $this->bits[$this->labels[$label]];
  42274. }
  42275. public function get($label)
  42276. {
  42277. if (!isset($this->labels[$label])) {
  42278. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  42279. }
  42280. return $this->bits[$this->labels[$label]];
  42281. }
  42282. public function end()
  42283. {
  42284. if (null === $this->parent) {
  42285. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  42286. }
  42287. return $this->parent;
  42288. }
  42289. public function length()
  42290. {
  42291. return \count($this->bits);
  42292. }
  42293. public function setErrorHandler(\Closure $errorHandler)
  42294. {
  42295. $this->errorHandler = $errorHandler;
  42296. return $this;
  42297. }
  42298. public function getErrorHandler()
  42299. {
  42300. return $this->errorHandler;
  42301. }
  42302. public function execute()
  42303. {
  42304. if (null === $errorHandler = $this->errorHandler) {
  42305. exec($this->join(), $output);
  42306. } else {
  42307. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  42308. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  42309. if ($error = stream_get_contents($pipes[2])) {
  42310. $errorHandler($error);
  42311. }
  42312. proc_close($process);
  42313. }
  42314. return $output ?: array();
  42315. }
  42316. public function join()
  42317. {
  42318. return implode(' ', array_filter(
  42319. array_map(function ($bit) {
  42320. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  42321. }, $this->bits),
  42322. function ($bit) { return null !== $bit; }
  42323. ));
  42324. }
  42325. public function addAtIndex($bit, $index)
  42326. {
  42327. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  42328. return $this;
  42329. }
  42330. }
  42331. <?php
  42332. namespace Symfony\Component\Finder\Shell;
  42333. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42334. class Shell
  42335. {
  42336. const TYPE_UNIX = 1;
  42337. const TYPE_DARWIN = 2;
  42338. const TYPE_CYGWIN = 3;
  42339. const TYPE_WINDOWS = 4;
  42340. const TYPE_BSD = 5;
  42341. private $type;
  42342. public function getType()
  42343. {
  42344. if (null === $this->type) {
  42345. $this->type = $this->guessType();
  42346. }
  42347. return $this->type;
  42348. }
  42349. public function testCommand($command)
  42350. {
  42351. if (!\function_exists('exec')) {
  42352. return false;
  42353. }
  42354. $testCommand = 'which ';
  42355. if (self::TYPE_WINDOWS === $this->type) {
  42356. $testCommand = 'where ';
  42357. }
  42358. $command = escapeshellcmd($command);
  42359. exec($testCommand.$command, $output, $code);
  42360. return 0 === $code && \count($output) > 0;
  42361. }
  42362. private function guessType()
  42363. {
  42364. $os = strtolower(PHP_OS);
  42365. if (false !== strpos($os, 'cygwin')) {
  42366. return self::TYPE_CYGWIN;
  42367. }
  42368. if (false !== strpos($os, 'darwin')) {
  42369. return self::TYPE_DARWIN;
  42370. }
  42371. if (false !== strpos($os, 'bsd')) {
  42372. return self::TYPE_BSD;
  42373. }
  42374. if (0 === strpos($os, 'win')) {
  42375. return self::TYPE_WINDOWS;
  42376. }
  42377. return self::TYPE_UNIX;
  42378. }
  42379. }
  42380. <?php
  42381. namespace Symfony\Component\Finder;
  42382. class SplFileInfo extends \SplFileInfo
  42383. {
  42384. private $relativePath;
  42385. private $relativePathname;
  42386. public function __construct($file, $relativePath, $relativePathname)
  42387. {
  42388. parent::__construct($file);
  42389. $this->relativePath = $relativePath;
  42390. $this->relativePathname = $relativePathname;
  42391. }
  42392. public function getRelativePath()
  42393. {
  42394. return $this->relativePath;
  42395. }
  42396. public function getRelativePathname()
  42397. {
  42398. return $this->relativePathname;
  42399. }
  42400. public function getContents()
  42401. {
  42402. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  42403. $content = file_get_contents($this->getPathname());
  42404. restore_error_handler();
  42405. if (false === $content) {
  42406. throw new \RuntimeException($error);
  42407. }
  42408. return $content;
  42409. }
  42410. }
  42411. <?php
  42412. namespace Symfony\Polyfill\Ctype;
  42413. final class Ctype
  42414. {
  42415. public static function ctype_alnum($text)
  42416. {
  42417. $text = self::convert_int_to_char_for_ctype($text);
  42418. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  42419. }
  42420. public static function ctype_alpha($text)
  42421. {
  42422. $text = self::convert_int_to_char_for_ctype($text);
  42423. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  42424. }
  42425. public static function ctype_cntrl($text)
  42426. {
  42427. $text = self::convert_int_to_char_for_ctype($text);
  42428. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  42429. }
  42430. public static function ctype_digit($text)
  42431. {
  42432. $text = self::convert_int_to_char_for_ctype($text);
  42433. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42434. }
  42435. public static function ctype_graph($text)
  42436. {
  42437. $text = self::convert_int_to_char_for_ctype($text);
  42438. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42439. }
  42440. public static function ctype_lower($text)
  42441. {
  42442. $text = self::convert_int_to_char_for_ctype($text);
  42443. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  42444. }
  42445. public static function ctype_print($text)
  42446. {
  42447. $text = self::convert_int_to_char_for_ctype($text);
  42448. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  42449. }
  42450. public static function ctype_punct($text)
  42451. {
  42452. $text = self::convert_int_to_char_for_ctype($text);
  42453. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  42454. }
  42455. public static function ctype_space($text)
  42456. {
  42457. $text = self::convert_int_to_char_for_ctype($text);
  42458. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  42459. }
  42460. public static function ctype_upper($text)
  42461. {
  42462. $text = self::convert_int_to_char_for_ctype($text);
  42463. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  42464. }
  42465. public static function ctype_xdigit($text)
  42466. {
  42467. $text = self::convert_int_to_char_for_ctype($text);
  42468. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  42469. }
  42470. private static function convert_int_to_char_for_ctype($int)
  42471. {
  42472. if (!\is_int($int)) {
  42473. return $int;
  42474. }
  42475. if ($int < -128 || $int > 255) {
  42476. return (string) $int;
  42477. }
  42478. if ($int < 0) {
  42479. $int += 256;
  42480. }
  42481. return \chr($int);
  42482. }
  42483. }
  42484. Copyright (c) 2018 Fabien Potencier
  42485. Permission is hereby granted, free of charge, to any person obtaining a copy
  42486. of this software and associated documentation files (the "Software"), to deal
  42487. in the Software without restriction, including without limitation the rights
  42488. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42489. copies of the Software, and to permit persons to whom the Software is furnished
  42490. to do so, subject to the following conditions:
  42491. The above copyright notice and this permission notice shall be included in all
  42492. copies or substantial portions of the Software.
  42493. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42494. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42495. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42496. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42497. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42498. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42499. THE SOFTWARE.
  42500. <?php
  42501. use Symfony\Polyfill\Ctype as p;
  42502. if (!function_exists('ctype_alnum')) {
  42503. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  42504. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  42505. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  42506. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  42507. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  42508. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  42509. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  42510. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  42511. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  42512. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  42513. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  42514. }
  42515. Copyright (c) 2015-2018 Fabien Potencier
  42516. Permission is hereby granted, free of charge, to any person obtaining a copy
  42517. of this software and associated documentation files (the "Software"), to deal
  42518. in the Software without restriction, including without limitation the rights
  42519. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42520. copies of the Software, and to permit persons to whom the Software is furnished
  42521. to do so, subject to the following conditions:
  42522. The above copyright notice and this permission notice shall be included in all
  42523. copies or substantial portions of the Software.
  42524. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42525. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42526. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42527. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42528. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42529. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42530. THE SOFTWARE.
  42531. <?php
  42532. namespace Symfony\Polyfill\Mbstring;
  42533. final class Mbstring
  42534. {
  42535. const MB_CASE_FOLD = PHP_INT_MAX;
  42536. private static $encodingList = array('ASCII', 'UTF-8');
  42537. private static $language = 'neutral';
  42538. private static $internalEncoding = 'UTF-8';
  42539. private static $caseFold = array(
  42540. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  42541. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  42542. );
  42543. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  42544. {
  42545. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  42546. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  42547. } else {
  42548. $fromEncoding = self::getEncoding($fromEncoding);
  42549. }
  42550. $toEncoding = self::getEncoding($toEncoding);
  42551. if ('BASE64' === $fromEncoding) {
  42552. $s = base64_decode($s);
  42553. $fromEncoding = $toEncoding;
  42554. }
  42555. if ('BASE64' === $toEncoding) {
  42556. return base64_encode($s);
  42557. }
  42558. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  42559. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  42560. $fromEncoding = 'Windows-1252';
  42561. }
  42562. if ('UTF-8' !== $fromEncoding) {
  42563. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  42564. }
  42565. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  42566. }
  42567. if ('HTML-ENTITIES' === $fromEncoding) {
  42568. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  42569. $fromEncoding = 'UTF-8';
  42570. }
  42571. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  42572. }
  42573. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  42574. {
  42575. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  42576. $ok = true;
  42577. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  42578. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  42579. $ok = false;
  42580. }
  42581. });
  42582. return $ok ? $fromEncoding : false;
  42583. }
  42584. public static function mb_decode_mimeheader($s)
  42585. {
  42586. return iconv_mime_decode($s, 2, self::$internalEncoding);
  42587. }
  42588. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  42589. {
  42590. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  42591. }
  42592. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  42593. {
  42594. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42595. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42596. return null;
  42597. }
  42598. if (!\is_array($convmap) || !$convmap) {
  42599. return false;
  42600. }
  42601. if (null !== $encoding && !\is_scalar($encoding)) {
  42602. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42603. return '';
  42604. }
  42605. $s = (string) $s;
  42606. if ('' === $s) {
  42607. return '';
  42608. }
  42609. $encoding = self::getEncoding($encoding);
  42610. if ('UTF-8' === $encoding) {
  42611. $encoding = null;
  42612. if (!preg_match('//u', $s)) {
  42613. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42614. }
  42615. } else {
  42616. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42617. }
  42618. $cnt = floor(\count($convmap) / 4) * 4;
  42619. for ($i = 0; $i < $cnt; $i += 4) {
  42620. $convmap[$i] += $convmap[$i + 2];
  42621. $convmap[$i + 1] += $convmap[$i + 2];
  42622. }
  42623. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  42624. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  42625. for ($i = 0; $i < $cnt; $i += 4) {
  42626. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  42627. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  42628. }
  42629. }
  42630. return $m[0];
  42631. }, $s);
  42632. if (null === $encoding) {
  42633. return $s;
  42634. }
  42635. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42636. }
  42637. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  42638. {
  42639. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42640. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42641. return null;
  42642. }
  42643. if (!\is_array($convmap) || !$convmap) {
  42644. return false;
  42645. }
  42646. if (null !== $encoding && !\is_scalar($encoding)) {
  42647. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42648. return null;
  42649. }
  42650. if (null !== $is_hex && !\is_scalar($is_hex)) {
  42651. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  42652. return null;
  42653. }
  42654. $s = (string) $s;
  42655. if ('' === $s) {
  42656. return '';
  42657. }
  42658. $encoding = self::getEncoding($encoding);
  42659. if ('UTF-8' === $encoding) {
  42660. $encoding = null;
  42661. if (!preg_match('//u', $s)) {
  42662. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42663. }
  42664. } else {
  42665. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42666. }
  42667. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42668. $cnt = floor(\count($convmap) / 4) * 4;
  42669. $i = 0;
  42670. $len = \strlen($s);
  42671. $result = '';
  42672. while ($i < $len) {
  42673. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42674. $uchr = substr($s, $i, $ulen);
  42675. $i += $ulen;
  42676. $c = self::mb_ord($uchr);
  42677. for ($j = 0; $j < $cnt; $j += 4) {
  42678. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  42679. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  42680. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  42681. continue 2;
  42682. }
  42683. }
  42684. $result .= $uchr;
  42685. }
  42686. if (null === $encoding) {
  42687. return $result;
  42688. }
  42689. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  42690. }
  42691. public static function mb_convert_case($s, $mode, $encoding = null)
  42692. {
  42693. $s = (string) $s;
  42694. if ('' === $s) {
  42695. return '';
  42696. }
  42697. $encoding = self::getEncoding($encoding);
  42698. if ('UTF-8' === $encoding) {
  42699. $encoding = null;
  42700. if (!preg_match('//u', $s)) {
  42701. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42702. }
  42703. } else {
  42704. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42705. }
  42706. if (MB_CASE_TITLE == $mode) {
  42707. static $titleRegexp = null;
  42708. if (null === $titleRegexp) {
  42709. $titleRegexp = self::getData('titleCaseRegexp');
  42710. }
  42711. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  42712. } else {
  42713. if (MB_CASE_UPPER == $mode) {
  42714. static $upper = null;
  42715. if (null === $upper) {
  42716. $upper = self::getData('upperCase');
  42717. }
  42718. $map = $upper;
  42719. } else {
  42720. if (self::MB_CASE_FOLD === $mode) {
  42721. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  42722. }
  42723. static $lower = null;
  42724. if (null === $lower) {
  42725. $lower = self::getData('lowerCase');
  42726. }
  42727. $map = $lower;
  42728. }
  42729. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42730. $i = 0;
  42731. $len = \strlen($s);
  42732. while ($i < $len) {
  42733. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42734. $uchr = substr($s, $i, $ulen);
  42735. $i += $ulen;
  42736. if (isset($map[$uchr])) {
  42737. $uchr = $map[$uchr];
  42738. $nlen = \strlen($uchr);
  42739. if ($nlen == $ulen) {
  42740. $nlen = $i;
  42741. do {
  42742. $s[--$nlen] = $uchr[--$ulen];
  42743. } while ($ulen);
  42744. } else {
  42745. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  42746. $len += $nlen - $ulen;
  42747. $i += $nlen - $ulen;
  42748. }
  42749. }
  42750. }
  42751. }
  42752. if (null === $encoding) {
  42753. return $s;
  42754. }
  42755. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42756. }
  42757. public static function mb_internal_encoding($encoding = null)
  42758. {
  42759. if (null === $encoding) {
  42760. return self::$internalEncoding;
  42761. }
  42762. $encoding = self::getEncoding($encoding);
  42763. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  42764. self::$internalEncoding = $encoding;
  42765. return true;
  42766. }
  42767. return false;
  42768. }
  42769. public static function mb_language($lang = null)
  42770. {
  42771. if (null === $lang) {
  42772. return self::$language;
  42773. }
  42774. switch ($lang = strtolower($lang)) {
  42775. case 'uni':
  42776. case 'neutral':
  42777. self::$language = $lang;
  42778. return true;
  42779. }
  42780. return false;
  42781. }
  42782. public static function mb_list_encodings()
  42783. {
  42784. return array('UTF-8');
  42785. }
  42786. public static function mb_encoding_aliases($encoding)
  42787. {
  42788. switch (strtoupper($encoding)) {
  42789. case 'UTF8':
  42790. case 'UTF-8':
  42791. return array('utf8');
  42792. }
  42793. return false;
  42794. }
  42795. public static function mb_check_encoding($var = null, $encoding = null)
  42796. {
  42797. if (null === $encoding) {
  42798. if (null === $var) {
  42799. return false;
  42800. }
  42801. $encoding = self::$internalEncoding;
  42802. }
  42803. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  42804. }
  42805. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  42806. {
  42807. if (null === $encodingList) {
  42808. $encodingList = self::$encodingList;
  42809. } else {
  42810. if (!\is_array($encodingList)) {
  42811. $encodingList = array_map('trim', explode(',', $encodingList));
  42812. }
  42813. $encodingList = array_map('strtoupper', $encodingList);
  42814. }
  42815. foreach ($encodingList as $enc) {
  42816. switch ($enc) {
  42817. case 'ASCII':
  42818. if (!preg_match('/[\x80-\xFF]/', $str)) {
  42819. return $enc;
  42820. }
  42821. break;
  42822. case 'UTF8':
  42823. case 'UTF-8':
  42824. if (preg_match('//u', $str)) {
  42825. return 'UTF-8';
  42826. }
  42827. break;
  42828. default:
  42829. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  42830. return $enc;
  42831. }
  42832. }
  42833. }
  42834. return false;
  42835. }
  42836. public static function mb_detect_order($encodingList = null)
  42837. {
  42838. if (null === $encodingList) {
  42839. return self::$encodingList;
  42840. }
  42841. if (!\is_array($encodingList)) {
  42842. $encodingList = array_map('trim', explode(',', $encodingList));
  42843. }
  42844. $encodingList = array_map('strtoupper', $encodingList);
  42845. foreach ($encodingList as $enc) {
  42846. switch ($enc) {
  42847. default:
  42848. if (strncmp($enc, 'ISO-8859-', 9)) {
  42849. return false;
  42850. }
  42851. case 'ASCII':
  42852. case 'UTF8':
  42853. case 'UTF-8':
  42854. }
  42855. }
  42856. self::$encodingList = $encodingList;
  42857. return true;
  42858. }
  42859. public static function mb_strlen($s, $encoding = null)
  42860. {
  42861. $encoding = self::getEncoding($encoding);
  42862. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42863. return \strlen($s);
  42864. }
  42865. return @iconv_strlen($s, $encoding);
  42866. }
  42867. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  42868. {
  42869. $encoding = self::getEncoding($encoding);
  42870. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42871. return strpos($haystack, $needle, $offset);
  42872. }
  42873. $needle = (string) $needle;
  42874. if ('' === $needle) {
  42875. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  42876. return false;
  42877. }
  42878. return iconv_strpos($haystack, $needle, $offset, $encoding);
  42879. }
  42880. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  42881. {
  42882. $encoding = self::getEncoding($encoding);
  42883. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42884. return strrpos($haystack, $needle, $offset);
  42885. }
  42886. if ($offset != (int) $offset) {
  42887. $offset = 0;
  42888. } elseif ($offset = (int) $offset) {
  42889. if ($offset < 0) {
  42890. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  42891. $offset = 0;
  42892. } else {
  42893. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  42894. }
  42895. }
  42896. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42897. return false !== $pos ? $offset + $pos : false;
  42898. }
  42899. public static function mb_strtolower($s, $encoding = null)
  42900. {
  42901. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  42902. }
  42903. public static function mb_strtoupper($s, $encoding = null)
  42904. {
  42905. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  42906. }
  42907. public static function mb_substitute_character($c = null)
  42908. {
  42909. if (0 === strcasecmp($c, 'none')) {
  42910. return true;
  42911. }
  42912. return null !== $c ? false : 'none';
  42913. }
  42914. public static function mb_substr($s, $start, $length = null, $encoding = null)
  42915. {
  42916. $encoding = self::getEncoding($encoding);
  42917. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42918. return substr($s, $start, null === $length ? 2147483647 : $length);
  42919. }
  42920. if ($start < 0) {
  42921. $start = iconv_strlen($s, $encoding) + $start;
  42922. if ($start < 0) {
  42923. $start = 0;
  42924. }
  42925. }
  42926. if (null === $length) {
  42927. $length = 2147483647;
  42928. } elseif ($length < 0) {
  42929. $length = iconv_strlen($s, $encoding) + $length - $start;
  42930. if ($length < 0) {
  42931. return '';
  42932. }
  42933. }
  42934. return (string) iconv_substr($s, $start, $length, $encoding);
  42935. }
  42936. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  42937. {
  42938. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42939. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42940. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  42941. }
  42942. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  42943. {
  42944. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  42945. return self::getSubpart($pos, $part, $haystack, $encoding);
  42946. }
  42947. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  42948. {
  42949. $encoding = self::getEncoding($encoding);
  42950. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42951. return strrchr($haystack, $needle, $part);
  42952. }
  42953. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42954. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42955. return self::getSubpart($pos, $part, $haystack, $encoding);
  42956. }
  42957. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  42958. {
  42959. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42960. $pos = self::mb_strripos($haystack, $needle, $encoding);
  42961. return self::getSubpart($pos, $part, $haystack, $encoding);
  42962. }
  42963. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  42964. {
  42965. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42966. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42967. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  42968. }
  42969. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  42970. {
  42971. $pos = strpos($haystack, $needle);
  42972. if (false === $pos) {
  42973. return false;
  42974. }
  42975. if ($part) {
  42976. return substr($haystack, 0, $pos);
  42977. }
  42978. return substr($haystack, $pos);
  42979. }
  42980. public static function mb_get_info($type = 'all')
  42981. {
  42982. $info = array(
  42983. 'internal_encoding' => self::$internalEncoding,
  42984. 'http_output' => 'pass',
  42985. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  42986. 'func_overload' => 0,
  42987. 'func_overload_list' => 'no overload',
  42988. 'mail_charset' => 'UTF-8',
  42989. 'mail_header_encoding' => 'BASE64',
  42990. 'mail_body_encoding' => 'BASE64',
  42991. 'illegal_chars' => 0,
  42992. 'encoding_translation' => 'Off',
  42993. 'language' => self::$language,
  42994. 'detect_order' => self::$encodingList,
  42995. 'substitute_character' => 'none',
  42996. 'strict_detection' => 'Off',
  42997. );
  42998. if ('all' === $type) {
  42999. return $info;
  43000. }
  43001. if (isset($info[$type])) {
  43002. return $info[$type];
  43003. }
  43004. return false;
  43005. }
  43006. public static function mb_http_input($type = '')
  43007. {
  43008. return false;
  43009. }
  43010. public static function mb_http_output($encoding = null)
  43011. {
  43012. return null !== $encoding ? 'pass' === $encoding : 'pass';
  43013. }
  43014. public static function mb_strwidth($s, $encoding = null)
  43015. {
  43016. $encoding = self::getEncoding($encoding);
  43017. if ('UTF-8' !== $encoding) {
  43018. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43019. }
  43020. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  43021. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  43022. }
  43023. public static function mb_substr_count($haystack, $needle, $encoding = null)
  43024. {
  43025. return substr_count($haystack, $needle);
  43026. }
  43027. public static function mb_output_handler($contents, $status)
  43028. {
  43029. return $contents;
  43030. }
  43031. public static function mb_chr($code, $encoding = null)
  43032. {
  43033. if (0x80 > $code %= 0x200000) {
  43034. $s = \chr($code);
  43035. } elseif (0x800 > $code) {
  43036. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  43037. } elseif (0x10000 > $code) {
  43038. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43039. } else {
  43040. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43041. }
  43042. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43043. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  43044. }
  43045. return $s;
  43046. }
  43047. public static function mb_ord($s, $encoding = null)
  43048. {
  43049. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43050. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  43051. }
  43052. if (1 === \strlen($s)) {
  43053. return \ord($s);
  43054. }
  43055. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  43056. if (0xF0 <= $code) {
  43057. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  43058. }
  43059. if (0xE0 <= $code) {
  43060. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  43061. }
  43062. if (0xC0 <= $code) {
  43063. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  43064. }
  43065. return $code;
  43066. }
  43067. private static function getSubpart($pos, $part, $haystack, $encoding)
  43068. {
  43069. if (false === $pos) {
  43070. return false;
  43071. }
  43072. if ($part) {
  43073. return self::mb_substr($haystack, 0, $pos, $encoding);
  43074. }
  43075. return self::mb_substr($haystack, $pos, null, $encoding);
  43076. }
  43077. private static function html_encoding_callback(array $m)
  43078. {
  43079. $i = 1;
  43080. $entities = '';
  43081. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  43082. while (isset($m[$i])) {
  43083. if (0x80 > $m[$i]) {
  43084. $entities .= \chr($m[$i++]);
  43085. continue;
  43086. }
  43087. if (0xF0 <= $m[$i]) {
  43088. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43089. } elseif (0xE0 <= $m[$i]) {
  43090. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43091. } else {
  43092. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  43093. }
  43094. $entities .= '&#'.$c.';';
  43095. }
  43096. return $entities;
  43097. }
  43098. private static function title_case(array $s)
  43099. {
  43100. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  43101. }
  43102. private static function getData($file)
  43103. {
  43104. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  43105. return require $file;
  43106. }
  43107. return false;
  43108. }
  43109. private static function getEncoding($encoding)
  43110. {
  43111. if (null === $encoding) {
  43112. return self::$internalEncoding;
  43113. }
  43114. $encoding = strtoupper($encoding);
  43115. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  43116. return 'CP850';
  43117. }
  43118. if ('UTF8' === $encoding) {
  43119. return 'UTF-8';
  43120. }
  43121. return $encoding;
  43122. }
  43123. }
  43124. <?php
  43125. return array(
  43126. 'A' => 'a',
  43127. 'B' => 'b',
  43128. 'C' => 'c',
  43129. 'D' => 'd',
  43130. 'E' => 'e',
  43131. 'F' => 'f',
  43132. 'G' => 'g',
  43133. 'H' => 'h',
  43134. 'I' => 'i',
  43135. 'J' => 'j',
  43136. 'K' => 'k',
  43137. 'L' => 'l',
  43138. 'M' => 'm',
  43139. 'N' => 'n',
  43140. 'O' => 'o',
  43141. 'P' => 'p',
  43142. 'Q' => 'q',
  43143. 'R' => 'r',
  43144. 'S' => 's',
  43145. 'T' => 't',
  43146. 'U' => 'u',
  43147. 'V' => 'v',
  43148. 'W' => 'w',
  43149. 'X' => 'x',
  43150. 'Y' => 'y',
  43151. 'Z' => 'z',
  43152. 'À' => 'à',
  43153. '�' => 'á',
  43154. 'Â' => 'â',
  43155. 'Ã' => 'ã',
  43156. 'Ä' => 'ä',
  43157. 'Ã…' => 'Ã¥',
  43158. 'Æ' => 'æ',
  43159. 'Ç' => 'ç',
  43160. 'È' => 'è',
  43161. 'É' => 'é',
  43162. 'Ê' => 'ê',
  43163. 'Ë' => 'ë',
  43164. 'Ì' => 'ì',
  43165. '�' => 'í',
  43166. 'Î' => 'î',
  43167. '�' => 'ï',
  43168. '�' => 'ð',
  43169. 'Ñ' => 'ñ',
  43170. 'Ò' => 'ò',
  43171. 'Ó' => 'ó',
  43172. 'Ô' => 'ô',
  43173. 'Õ' => 'õ',
  43174. 'Ö' => 'ö',
  43175. 'Ø' => 'ø',
  43176. 'Ù' => 'ù',
  43177. 'Ú' => 'ú',
  43178. 'Û' => 'û',
  43179. 'Ü' => 'ü',
  43180. '�' => 'ý',
  43181. 'Þ' => 'þ',
  43182. 'Ā' => '�',
  43183. 'Ă' => 'ă',
  43184. 'Ä„' => 'Ä…',
  43185. 'Ć' => 'ć',
  43186. 'Ĉ' => 'ĉ',
  43187. 'ÄŠ' => 'Ä‹',
  43188. 'Č' => '�',
  43189. 'Ď' => '�',
  43190. '�' => 'đ',
  43191. 'Ä’' => 'Ä“',
  43192. 'Ä”' => 'Ä•',
  43193. 'Ä–' => 'Ä—',
  43194. 'Ę' => 'ę',
  43195. 'Äš' => 'Ä›',
  43196. 'Ĝ' => '�',
  43197. 'Äž' => 'ÄŸ',
  43198. 'Ä ' => 'Ä¡',
  43199. 'Ä¢' => 'Ä£',
  43200. 'Ĥ' => 'ĥ',
  43201. 'Ħ' => 'ħ',
  43202. 'Ĩ' => 'ĩ',
  43203. 'Ī' => 'ī',
  43204. 'Ĭ' => 'ĭ',
  43205. 'Į' => 'į',
  43206. 'Ä°' => 'i',
  43207. 'IJ' => 'ij',
  43208. 'Ĵ' => 'ĵ',
  43209. 'Ķ' => 'ķ',
  43210. 'Ĺ' => 'ĺ',
  43211. 'Ļ' => 'ļ',
  43212. 'Ľ' => 'ľ',
  43213. 'Ä¿' => 'Å€',
  43214. '�' => 'ł',
  43215. 'Ń' => 'ń',
  43216. 'Ņ' => 'ņ',
  43217. 'Ň' => 'ň',
  43218. 'ÅŠ' => 'Å‹',
  43219. 'Ō' => '�',
  43220. 'Ŏ' => '�',
  43221. '�' => 'ő',
  43222. 'Å’' => 'Å“',
  43223. 'Å”' => 'Å•',
  43224. 'Å–' => 'Å—',
  43225. 'Ř' => 'ř',
  43226. 'Åš' => 'Å›',
  43227. 'Ŝ' => '�',
  43228. 'Åž' => 'ÅŸ',
  43229. 'Å ' => 'Å¡',
  43230. 'Å¢' => 'Å£',
  43231. 'Ť' => 'ť',
  43232. 'Ŧ' => 'ŧ',
  43233. 'Ũ' => 'ũ',
  43234. 'Ū' => 'ū',
  43235. 'Ŭ' => 'ŭ',
  43236. 'Ů' => 'ů',
  43237. 'Ű' => 'ű',
  43238. 'Ų' => 'ų',
  43239. 'Ŵ' => 'ŵ',
  43240. 'Ŷ' => 'ŷ',
  43241. 'Ÿ' => 'ÿ',
  43242. 'Ź' => 'ź',
  43243. 'Ż' => 'ż',
  43244. 'Ž' => 'ž',
  43245. '�' => 'ɓ',
  43246. 'Ƃ' => 'ƃ',
  43247. 'Æ„' => 'Æ…',
  43248. 'Ɔ' => 'ɔ',
  43249. 'Ƈ' => 'ƈ',
  43250. 'Ɖ' => 'ɖ',
  43251. 'ÆŠ' => 'É—',
  43252. 'Ƌ' => 'ƌ',
  43253. 'Ǝ' => '�',
  43254. '�' => 'ə',
  43255. '�' => 'ɛ',
  43256. 'Æ‘' => 'Æ’',
  43257. 'Æ“' => 'É ',
  43258. 'Æ”' => 'É£',
  43259. 'Æ–' => 'É©',
  43260. 'Ɨ' => 'ɨ',
  43261. 'Ƙ' => 'ƙ',
  43262. 'Ɯ' => 'ɯ',
  43263. '�' => 'ɲ',
  43264. 'Ɵ' => 'ɵ',
  43265. 'Æ ' => 'Æ¡',
  43266. 'Æ¢' => 'Æ£',
  43267. 'Ƥ' => 'ƥ',
  43268. 'Ʀ' => 'ʀ',
  43269. 'Ƨ' => 'ƨ',
  43270. 'Ʃ' => 'ʃ',
  43271. 'Ƭ' => 'ƭ',
  43272. 'Ʈ' => 'ʈ',
  43273. 'Ư' => 'ư',
  43274. 'Ʊ' => 'ʊ',
  43275. 'Ʋ' => 'ʋ',
  43276. 'Ƴ' => 'ƴ',
  43277. 'Ƶ' => 'ƶ',
  43278. 'Æ·' => 'Ê’',
  43279. 'Ƹ' => 'ƹ',
  43280. 'Ƽ' => 'ƽ',
  43281. 'DŽ' => 'dž',
  43282. 'Dž' => 'dž',
  43283. 'LJ' => 'lj',
  43284. 'Lj' => 'lj',
  43285. 'NJ' => 'nj',
  43286. 'Nj' => 'nj',
  43287. '�' => 'ǎ',
  43288. '�' => '�',
  43289. 'Ç‘' => 'Ç’',
  43290. 'Ç“' => 'Ç”',
  43291. 'Ç•' => 'Ç–',
  43292. 'Ǘ' => 'ǘ',
  43293. 'Ç™' => 'Çš',
  43294. 'Ǜ' => 'ǜ',
  43295. 'Çž' => 'ÇŸ',
  43296. 'Ç ' => 'Ç¡',
  43297. 'Ç¢' => 'Ç£',
  43298. 'Ǥ' => 'ǥ',
  43299. 'Ǧ' => 'ǧ',
  43300. 'Ǩ' => 'ǩ',
  43301. 'Ǫ' => 'ǫ',
  43302. 'Ǭ' => 'ǭ',
  43303. 'Ǯ' => 'ǯ',
  43304. 'DZ' => 'dz',
  43305. 'Dz' => 'dz',
  43306. 'Ǵ' => 'ǵ',
  43307. 'Ƕ' => 'ƕ',
  43308. 'Ç·' => 'Æ¿',
  43309. 'Ǹ' => 'ǹ',
  43310. 'Ǻ' => 'ǻ',
  43311. 'Ǽ' => 'ǽ',
  43312. 'Ǿ' => 'ǿ',
  43313. 'Ȁ' => '�',
  43314. 'Ȃ' => 'ȃ',
  43315. 'È„' => 'È…',
  43316. 'Ȇ' => 'ȇ',
  43317. 'Ȉ' => 'ȉ',
  43318. 'ÈŠ' => 'È‹',
  43319. 'Ȍ' => '�',
  43320. 'Ȏ' => '�',
  43321. '�' => 'ȑ',
  43322. 'È’' => 'È“',
  43323. 'È”' => 'È•',
  43324. 'È–' => 'È—',
  43325. 'Ș' => 'ș',
  43326. 'Èš' => 'È›',
  43327. 'Ȝ' => '�',
  43328. 'Èž' => 'ÈŸ',
  43329. 'È ' => 'Æž',
  43330. 'È¢' => 'È£',
  43331. 'Ȥ' => 'ȥ',
  43332. 'Ȧ' => 'ȧ',
  43333. 'Ȩ' => 'ȩ',
  43334. 'Ȫ' => 'ȫ',
  43335. 'Ȭ' => 'ȭ',
  43336. 'Ȯ' => 'ȯ',
  43337. 'Ȱ' => 'ȱ',
  43338. 'Ȳ' => 'ȳ',
  43339. 'Ⱥ' => 'ⱥ',
  43340. 'Ȼ' => 'ȼ',
  43341. 'Ƚ' => 'ƚ',
  43342. 'Ⱦ' => 'ⱦ',
  43343. '�' => 'ɂ',
  43344. 'Ƀ' => 'ƀ',
  43345. 'Ʉ' => 'ʉ',
  43346. 'Ʌ' => 'ʌ',
  43347. 'Ɇ' => 'ɇ',
  43348. 'Ɉ' => 'ɉ',
  43349. 'ÉŠ' => 'É‹',
  43350. 'Ɍ' => '�',
  43351. 'Ɏ' => '�',
  43352. 'Ͱ' => 'ͱ',
  43353. 'Ͳ' => 'ͳ',
  43354. 'Ͷ' => 'ͷ',
  43355. 'Ϳ' => 'ϳ',
  43356. 'Ά' => 'ά',
  43357. 'Έ' => 'έ',
  43358. 'Ή' => 'ή',
  43359. 'Ί' => 'ί',
  43360. 'Ό' => 'ό',
  43361. 'Ύ' => '�',
  43362. '�' => 'ώ',
  43363. 'Α' => 'α',
  43364. 'Β' => 'β',
  43365. 'Γ' => 'γ',
  43366. 'Δ' => 'δ',
  43367. 'Ε' => 'ε',
  43368. 'Ζ' => 'ζ',
  43369. 'Η' => 'η',
  43370. 'Θ' => 'θ',
  43371. 'Ι' => 'ι',
  43372. 'Κ' => 'κ',
  43373. 'Λ' => 'λ',
  43374. 'Μ' => 'μ',
  43375. '�' => 'ν',
  43376. 'Ξ' => 'ξ',
  43377. 'Ο' => 'ο',
  43378. 'Π' => 'π',
  43379. 'Ρ' => '�',
  43380. 'Σ' => 'σ',
  43381. 'Τ' => 'τ',
  43382. 'Î¥' => 'Ï…',
  43383. 'Φ' => 'φ',
  43384. 'Χ' => 'χ',
  43385. 'Ψ' => 'ψ',
  43386. 'Ω' => 'ω',
  43387. 'Ϊ' => 'ϊ',
  43388. 'Ϋ' => 'ϋ',
  43389. '�' => 'ϗ',
  43390. 'Ϙ' => 'ϙ',
  43391. 'Ïš' => 'Ï›',
  43392. 'Ϝ' => '�',
  43393. 'Ïž' => 'ÏŸ',
  43394. 'Ï ' => 'Ï¡',
  43395. 'Ï¢' => 'Ï£',
  43396. 'Ϥ' => 'ϥ',
  43397. 'Ϧ' => 'ϧ',
  43398. 'Ϩ' => 'ϩ',
  43399. 'Ϫ' => 'ϫ',
  43400. 'Ϭ' => 'ϭ',
  43401. 'Ϯ' => 'ϯ',
  43402. 'ϴ' => 'θ',
  43403. 'Ϸ' => 'ϸ',
  43404. 'Ϲ' => 'ϲ',
  43405. 'Ϻ' => 'ϻ',
  43406. 'Ͻ' => 'ͻ',
  43407. 'Ͼ' => 'ͼ',
  43408. 'Ͽ' => 'ͽ',
  43409. 'Ѐ' => '�',
  43410. '�' => 'ё',
  43411. 'Ђ' => 'ђ',
  43412. 'Ѓ' => 'ѓ',
  43413. 'Є' => 'є',
  43414. 'Ð…' => 'Ñ•',
  43415. 'І' => 'і',
  43416. 'Ї' => 'ї',
  43417. 'Ј' => 'ј',
  43418. 'Љ' => 'љ',
  43419. 'Њ' => 'њ',
  43420. 'Ћ' => 'ћ',
  43421. 'Ќ' => 'ќ',
  43422. '�' => '�',
  43423. 'ÐŽ' => 'Ñž',
  43424. '�' => 'џ',
  43425. '�' => 'а',
  43426. 'Б' => 'б',
  43427. 'В' => 'в',
  43428. 'Г' => 'г',
  43429. 'Д' => 'д',
  43430. 'Е' => 'е',
  43431. 'Ж' => 'ж',
  43432. 'З' => 'з',
  43433. 'И' => 'и',
  43434. 'Й' => 'й',
  43435. 'К' => 'к',
  43436. 'Л' => 'л',
  43437. 'М' => 'м',
  43438. '�' => 'н',
  43439. 'О' => 'о',
  43440. 'П' => 'п',
  43441. 'Р' => 'р',
  43442. 'С' => '�',
  43443. 'Т' => 'т',
  43444. 'У' => 'у',
  43445. 'Ф' => 'ф',
  43446. 'Ð¥' => 'Ñ…',
  43447. 'Ц' => 'ц',
  43448. 'Ч' => 'ч',
  43449. 'Ш' => 'ш',
  43450. 'Щ' => 'щ',
  43451. 'Ъ' => 'ъ',
  43452. 'Ы' => 'ы',
  43453. 'Ь' => 'ь',
  43454. 'Э' => '�',
  43455. 'Ю' => 'ю',
  43456. 'Я' => '�',
  43457. 'Ñ ' => 'Ñ¡',
  43458. 'Ñ¢' => 'Ñ£',
  43459. 'Ѥ' => 'ѥ',
  43460. 'Ѧ' => 'ѧ',
  43461. 'Ѩ' => 'ѩ',
  43462. 'Ѫ' => 'ѫ',
  43463. 'Ѭ' => 'ѭ',
  43464. 'Ѯ' => 'ѯ',
  43465. 'Ѱ' => 'ѱ',
  43466. 'Ѳ' => 'ѳ',
  43467. 'Ѵ' => 'ѵ',
  43468. 'Ѷ' => 'ѷ',
  43469. 'Ѹ' => 'ѹ',
  43470. 'Ѻ' => 'ѻ',
  43471. 'Ѽ' => 'ѽ',
  43472. 'Ѿ' => 'ѿ',
  43473. 'Ò€' => 'Ò�',
  43474. 'ÒŠ' => 'Ò‹',
  43475. 'Ҍ' => '�',
  43476. 'ÒŽ' => 'Ò�',
  43477. 'Ò�' => 'Ò‘',
  43478. 'Ò’' => 'Ò“',
  43479. 'Ò”' => 'Ò•',
  43480. 'Ò–' => 'Ò—',
  43481. 'Ò˜' => 'Ò™',
  43482. 'Òš' => 'Ò›',
  43483. 'Ҝ' => '�',
  43484. 'Òž' => 'ÒŸ',
  43485. 'Ò ' => 'Ò¡',
  43486. 'Ò¢' => 'Ò£',
  43487. 'Ò¤' => 'Ò¥',
  43488. 'Ò¦' => 'Ò§',
  43489. 'Ò¨' => 'Ò©',
  43490. 'Òª' => 'Ò«',
  43491. 'Ò¬' => 'Ò­',
  43492. 'Ò®' => 'Ò¯',
  43493. 'Ò°' => 'Ò±',
  43494. 'Ò²' => 'Ò³',
  43495. 'Ò´' => 'Òµ',
  43496. 'Ò¶' => 'Ò·',
  43497. 'Ò¸' => 'Ò¹',
  43498. 'Òº' => 'Ò»',
  43499. 'Ò¼' => 'Ò½',
  43500. 'Ò¾' => 'Ò¿',
  43501. 'Ó€' => 'Ó�',
  43502. 'Ó�' => 'Ó‚',
  43503. 'Óƒ' => 'Ó„',
  43504. 'Ó…' => 'Ó†',
  43505. 'Ó‡' => 'Óˆ',
  43506. 'Ó‰' => 'ÓŠ',
  43507. 'Ӌ' => 'ӌ',
  43508. 'Ó�' => 'ÓŽ',
  43509. 'Ó�' => 'Ó‘',
  43510. 'Ó’' => 'Ó“',
  43511. 'Ó”' => 'Ó•',
  43512. 'Ó–' => 'Ó—',
  43513. 'Ó˜' => 'Ó™',
  43514. 'Óš' => 'Ó›',
  43515. 'Ӝ' => '�',
  43516. 'Óž' => 'ÓŸ',
  43517. 'Ó ' => 'Ó¡',
  43518. 'Ó¢' => 'Ó£',
  43519. 'Ó¤' => 'Ó¥',
  43520. 'Ó¦' => 'Ó§',
  43521. 'Ó¨' => 'Ó©',
  43522. 'Óª' => 'Ó«',
  43523. 'Ó¬' => 'Ó­',
  43524. 'Ó®' => 'Ó¯',
  43525. 'Ó°' => 'Ó±',
  43526. 'Ó²' => 'Ó³',
  43527. 'Ó´' => 'Óµ',
  43528. 'Ó¶' => 'Ó·',
  43529. 'Ó¸' => 'Ó¹',
  43530. 'Óº' => 'Ó»',
  43531. 'Ó¼' => 'Ó½',
  43532. 'Ó¾' => 'Ó¿',
  43533. 'Ô€' => 'Ô�',
  43534. 'Ô‚' => 'Ôƒ',
  43535. 'Ô„' => 'Ô…',
  43536. 'Ô†' => 'Ô‡',
  43537. 'Ôˆ' => 'Ô‰',
  43538. 'ÔŠ' => 'Ô‹',
  43539. 'Ԍ' => '�',
  43540. 'ÔŽ' => 'Ô�',
  43541. 'Ô�' => 'Ô‘',
  43542. 'Ô’' => 'Ô“',
  43543. 'Ô”' => 'Ô•',
  43544. 'Ô–' => 'Ô—',
  43545. 'Ô˜' => 'Ô™',
  43546. 'Ôš' => 'Ô›',
  43547. 'Ԝ' => '�',
  43548. 'Ôž' => 'ÔŸ',
  43549. 'Ô ' => 'Ô¡',
  43550. 'Ô¢' => 'Ô£',
  43551. 'Ô¤' => 'Ô¥',
  43552. 'Ô¦' => 'Ô§',
  43553. 'Ô¨' => 'Ô©',
  43554. 'Ôª' => 'Ô«',
  43555. 'Ô¬' => 'Ô­',
  43556. 'Ô®' => 'Ô¯',
  43557. 'Ô±' => 'Õ¡',
  43558. 'Ô²' => 'Õ¢',
  43559. 'Ô³' => 'Õ£',
  43560. 'Ô´' => 'Õ¤',
  43561. 'Ôµ' => 'Õ¥',
  43562. 'Ô¶' => 'Õ¦',
  43563. 'Ô·' => 'Õ§',
  43564. 'Ô¸' => 'Õ¨',
  43565. 'Ô¹' => 'Õ©',
  43566. 'Ôº' => 'Õª',
  43567. 'Ô»' => 'Õ«',
  43568. 'Ô¼' => 'Õ¬',
  43569. 'Ô½' => 'Õ­',
  43570. 'Ô¾' => 'Õ®',
  43571. 'Ô¿' => 'Õ¯',
  43572. 'Õ€' => 'Õ°',
  43573. 'Õ�' => 'Õ±',
  43574. 'Õ‚' => 'Õ²',
  43575. 'Õƒ' => 'Õ³',
  43576. 'Õ„' => 'Õ´',
  43577. 'Õ…' => 'Õµ',
  43578. 'Õ†' => 'Õ¶',
  43579. 'Õ‡' => 'Õ·',
  43580. 'Õˆ' => 'Õ¸',
  43581. 'Õ‰' => 'Õ¹',
  43582. 'ÕŠ' => 'Õº',
  43583. 'Õ‹' => 'Õ»',
  43584. 'Ռ' => 'ռ',
  43585. 'Õ�' => 'Õ½',
  43586. 'ÕŽ' => 'Õ¾',
  43587. 'Õ�' => 'Õ¿',
  43588. 'Õ�' => 'Ö€',
  43589. 'Õ‘' => 'Ö�',
  43590. 'Õ’' => 'Ö‚',
  43591. 'Õ“' => 'Öƒ',
  43592. 'Õ”' => 'Ö„',
  43593. 'Õ•' => 'Ö…',
  43594. 'Õ–' => 'Ö†',
  43595. 'á‚ ' => 'â´€',
  43596. 'á‚¡' => 'â´�',
  43597. 'á‚¢' => 'â´‚',
  43598. 'á‚£' => 'â´ƒ',
  43599. 'Ⴄ' => 'ⴄ',
  43600. 'á‚¥' => 'â´…',
  43601. 'Ⴆ' => 'ⴆ',
  43602. 'Ⴇ' => 'ⴇ',
  43603. 'Ⴈ' => 'ⴈ',
  43604. 'á‚©' => 'â´‰',
  43605. 'Ⴊ' => 'ⴊ',
  43606. 'á‚«' => 'â´‹',
  43607. 'Ⴌ' => 'ⴌ',
  43608. 'á‚­' => 'â´�',
  43609. 'á‚®' => 'â´Ž',
  43610. 'Ⴏ' => '�',
  43611. 'á‚°' => 'â´�',
  43612. 'Ⴑ' => 'ⴑ',
  43613. 'Ⴒ' => 'ⴒ',
  43614. 'Ⴓ' => 'ⴓ',
  43615. 'á‚´' => 'â´”',
  43616. 'Ⴕ' => 'ⴕ',
  43617. 'Ⴖ' => 'ⴖ',
  43618. 'á‚·' => 'â´—',
  43619. 'Ⴘ' => 'ⴘ',
  43620. 'Ⴙ' => 'ⴙ',
  43621. 'Ⴚ' => 'ⴚ',
  43622. 'á‚»' => 'â´›',
  43623. 'Ⴜ' => 'ⴜ',
  43624. 'Ⴝ' => '�',
  43625. 'Ⴞ' => 'ⴞ',
  43626. 'á‚¿' => 'â´Ÿ',
  43627. 'Ⴠ' => 'ⴠ',
  43628. '�' => 'ⴡ',
  43629. 'Ⴢ' => 'ⴢ',
  43630. 'Ⴣ' => 'ⴣ',
  43631. 'Ⴤ' => 'ⴤ',
  43632. 'Ⴥ' => 'ⴥ',
  43633. 'Ⴧ' => 'ⴧ',
  43634. '�' => 'ⴭ',
  43635. 'Ḁ' => '�',
  43636. 'Ḃ' => 'ḃ',
  43637. 'Ḅ' => 'ḅ',
  43638. 'Ḇ' => 'ḇ',
  43639. 'Ḉ' => 'ḉ',
  43640. 'Ḋ' => 'ḋ',
  43641. 'Ḍ' => '�',
  43642. 'Ḏ' => '�',
  43643. '�' => 'ḑ',
  43644. 'Ḓ' => 'ḓ',
  43645. 'Ḕ' => 'ḕ',
  43646. 'Ḗ' => 'ḗ',
  43647. 'Ḙ' => 'ḙ',
  43648. 'Ḛ' => 'ḛ',
  43649. 'Ḝ' => '�',
  43650. 'Ḟ' => 'ḟ',
  43651. 'Ḡ' => 'ḡ',
  43652. 'Ḣ' => 'ḣ',
  43653. 'Ḥ' => 'ḥ',
  43654. 'Ḧ' => 'ḧ',
  43655. 'Ḩ' => 'ḩ',
  43656. 'Ḫ' => 'ḫ',
  43657. 'Ḭ' => 'ḭ',
  43658. 'Ḯ' => 'ḯ',
  43659. 'Ḱ' => 'ḱ',
  43660. 'Ḳ' => 'ḳ',
  43661. 'Ḵ' => 'ḵ',
  43662. 'Ḷ' => 'ḷ',
  43663. 'Ḹ' => 'ḹ',
  43664. 'Ḻ' => 'ḻ',
  43665. 'Ḽ' => 'ḽ',
  43666. 'Ḿ' => 'ḿ',
  43667. 'Ṁ' => '�',
  43668. 'Ṃ' => 'ṃ',
  43669. 'Ṅ' => 'ṅ',
  43670. 'Ṇ' => 'ṇ',
  43671. 'Ṉ' => 'ṉ',
  43672. 'Ṋ' => 'ṋ',
  43673. 'Ṍ' => '�',
  43674. 'Ṏ' => '�',
  43675. '�' => 'ṑ',
  43676. 'Ṓ' => 'ṓ',
  43677. 'Ṕ' => 'ṕ',
  43678. 'á¹–' => 'á¹—',
  43679. 'Ṙ' => 'ṙ',
  43680. 'Ṛ' => 'ṛ',
  43681. 'Ṝ' => '�',
  43682. 'Ṟ' => 'ṟ',
  43683. 'Ṡ' => 'ṡ',
  43684. 'á¹¢' => 'á¹£',
  43685. 'Ṥ' => 'ṥ',
  43686. 'Ṧ' => 'ṧ',
  43687. 'Ṩ' => 'ṩ',
  43688. 'Ṫ' => 'ṫ',
  43689. 'Ṭ' => 'ṭ',
  43690. 'Ṯ' => 'ṯ',
  43691. 'á¹°' => 'á¹±',
  43692. 'á¹²' => 'á¹³',
  43693. 'á¹´' => 'á¹µ',
  43694. 'Ṷ' => 'ṷ',
  43695. 'Ṹ' => 'ṹ',
  43696. 'Ṻ' => 'ṻ',
  43697. 'á¹¼' => 'á¹½',
  43698. 'Ṿ' => 'ṿ',
  43699. 'Ẁ' => '�',
  43700. 'Ẃ' => 'ẃ',
  43701. 'Ẅ' => 'ẅ',
  43702. 'Ẇ' => 'ẇ',
  43703. 'Ẉ' => 'ẉ',
  43704. 'Ẋ' => 'ẋ',
  43705. 'Ẍ' => '�',
  43706. 'Ẏ' => '�',
  43707. '�' => 'ẑ',
  43708. 'Ẓ' => 'ẓ',
  43709. 'Ẕ' => 'ẕ',
  43710. 'ẞ' => 'ß',
  43711. 'Ạ' => 'ạ',
  43712. 'Ả' => 'ả',
  43713. 'Ấ' => 'ấ',
  43714. 'Ầ' => 'ầ',
  43715. 'Ẩ' => 'ẩ',
  43716. 'Ẫ' => 'ẫ',
  43717. 'Ậ' => 'ậ',
  43718. 'Ắ' => 'ắ',
  43719. 'Ằ' => 'ằ',
  43720. 'Ẳ' => 'ẳ',
  43721. 'Ẵ' => 'ẵ',
  43722. 'Ặ' => 'ặ',
  43723. 'Ẹ' => 'ẹ',
  43724. 'Ẻ' => 'ẻ',
  43725. 'Ẽ' => 'ẽ',
  43726. 'Ế' => 'ế',
  43727. 'Ề' => '�',
  43728. 'Ể' => 'ể',
  43729. 'Ễ' => 'ễ',
  43730. 'Ệ' => 'ệ',
  43731. 'Ỉ' => 'ỉ',
  43732. 'Ị' => 'ị',
  43733. 'Ọ' => '�',
  43734. 'Ỏ' => '�',
  43735. '�' => 'ố',
  43736. 'Ồ' => 'ồ',
  43737. 'Ổ' => 'ổ',
  43738. 'á»–' => 'á»—',
  43739. 'Ộ' => 'ộ',
  43740. 'Ớ' => 'ớ',
  43741. 'Ờ' => '�',
  43742. 'Ở' => 'ở',
  43743. 'Ỡ' => 'ỡ',
  43744. 'Ợ' => 'ợ',
  43745. 'Ụ' => 'ụ',
  43746. 'Ủ' => 'ủ',
  43747. 'Ứ' => 'ứ',
  43748. 'Ừ' => 'ừ',
  43749. 'Ử' => 'ử',
  43750. 'Ữ' => 'ữ',
  43751. 'á»°' => 'á»±',
  43752. 'Ỳ' => 'ỳ',
  43753. 'Ỵ' => 'ỵ',
  43754. 'Ỷ' => 'ỷ',
  43755. 'Ỹ' => 'ỹ',
  43756. 'Ỻ' => 'ỻ',
  43757. 'Ỽ' => 'ỽ',
  43758. 'Ỿ' => 'ỿ',
  43759. 'Ἀ' => 'ἀ',
  43760. 'Ἁ' => '�',
  43761. 'Ἂ' => 'ἂ',
  43762. 'Ἃ' => 'ἃ',
  43763. 'Ἄ' => 'ἄ',
  43764. '�' => 'ἅ',
  43765. 'Ἆ' => 'ἆ',
  43766. '�' => 'ἇ',
  43767. 'Ἐ' => '�',
  43768. 'Ἑ' => 'ἑ',
  43769. 'Ἒ' => 'ἒ',
  43770. 'Ἓ' => 'ἓ',
  43771. 'Ἔ' => 'ἔ',
  43772. '�' => 'ἕ',
  43773. 'Ἠ' => 'ἠ',
  43774. 'Ἡ' => 'ἡ',
  43775. 'Ἢ' => 'ἢ',
  43776. 'Ἣ' => 'ἣ',
  43777. 'Ἤ' => 'ἤ',
  43778. 'á¼­' => 'á¼¥',
  43779. 'Ἦ' => 'ἦ',
  43780. 'Ἧ' => 'ἧ',
  43781. 'Ἰ' => 'ἰ',
  43782. 'á¼¹' => 'á¼±',
  43783. 'Ἲ' => 'ἲ',
  43784. 'á¼»' => 'á¼³',
  43785. 'á¼¼' => 'á¼´',
  43786. 'á¼½' => 'á¼µ',
  43787. 'Ἶ' => 'ἶ',
  43788. 'Ἷ' => 'ἷ',
  43789. 'Ὀ' => 'ὀ',
  43790. 'Ὁ' => '�',
  43791. 'Ὂ' => 'ὂ',
  43792. 'Ὃ' => 'ὃ',
  43793. 'Ὄ' => 'ὄ',
  43794. '�' => 'ὅ',
  43795. 'Ὑ' => 'ὑ',
  43796. 'Ὓ' => 'ὓ',
  43797. '�' => 'ὕ',
  43798. 'Ὗ' => 'ὗ',
  43799. 'Ὠ' => 'ὠ',
  43800. 'Ὡ' => 'ὡ',
  43801. 'Ὢ' => 'ὢ',
  43802. 'Ὣ' => 'ὣ',
  43803. 'Ὤ' => 'ὤ',
  43804. 'á½­' => 'á½¥',
  43805. 'Ὦ' => 'ὦ',
  43806. 'Ὧ' => 'ὧ',
  43807. 'ᾈ' => 'ᾀ',
  43808. 'ᾉ' => '�',
  43809. 'ᾊ' => 'ᾂ',
  43810. 'ᾋ' => 'ᾃ',
  43811. 'ᾌ' => 'ᾄ',
  43812. '�' => 'ᾅ',
  43813. 'ᾎ' => 'ᾆ',
  43814. '�' => 'ᾇ',
  43815. 'ᾘ' => '�',
  43816. 'ᾙ' => 'ᾑ',
  43817. 'ᾚ' => 'ᾒ',
  43818. 'ᾛ' => 'ᾓ',
  43819. 'ᾜ' => 'ᾔ',
  43820. '�' => 'ᾕ',
  43821. 'ᾞ' => 'ᾖ',
  43822. 'ᾟ' => 'ᾗ',
  43823. 'ᾨ' => 'ᾠ',
  43824. 'ᾩ' => 'ᾡ',
  43825. 'ᾪ' => 'ᾢ',
  43826. 'ᾫ' => 'ᾣ',
  43827. 'ᾬ' => 'ᾤ',
  43828. 'á¾­' => 'á¾¥',
  43829. 'ᾮ' => 'ᾦ',
  43830. 'ᾯ' => 'ᾧ',
  43831. 'Ᾰ' => 'ᾰ',
  43832. 'á¾¹' => 'á¾±',
  43833. 'Ὰ' => 'ὰ',
  43834. 'á¾»' => 'á½±',
  43835. 'á¾¼' => 'á¾³',
  43836. 'Ὲ' => 'ὲ',
  43837. 'Έ' => 'έ',
  43838. 'á¿Š' => 'á½´',
  43839. 'á¿‹' => 'á½µ',
  43840. 'ῌ' => 'ῃ',
  43841. 'Ῐ' => '�',
  43842. 'á¿™' => 'á¿‘',
  43843. 'Ὶ' => 'ὶ',
  43844. 'á¿›' => 'á½·',
  43845. 'Ῠ' => 'ῠ',
  43846. 'á¿©' => 'á¿¡',
  43847. 'Ὺ' => 'ὺ',
  43848. 'á¿«' => 'á½»',
  43849. 'Ῥ' => 'ῥ',
  43850. 'Ὸ' => 'ὸ',
  43851. 'Ό' => 'ό',
  43852. 'Ὼ' => 'ὼ',
  43853. 'á¿»' => 'á½½',
  43854. 'ῼ' => 'ῳ',
  43855. 'Ω' => 'ω',
  43856. 'K' => 'k',
  43857. 'â„«' => 'Ã¥',
  43858. 'Ⅎ' => 'ⅎ',
  43859. 'â… ' => 'â…°',
  43860. 'â…¡' => 'â…±',
  43861. 'â…¢' => 'â…²',
  43862. 'â…£' => 'â…³',
  43863. 'â…¤' => 'â…´',
  43864. 'â…¥' => 'â…µ',
  43865. 'â…¦' => 'â…¶',
  43866. 'â…§' => 'â…·',
  43867. 'â…¨' => 'â…¸',
  43868. 'â…©' => 'â…¹',
  43869. 'â…ª' => 'â…º',
  43870. 'â…«' => 'â…»',
  43871. 'â…¬' => 'â…¼',
  43872. 'â…­' => 'â…½',
  43873. 'â…®' => 'â…¾',
  43874. 'â…¯' => 'â…¿',
  43875. 'Ↄ' => 'ↄ',
  43876. 'Ⓐ' => '�',
  43877. 'â’·' => 'â“‘',
  43878. 'â’¸' => 'â“’',
  43879. 'â’¹' => 'â““',
  43880. 'â’º' => 'â“”',
  43881. 'â’»' => 'â“•',
  43882. 'â’¼' => 'â“–',
  43883. 'â’½' => 'â“—',
  43884. 'Ⓘ' => 'ⓘ',
  43885. 'â’¿' => 'â“™',
  43886. 'â“€' => 'â“š',
  43887. '�' => 'ⓛ',
  43888. 'Ⓜ' => 'ⓜ',
  43889. 'Ⓝ' => '�',
  43890. 'â“„' => 'â“ž',
  43891. 'â“…' => 'â“Ÿ',
  43892. 'Ⓠ' => 'ⓠ',
  43893. 'Ⓡ' => 'ⓡ',
  43894. 'Ⓢ' => 'ⓢ',
  43895. 'Ⓣ' => 'ⓣ',
  43896. 'Ⓤ' => 'ⓤ',
  43897. 'â“‹' => 'â“¥',
  43898. 'Ⓦ' => 'ⓦ',
  43899. '�' => 'ⓧ',
  43900. 'Ⓨ' => 'ⓨ',
  43901. '�' => 'ⓩ',
  43902. 'â°€' => 'â°°',
  43903. 'â°�' => 'â°±',
  43904. 'â°‚' => 'â°²',
  43905. 'â°ƒ' => 'â°³',
  43906. 'â°„' => 'â°´',
  43907. 'â°…' => 'â°µ',
  43908. 'â°†' => 'â°¶',
  43909. 'â°‡' => 'â°·',
  43910. 'â°ˆ' => 'â°¸',
  43911. 'â°‰' => 'â°¹',
  43912. 'â°Š' => 'â°º',
  43913. 'â°‹' => 'â°»',
  43914. 'Ⰼ' => 'ⰼ',
  43915. 'â°�' => 'â°½',
  43916. 'â°Ž' => 'â°¾',
  43917. 'â°�' => 'â°¿',
  43918. 'â°�' => 'â±€',
  43919. 'Ⱁ' => '�',
  43920. 'Ⱂ' => 'ⱂ',
  43921. 'Ⱃ' => 'ⱃ',
  43922. 'Ⱄ' => 'ⱄ',
  43923. 'â°•' => 'â±…',
  43924. 'Ⱆ' => 'ⱆ',
  43925. 'Ⱇ' => 'ⱇ',
  43926. 'Ⱈ' => 'ⱈ',
  43927. 'Ⱉ' => 'ⱉ',
  43928. 'Ⱊ' => 'ⱊ',
  43929. 'Ⱋ' => 'ⱋ',
  43930. 'Ⱌ' => 'ⱌ',
  43931. '�' => '�',
  43932. 'Ⱎ' => 'ⱎ',
  43933. 'Ⱏ' => '�',
  43934. 'Ⱐ' => '�',
  43935. 'Ⱑ' => 'ⱑ',
  43936. 'â°¢' => 'â±’',
  43937. 'Ⱓ' => 'ⱓ',
  43938. 'â°¤' => 'â±”',
  43939. 'Ⱕ' => 'ⱕ',
  43940. 'â°¦' => 'â±–',
  43941. 'â°§' => 'â±—',
  43942. 'Ⱘ' => 'ⱘ',
  43943. 'â°©' => 'â±™',
  43944. 'Ⱚ' => 'ⱚ',
  43945. 'â°«' => 'â±›',
  43946. 'Ⱜ' => 'ⱜ',
  43947. 'Ⱝ' => '�',
  43948. 'Ⱞ' => 'ⱞ',
  43949. 'Ⱡ' => 'ⱡ',
  43950. 'â±¢' => 'É«',
  43951. 'â±£' => 'áµ½',
  43952. 'Ɽ' => 'ɽ',
  43953. 'Ⱨ' => 'ⱨ',
  43954. 'Ⱪ' => 'ⱪ',
  43955. 'Ⱬ' => 'ⱬ',
  43956. 'â±­' => 'É‘',
  43957. 'Ɱ' => 'ɱ',
  43958. 'Ɐ' => '�',
  43959. 'â±°' => 'É’',
  43960. 'â±²' => 'â±³',
  43961. 'Ⱶ' => 'ⱶ',
  43962. 'â±¾' => 'È¿',
  43963. 'Ɀ' => 'ɀ',
  43964. 'Ⲁ' => '�',
  43965. 'Ⲃ' => 'ⲃ',
  43966. 'Ⲅ' => 'ⲅ',
  43967. 'Ⲇ' => 'ⲇ',
  43968. 'Ⲉ' => 'ⲉ',
  43969. 'Ⲋ' => 'ⲋ',
  43970. 'Ⲍ' => '�',
  43971. 'Ⲏ' => '�',
  43972. '�' => 'ⲑ',
  43973. 'Ⲓ' => 'ⲓ',
  43974. 'Ⲕ' => 'ⲕ',
  43975. 'â²–' => 'â²—',
  43976. 'Ⲙ' => 'ⲙ',
  43977. 'Ⲛ' => 'ⲛ',
  43978. 'Ⲝ' => '�',
  43979. 'Ⲟ' => 'ⲟ',
  43980. 'Ⲡ' => 'ⲡ',
  43981. 'â²¢' => 'â²£',
  43982. 'Ⲥ' => 'ⲥ',
  43983. 'Ⲧ' => 'ⲧ',
  43984. 'Ⲩ' => 'ⲩ',
  43985. 'Ⲫ' => 'ⲫ',
  43986. 'Ⲭ' => 'ⲭ',
  43987. 'Ⲯ' => 'ⲯ',
  43988. 'â²°' => 'â²±',
  43989. 'â²²' => 'â²³',
  43990. 'â²´' => 'â²µ',
  43991. 'Ⲷ' => 'ⲷ',
  43992. 'Ⲹ' => 'ⲹ',
  43993. 'Ⲻ' => 'ⲻ',
  43994. 'â²¼' => 'â²½',
  43995. 'Ⲿ' => 'ⲿ',
  43996. 'Ⳁ' => '�',
  43997. 'Ⳃ' => 'ⳃ',
  43998. 'Ⳅ' => 'ⳅ',
  43999. 'Ⳇ' => 'ⳇ',
  44000. 'Ⳉ' => 'ⳉ',
  44001. 'Ⳋ' => 'ⳋ',
  44002. 'Ⳍ' => '�',
  44003. 'Ⳏ' => '�',
  44004. '�' => 'ⳑ',
  44005. 'Ⳓ' => 'ⳓ',
  44006. 'Ⳕ' => 'ⳕ',
  44007. 'â³–' => 'â³—',
  44008. 'Ⳙ' => 'ⳙ',
  44009. 'Ⳛ' => 'ⳛ',
  44010. 'Ⳝ' => '�',
  44011. 'Ⳟ' => 'ⳟ',
  44012. 'Ⳡ' => 'ⳡ',
  44013. 'â³¢' => 'â³£',
  44014. 'Ⳬ' => 'ⳬ',
  44015. 'â³­' => 'â³®',
  44016. 'â³²' => 'â³³',
  44017. 'Ꙁ' => '�',
  44018. 'Ꙃ' => 'ꙃ',
  44019. 'Ꙅ' => 'ꙅ',
  44020. 'Ꙇ' => 'ꙇ',
  44021. 'Ꙉ' => 'ꙉ',
  44022. 'Ꙋ' => 'ꙋ',
  44023. 'Ꙍ' => '�',
  44024. 'Ꙏ' => '�',
  44025. '�' => 'ꙑ',
  44026. 'Ꙓ' => 'ꙓ',
  44027. 'Ꙕ' => 'ꙕ',
  44028. 'ê™–' => 'ê™—',
  44029. 'Ꙙ' => 'ꙙ',
  44030. 'Ꙛ' => 'ꙛ',
  44031. 'Ꙝ' => '�',
  44032. 'Ꙟ' => 'ꙟ',
  44033. 'Ꙡ' => 'ꙡ',
  44034. 'Ꙣ' => 'ꙣ',
  44035. 'Ꙥ' => 'ꙥ',
  44036. 'Ꙧ' => 'ꙧ',
  44037. 'Ꙩ' => 'ꙩ',
  44038. 'Ꙫ' => 'ꙫ',
  44039. 'Ꙭ' => 'ꙭ',
  44040. 'Ꚁ' => '�',
  44041. 'Ꚃ' => 'ꚃ',
  44042. 'êš„' => 'êš…',
  44043. 'Ꚇ' => 'ꚇ',
  44044. 'Ꚉ' => 'ꚉ',
  44045. 'Ꚋ' => 'ꚋ',
  44046. 'Ꚍ' => '�',
  44047. 'Ꚏ' => '�',
  44048. '�' => 'ꚑ',
  44049. 'êš’' => 'êš“',
  44050. 'êš”' => 'êš•',
  44051. 'êš–' => 'êš—',
  44052. 'Ꚙ' => 'ꚙ',
  44053. 'êšš' => 'êš›',
  44054. 'Ꜣ' => 'ꜣ',
  44055. 'Ꜥ' => 'ꜥ',
  44056. 'Ꜧ' => 'ꜧ',
  44057. 'Ꜩ' => 'ꜩ',
  44058. 'Ꜫ' => 'ꜫ',
  44059. 'Ꜭ' => 'ꜭ',
  44060. 'Ꜯ' => 'ꜯ',
  44061. 'Ꜳ' => 'ꜳ',
  44062. 'Ꜵ' => 'ꜵ',
  44063. 'Ꜷ' => 'ꜷ',
  44064. 'Ꜹ' => 'ꜹ',
  44065. 'Ꜻ' => 'ꜻ',
  44066. 'Ꜽ' => 'ꜽ',
  44067. 'Ꜿ' => 'ꜿ',
  44068. '�' => '�',
  44069. '�' => '�',
  44070. '�' => '�',
  44071. '�' => '�',
  44072. '�' => '�',
  44073. '�' => '�',
  44074. '�' => '�',
  44075. '�' => '�',
  44076. '�' => '�',
  44077. '�' => '�',
  44078. '�' => '�',
  44079. '�' => '�',
  44080. '�' => '�',
  44081. '�' => '�',
  44082. '�' => '�',
  44083. '�' => '�',
  44084. '�' => '�',
  44085. '�' => '�',
  44086. '�' => '�',
  44087. '�' => '�',
  44088. '�' => '�',
  44089. '�' => '�',
  44090. '�' => '�',
  44091. '�' => '�',
  44092. '�' => '�',
  44093. '�' => '�',
  44094. '�' => 'ᵹ',
  44095. '�' => '�',
  44096. 'Ꞁ' => '�',
  44097. 'Ꞃ' => 'ꞃ',
  44098. 'êž„' => 'êž…',
  44099. 'Ꞇ' => 'ꞇ',
  44100. 'Ꞌ' => 'ꞌ',
  44101. '�' => 'ɥ',
  44102. '�' => 'ꞑ',
  44103. 'êž’' => 'êž“',
  44104. 'êž–' => 'êž—',
  44105. 'Ꞙ' => 'ꞙ',
  44106. 'êžš' => 'êž›',
  44107. 'Ꞝ' => '�',
  44108. 'Ꞟ' => 'ꞟ',
  44109. 'êž ' => 'êž¡',
  44110. 'Ꞣ' => 'ꞣ',
  44111. 'Ꞥ' => 'ꞥ',
  44112. 'Ꞧ' => 'ꞧ',
  44113. 'Ꞩ' => 'ꞩ',
  44114. 'Ɦ' => 'ɦ',
  44115. 'Ɜ' => 'ɜ',
  44116. 'Ɡ' => 'ɡ',
  44117. 'Ɬ' => 'ɬ',
  44118. 'êž°' => 'Êž',
  44119. 'Ʇ' => 'ʇ',
  44120. 'A' => '�',
  44121. 'B' => 'b',
  44122. 'C' => 'c',
  44123. 'D' => 'd',
  44124. 'ï¼¥' => 'ï½…',
  44125. 'F' => 'f',
  44126. 'G' => 'g',
  44127. 'H' => 'h',
  44128. 'I' => 'i',
  44129. 'J' => 'j',
  44130. 'K' => 'k',
  44131. 'L' => 'l',
  44132. 'M' => '�',
  44133. 'N' => 'n',
  44134. 'O' => '�',
  44135. 'P' => '�',
  44136. 'Q' => 'q',
  44137. 'ï¼²' => 'ï½’',
  44138. 'S' => 's',
  44139. 'ï¼´' => 'ï½”',
  44140. 'U' => 'u',
  44141. 'V' => 'v',
  44142. 'ï¼·' => 'ï½—',
  44143. 'X' => 'x',
  44144. 'ï¼¹' => 'ï½™',
  44145. 'Z' => 'z',
  44146. '�' => '�',
  44147. '�' => '�',
  44148. '�' => '�',
  44149. '�' => '�',
  44150. '�' => '�',
  44151. '�' => '�',
  44152. '�' => '�',
  44153. '�' => '�',
  44154. '�' => '�',
  44155. '�' => '�',
  44156. '�' => '�',
  44157. '�' => '�',
  44158. '�' => '�',
  44159. '�' => '�',
  44160. '�' => '�',
  44161. '�' => '�',
  44162. '�' => '�',
  44163. '�' => '�',
  44164. '�' => '�',
  44165. '�' => '�',
  44166. '�' => '�',
  44167. '�' => '�',
  44168. '�' => '�',
  44169. '�' => '�',
  44170. '�' => '�',
  44171. '�' => '�',
  44172. '�' => '�',
  44173. '�' => '�',
  44174. '�' => '�',
  44175. '�' => '�',
  44176. '�' => '�',
  44177. '�' => '�',
  44178. '�' => '�',
  44179. '�' => '�',
  44180. '�' => '�',
  44181. '�' => '�',
  44182. '�' => '�',
  44183. '�' => '�',
  44184. '�' => '�',
  44185. '�' => '�',
  44186. 'ð‘¢ ' => 'ð‘£€',
  44187. '𑢡' => '�',
  44188. '𑢢' => '𑣂',
  44189. '𑢣' => '𑣃',
  44190. '𑢤' => '𑣄',
  44191. 'ð‘¢¥' => 'ð‘£…',
  44192. '𑢦' => '𑣆',
  44193. '𑢧' => '𑣇',
  44194. '𑢨' => '𑣈',
  44195. '𑢩' => '𑣉',
  44196. '𑢪' => '𑣊',
  44197. '𑢫' => '𑣋',
  44198. '𑢬' => '𑣌',
  44199. '𑢭' => '�',
  44200. '𑢮' => '𑣎',
  44201. '𑢯' => '�',
  44202. '𑢰' => '�',
  44203. '𑢱' => '𑣑',
  44204. 'ð‘¢²' => 'ð‘£’',
  44205. '𑢳' => '𑣓',
  44206. 'ð‘¢´' => 'ð‘£”',
  44207. '𑢵' => '𑣕',
  44208. '𑢶' => '𑣖',
  44209. 'ð‘¢·' => 'ð‘£—',
  44210. '𑢸' => '𑣘',
  44211. 'ð‘¢¹' => 'ð‘£™',
  44212. '𑢺' => '𑣚',
  44213. 'ð‘¢»' => 'ð‘£›',
  44214. '𑢼' => '𑣜',
  44215. '𑢽' => '�',
  44216. '𑢾' => '𑣞',
  44217. '𑢿' => '𑣟',
  44218. );
  44219. <?php
  44220. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  44221. <?php
  44222. return array(
  44223. 'a' => 'A',
  44224. 'b' => 'B',
  44225. 'c' => 'C',
  44226. 'd' => 'D',
  44227. 'e' => 'E',
  44228. 'f' => 'F',
  44229. 'g' => 'G',
  44230. 'h' => 'H',
  44231. 'i' => 'I',
  44232. 'j' => 'J',
  44233. 'k' => 'K',
  44234. 'l' => 'L',
  44235. 'm' => 'M',
  44236. 'n' => 'N',
  44237. 'o' => 'O',
  44238. 'p' => 'P',
  44239. 'q' => 'Q',
  44240. 'r' => 'R',
  44241. 's' => 'S',
  44242. 't' => 'T',
  44243. 'u' => 'U',
  44244. 'v' => 'V',
  44245. 'w' => 'W',
  44246. 'x' => 'X',
  44247. 'y' => 'Y',
  44248. 'z' => 'Z',
  44249. 'µ' => 'Μ',
  44250. 'à' => 'À',
  44251. 'á' => '�',
  44252. 'â' => 'Â',
  44253. 'ã' => 'Ã',
  44254. 'ä' => 'Ä',
  44255. 'Ã¥' => 'Ã…',
  44256. 'æ' => 'Æ',
  44257. 'ç' => 'Ç',
  44258. 'è' => 'È',
  44259. 'é' => 'É',
  44260. 'ê' => 'Ê',
  44261. 'ë' => 'Ë',
  44262. 'ì' => 'Ì',
  44263. 'í' => '�',
  44264. 'î' => 'Î',
  44265. 'ï' => '�',
  44266. 'ð' => '�',
  44267. 'ñ' => 'Ñ',
  44268. 'ò' => 'Ò',
  44269. 'ó' => 'Ó',
  44270. 'ô' => 'Ô',
  44271. 'õ' => 'Õ',
  44272. 'ö' => 'Ö',
  44273. 'ø' => 'Ø',
  44274. 'ù' => 'Ù',
  44275. 'ú' => 'Ú',
  44276. 'û' => 'Û',
  44277. 'ü' => 'Ü',
  44278. 'ý' => '�',
  44279. 'þ' => 'Þ',
  44280. 'ÿ' => 'Ÿ',
  44281. '�' => 'Ā',
  44282. 'ă' => 'Ă',
  44283. 'Ä…' => 'Ä„',
  44284. 'ć' => 'Ć',
  44285. 'ĉ' => 'Ĉ',
  44286. 'Ä‹' => 'ÄŠ',
  44287. '�' => 'Č',
  44288. '�' => 'Ď',
  44289. 'đ' => '�',
  44290. 'Ä“' => 'Ä’',
  44291. 'Ä•' => 'Ä”',
  44292. 'Ä—' => 'Ä–',
  44293. 'ę' => 'Ę',
  44294. 'Ä›' => 'Äš',
  44295. '�' => 'Ĝ',
  44296. 'ÄŸ' => 'Äž',
  44297. 'Ä¡' => 'Ä ',
  44298. 'Ä£' => 'Ä¢',
  44299. 'ĥ' => 'Ĥ',
  44300. 'ħ' => 'Ħ',
  44301. 'ĩ' => 'Ĩ',
  44302. 'ī' => 'Ī',
  44303. 'ĭ' => 'Ĭ',
  44304. 'į' => 'Į',
  44305. 'ı' => 'I',
  44306. 'ij' => 'IJ',
  44307. 'ĵ' => 'Ĵ',
  44308. 'ķ' => 'Ķ',
  44309. 'ĺ' => 'Ĺ',
  44310. 'ļ' => 'Ļ',
  44311. 'ľ' => 'Ľ',
  44312. 'Å€' => 'Ä¿',
  44313. 'ł' => '�',
  44314. 'ń' => 'Ń',
  44315. 'ņ' => 'Ņ',
  44316. 'ň' => 'Ň',
  44317. 'Å‹' => 'ÅŠ',
  44318. '�' => 'Ō',
  44319. '�' => 'Ŏ',
  44320. 'ő' => '�',
  44321. 'Å“' => 'Å’',
  44322. 'Å•' => 'Å”',
  44323. 'Å—' => 'Å–',
  44324. 'ř' => 'Ř',
  44325. 'Å›' => 'Åš',
  44326. '�' => 'Ŝ',
  44327. 'ÅŸ' => 'Åž',
  44328. 'Å¡' => 'Å ',
  44329. 'Å£' => 'Å¢',
  44330. 'ť' => 'Ť',
  44331. 'ŧ' => 'Ŧ',
  44332. 'ũ' => 'Ũ',
  44333. 'ū' => 'Ū',
  44334. 'ŭ' => 'Ŭ',
  44335. 'ů' => 'Ů',
  44336. 'ű' => 'Ű',
  44337. 'ų' => 'Ų',
  44338. 'ŵ' => 'Ŵ',
  44339. 'ŷ' => 'Ŷ',
  44340. 'ź' => 'Ź',
  44341. 'ż' => 'Ż',
  44342. 'ž' => 'Ž',
  44343. 'Å¿' => 'S',
  44344. 'ƀ' => 'Ƀ',
  44345. 'ƃ' => 'Ƃ',
  44346. 'Æ…' => 'Æ„',
  44347. 'ƈ' => 'Ƈ',
  44348. 'ƌ' => 'Ƌ',
  44349. 'Æ’' => 'Æ‘',
  44350. 'ƕ' => 'Ƕ',
  44351. 'ƙ' => 'Ƙ',
  44352. 'ƚ' => 'Ƚ',
  44353. 'Æž' => 'È ',
  44354. 'Æ¡' => 'Æ ',
  44355. 'Æ£' => 'Æ¢',
  44356. 'ƥ' => 'Ƥ',
  44357. 'ƨ' => 'Ƨ',
  44358. 'ƭ' => 'Ƭ',
  44359. 'ư' => 'Ư',
  44360. 'ƴ' => 'Ƴ',
  44361. 'ƶ' => 'Ƶ',
  44362. 'ƹ' => 'Ƹ',
  44363. 'ƽ' => 'Ƽ',
  44364. 'Æ¿' => 'Ç·',
  44365. 'Ç…' => 'Ç„',
  44366. 'dž' => 'DŽ',
  44367. 'Lj' => 'LJ',
  44368. 'lj' => 'LJ',
  44369. 'Ç‹' => 'ÇŠ',
  44370. 'nj' => 'NJ',
  44371. 'ǎ' => '�',
  44372. '�' => '�',
  44373. 'Ç’' => 'Ç‘',
  44374. 'Ç”' => 'Ç“',
  44375. 'Ç–' => 'Ç•',
  44376. 'ǘ' => 'Ǘ',
  44377. 'Çš' => 'Ç™',
  44378. 'ǜ' => 'Ǜ',
  44379. '�' => 'Ǝ',
  44380. 'ÇŸ' => 'Çž',
  44381. 'Ç¡' => 'Ç ',
  44382. 'Ç£' => 'Ç¢',
  44383. 'ǥ' => 'Ǥ',
  44384. 'ǧ' => 'Ǧ',
  44385. 'ǩ' => 'Ǩ',
  44386. 'ǫ' => 'Ǫ',
  44387. 'ǭ' => 'Ǭ',
  44388. 'ǯ' => 'Ǯ',
  44389. 'Dz' => 'DZ',
  44390. 'dz' => 'DZ',
  44391. 'ǵ' => 'Ǵ',
  44392. 'ǹ' => 'Ǹ',
  44393. 'ǻ' => 'Ǻ',
  44394. 'ǽ' => 'Ǽ',
  44395. 'ǿ' => 'Ǿ',
  44396. '�' => 'Ȁ',
  44397. 'ȃ' => 'Ȃ',
  44398. 'È…' => 'È„',
  44399. 'ȇ' => 'Ȇ',
  44400. 'ȉ' => 'Ȉ',
  44401. 'È‹' => 'ÈŠ',
  44402. '�' => 'Ȍ',
  44403. '�' => 'Ȏ',
  44404. 'ȑ' => '�',
  44405. 'È“' => 'È’',
  44406. 'È•' => 'È”',
  44407. 'È—' => 'È–',
  44408. 'ș' => 'Ș',
  44409. 'È›' => 'Èš',
  44410. '�' => 'Ȝ',
  44411. 'ÈŸ' => 'Èž',
  44412. 'È£' => 'È¢',
  44413. 'ȥ' => 'Ȥ',
  44414. 'ȧ' => 'Ȧ',
  44415. 'ȩ' => 'Ȩ',
  44416. 'ȫ' => 'Ȫ',
  44417. 'ȭ' => 'Ȭ',
  44418. 'ȯ' => 'Ȯ',
  44419. 'ȱ' => 'Ȱ',
  44420. 'ȳ' => 'Ȳ',
  44421. 'ȼ' => 'Ȼ',
  44422. 'È¿' => 'â±¾',
  44423. 'ɀ' => 'Ɀ',
  44424. 'ɂ' => '�',
  44425. 'ɇ' => 'Ɇ',
  44426. 'ɉ' => 'Ɉ',
  44427. 'É‹' => 'ÉŠ',
  44428. '�' => 'Ɍ',
  44429. '�' => 'Ɏ',
  44430. '�' => 'Ɐ',
  44431. 'É‘' => 'â±­',
  44432. 'É’' => 'â±°',
  44433. 'ɓ' => '�',
  44434. 'ɔ' => 'Ɔ',
  44435. 'ɖ' => 'Ɖ',
  44436. 'É—' => 'ÆŠ',
  44437. 'ə' => '�',
  44438. 'ɛ' => '�',
  44439. 'ɜ' => 'Ɜ',
  44440. 'É ' => 'Æ“',
  44441. 'ɡ' => 'Ɡ',
  44442. 'É£' => 'Æ”',
  44443. 'ɥ' => '�',
  44444. 'ɦ' => 'Ɦ',
  44445. 'ɨ' => 'Ɨ',
  44446. 'É©' => 'Æ–',
  44447. 'É«' => 'â±¢',
  44448. 'ɬ' => 'Ɬ',
  44449. 'ɯ' => 'Ɯ',
  44450. 'ɱ' => 'Ɱ',
  44451. 'ɲ' => '�',
  44452. 'ɵ' => 'Ɵ',
  44453. 'ɽ' => 'Ɽ',
  44454. 'ʀ' => 'Ʀ',
  44455. 'ʃ' => 'Ʃ',
  44456. 'ʇ' => 'Ʇ',
  44457. 'ʈ' => 'Ʈ',
  44458. 'ʉ' => 'Ʉ',
  44459. 'ʊ' => 'Ʊ',
  44460. 'ʋ' => 'Ʋ',
  44461. 'ʌ' => 'Ʌ',
  44462. 'Ê’' => 'Æ·',
  44463. 'Êž' => 'êž°',
  44464. 'ͅ' => 'Ι',
  44465. 'ͱ' => 'Ͱ',
  44466. 'ͳ' => 'Ͳ',
  44467. 'ͷ' => 'Ͷ',
  44468. 'ͻ' => 'Ͻ',
  44469. 'ͼ' => 'Ͼ',
  44470. 'ͽ' => 'Ͽ',
  44471. 'ά' => 'Ά',
  44472. 'έ' => 'Έ',
  44473. 'ή' => 'Ή',
  44474. 'ί' => 'Ί',
  44475. 'α' => 'Α',
  44476. 'β' => 'Β',
  44477. 'γ' => 'Γ',
  44478. 'δ' => 'Δ',
  44479. 'ε' => 'Ε',
  44480. 'ζ' => 'Ζ',
  44481. 'η' => 'Η',
  44482. 'θ' => 'Θ',
  44483. 'ι' => 'Ι',
  44484. 'κ' => 'Κ',
  44485. 'λ' => 'Λ',
  44486. 'μ' => 'Μ',
  44487. 'ν' => '�',
  44488. 'ξ' => 'Ξ',
  44489. 'ο' => 'Ο',
  44490. 'π' => 'Π',
  44491. '�' => 'Ρ',
  44492. 'ς' => 'Σ',
  44493. 'σ' => 'Σ',
  44494. 'τ' => 'Τ',
  44495. 'Ï…' => 'Î¥',
  44496. 'φ' => 'Φ',
  44497. 'χ' => 'Χ',
  44498. 'ψ' => 'Ψ',
  44499. 'ω' => 'Ω',
  44500. 'ϊ' => 'Ϊ',
  44501. 'ϋ' => 'Ϋ',
  44502. 'ό' => 'Ό',
  44503. '�' => 'Ύ',
  44504. 'ώ' => '�',
  44505. '�' => 'Β',
  44506. 'ϑ' => 'Θ',
  44507. 'ϕ' => 'Φ',
  44508. 'ϖ' => 'Π',
  44509. 'ϗ' => '�',
  44510. 'ϙ' => 'Ϙ',
  44511. 'Ï›' => 'Ïš',
  44512. '�' => 'Ϝ',
  44513. 'ÏŸ' => 'Ïž',
  44514. 'Ï¡' => 'Ï ',
  44515. 'Ï£' => 'Ï¢',
  44516. 'ϥ' => 'Ϥ',
  44517. 'ϧ' => 'Ϧ',
  44518. 'ϩ' => 'Ϩ',
  44519. 'ϫ' => 'Ϫ',
  44520. 'ϭ' => 'Ϭ',
  44521. 'ϯ' => 'Ϯ',
  44522. 'ϰ' => 'Κ',
  44523. 'ϱ' => 'Ρ',
  44524. 'ϲ' => 'Ϲ',
  44525. 'ϳ' => 'Ϳ',
  44526. 'ϵ' => 'Ε',
  44527. 'ϸ' => 'Ϸ',
  44528. 'ϻ' => 'Ϻ',
  44529. 'а' => '�',
  44530. 'б' => 'Б',
  44531. 'в' => 'В',
  44532. 'г' => 'Г',
  44533. 'д' => 'Д',
  44534. 'е' => 'Е',
  44535. 'ж' => 'Ж',
  44536. 'з' => 'З',
  44537. 'и' => 'И',
  44538. 'й' => 'Й',
  44539. 'к' => 'К',
  44540. 'л' => 'Л',
  44541. 'м' => 'М',
  44542. 'н' => '�',
  44543. 'о' => 'О',
  44544. 'п' => 'П',
  44545. 'р' => 'Р',
  44546. '�' => 'С',
  44547. 'т' => 'Т',
  44548. 'у' => 'У',
  44549. 'ф' => 'Ф',
  44550. 'Ñ…' => 'Ð¥',
  44551. 'ц' => 'Ц',
  44552. 'ч' => 'Ч',
  44553. 'ш' => 'Ш',
  44554. 'щ' => 'Щ',
  44555. 'ъ' => 'Ъ',
  44556. 'ы' => 'Ы',
  44557. 'ь' => 'Ь',
  44558. '�' => 'Э',
  44559. 'ю' => 'Ю',
  44560. '�' => 'Я',
  44561. '�' => 'Ѐ',
  44562. 'ё' => '�',
  44563. 'ђ' => 'Ђ',
  44564. 'ѓ' => 'Ѓ',
  44565. 'є' => 'Є',
  44566. 'Ñ•' => 'Ð…',
  44567. 'і' => 'І',
  44568. 'ї' => 'Ї',
  44569. 'ј' => 'Ј',
  44570. 'љ' => 'Љ',
  44571. 'њ' => 'Њ',
  44572. 'ћ' => 'Ћ',
  44573. 'ќ' => 'Ќ',
  44574. '�' => '�',
  44575. 'Ñž' => 'ÐŽ',
  44576. 'џ' => '�',
  44577. 'Ñ¡' => 'Ñ ',
  44578. 'Ñ£' => 'Ñ¢',
  44579. 'ѥ' => 'Ѥ',
  44580. 'ѧ' => 'Ѧ',
  44581. 'ѩ' => 'Ѩ',
  44582. 'ѫ' => 'Ѫ',
  44583. 'ѭ' => 'Ѭ',
  44584. 'ѯ' => 'Ѯ',
  44585. 'ѱ' => 'Ѱ',
  44586. 'ѳ' => 'Ѳ',
  44587. 'ѵ' => 'Ѵ',
  44588. 'ѷ' => 'Ѷ',
  44589. 'ѹ' => 'Ѹ',
  44590. 'ѻ' => 'Ѻ',
  44591. 'ѽ' => 'Ѽ',
  44592. 'ѿ' => 'Ѿ',
  44593. 'Ò�' => 'Ò€',
  44594. 'Ò‹' => 'ÒŠ',
  44595. '�' => 'Ҍ',
  44596. 'Ò�' => 'ÒŽ',
  44597. 'Ò‘' => 'Ò�',
  44598. 'Ò“' => 'Ò’',
  44599. 'Ò•' => 'Ò”',
  44600. 'Ò—' => 'Ò–',
  44601. 'Ò™' => 'Ò˜',
  44602. 'Ò›' => 'Òš',
  44603. '�' => 'Ҝ',
  44604. 'ÒŸ' => 'Òž',
  44605. 'Ò¡' => 'Ò ',
  44606. 'Ò£' => 'Ò¢',
  44607. 'Ò¥' => 'Ò¤',
  44608. 'Ò§' => 'Ò¦',
  44609. 'Ò©' => 'Ò¨',
  44610. 'Ò«' => 'Òª',
  44611. 'Ò­' => 'Ò¬',
  44612. 'Ò¯' => 'Ò®',
  44613. 'Ò±' => 'Ò°',
  44614. 'Ò³' => 'Ò²',
  44615. 'Òµ' => 'Ò´',
  44616. 'Ò·' => 'Ò¶',
  44617. 'Ò¹' => 'Ò¸',
  44618. 'Ò»' => 'Òº',
  44619. 'Ò½' => 'Ò¼',
  44620. 'Ò¿' => 'Ò¾',
  44621. 'Ó‚' => 'Ó�',
  44622. 'Ó„' => 'Óƒ',
  44623. 'Ó†' => 'Ó…',
  44624. 'Óˆ' => 'Ó‡',
  44625. 'ÓŠ' => 'Ó‰',
  44626. 'ӌ' => 'Ӌ',
  44627. 'ÓŽ' => 'Ó�',
  44628. 'Ó�' => 'Ó€',
  44629. 'Ó‘' => 'Ó�',
  44630. 'Ó“' => 'Ó’',
  44631. 'Ó•' => 'Ó”',
  44632. 'Ó—' => 'Ó–',
  44633. 'Ó™' => 'Ó˜',
  44634. 'Ó›' => 'Óš',
  44635. '�' => 'Ӝ',
  44636. 'ÓŸ' => 'Óž',
  44637. 'Ó¡' => 'Ó ',
  44638. 'Ó£' => 'Ó¢',
  44639. 'Ó¥' => 'Ó¤',
  44640. 'Ó§' => 'Ó¦',
  44641. 'Ó©' => 'Ó¨',
  44642. 'Ó«' => 'Óª',
  44643. 'Ó­' => 'Ó¬',
  44644. 'Ó¯' => 'Ó®',
  44645. 'Ó±' => 'Ó°',
  44646. 'Ó³' => 'Ó²',
  44647. 'Óµ' => 'Ó´',
  44648. 'Ó·' => 'Ó¶',
  44649. 'Ó¹' => 'Ó¸',
  44650. 'Ó»' => 'Óº',
  44651. 'Ó½' => 'Ó¼',
  44652. 'Ó¿' => 'Ó¾',
  44653. 'Ô�' => 'Ô€',
  44654. 'Ôƒ' => 'Ô‚',
  44655. 'Ô…' => 'Ô„',
  44656. 'Ô‡' => 'Ô†',
  44657. 'Ô‰' => 'Ôˆ',
  44658. 'Ô‹' => 'ÔŠ',
  44659. '�' => 'Ԍ',
  44660. 'Ô�' => 'ÔŽ',
  44661. 'Ô‘' => 'Ô�',
  44662. 'Ô“' => 'Ô’',
  44663. 'Ô•' => 'Ô”',
  44664. 'Ô—' => 'Ô–',
  44665. 'Ô™' => 'Ô˜',
  44666. 'Ô›' => 'Ôš',
  44667. '�' => 'Ԝ',
  44668. 'ÔŸ' => 'Ôž',
  44669. 'Ô¡' => 'Ô ',
  44670. 'Ô£' => 'Ô¢',
  44671. 'Ô¥' => 'Ô¤',
  44672. 'Ô§' => 'Ô¦',
  44673. 'Ô©' => 'Ô¨',
  44674. 'Ô«' => 'Ôª',
  44675. 'Ô­' => 'Ô¬',
  44676. 'Ô¯' => 'Ô®',
  44677. 'Õ¡' => 'Ô±',
  44678. 'Õ¢' => 'Ô²',
  44679. 'Õ£' => 'Ô³',
  44680. 'Õ¤' => 'Ô´',
  44681. 'Õ¥' => 'Ôµ',
  44682. 'Õ¦' => 'Ô¶',
  44683. 'Õ§' => 'Ô·',
  44684. 'Õ¨' => 'Ô¸',
  44685. 'Õ©' => 'Ô¹',
  44686. 'Õª' => 'Ôº',
  44687. 'Õ«' => 'Ô»',
  44688. 'Õ¬' => 'Ô¼',
  44689. 'Õ­' => 'Ô½',
  44690. 'Õ®' => 'Ô¾',
  44691. 'Õ¯' => 'Ô¿',
  44692. 'Õ°' => 'Õ€',
  44693. 'Õ±' => 'Õ�',
  44694. 'Õ²' => 'Õ‚',
  44695. 'Õ³' => 'Õƒ',
  44696. 'Õ´' => 'Õ„',
  44697. 'Õµ' => 'Õ…',
  44698. 'Õ¶' => 'Õ†',
  44699. 'Õ·' => 'Õ‡',
  44700. 'Õ¸' => 'Õˆ',
  44701. 'Õ¹' => 'Õ‰',
  44702. 'Õº' => 'ÕŠ',
  44703. 'Õ»' => 'Õ‹',
  44704. 'ռ' => 'Ռ',
  44705. 'Õ½' => 'Õ�',
  44706. 'Õ¾' => 'ÕŽ',
  44707. 'Õ¿' => 'Õ�',
  44708. 'Ö€' => 'Õ�',
  44709. 'Ö�' => 'Õ‘',
  44710. 'Ö‚' => 'Õ’',
  44711. 'Öƒ' => 'Õ“',
  44712. 'Ö„' => 'Õ”',
  44713. 'Ö…' => 'Õ•',
  44714. 'Ö†' => 'Õ–',
  44715. 'ᵹ' => '�',
  44716. 'áµ½' => 'â±£',
  44717. '�' => 'Ḁ',
  44718. 'ḃ' => 'Ḃ',
  44719. 'ḅ' => 'Ḅ',
  44720. 'ḇ' => 'Ḇ',
  44721. 'ḉ' => 'Ḉ',
  44722. 'ḋ' => 'Ḋ',
  44723. '�' => 'Ḍ',
  44724. '�' => 'Ḏ',
  44725. 'ḑ' => '�',
  44726. 'ḓ' => 'Ḓ',
  44727. 'ḕ' => 'Ḕ',
  44728. 'ḗ' => 'Ḗ',
  44729. 'ḙ' => 'Ḙ',
  44730. 'ḛ' => 'Ḛ',
  44731. '�' => 'Ḝ',
  44732. 'ḟ' => 'Ḟ',
  44733. 'ḡ' => 'Ḡ',
  44734. 'ḣ' => 'Ḣ',
  44735. 'ḥ' => 'Ḥ',
  44736. 'ḧ' => 'Ḧ',
  44737. 'ḩ' => 'Ḩ',
  44738. 'ḫ' => 'Ḫ',
  44739. 'ḭ' => 'Ḭ',
  44740. 'ḯ' => 'Ḯ',
  44741. 'ḱ' => 'Ḱ',
  44742. 'ḳ' => 'Ḳ',
  44743. 'ḵ' => 'Ḵ',
  44744. 'ḷ' => 'Ḷ',
  44745. 'ḹ' => 'Ḹ',
  44746. 'ḻ' => 'Ḻ',
  44747. 'ḽ' => 'Ḽ',
  44748. 'ḿ' => 'Ḿ',
  44749. '�' => 'Ṁ',
  44750. 'ṃ' => 'Ṃ',
  44751. 'ṅ' => 'Ṅ',
  44752. 'ṇ' => 'Ṇ',
  44753. 'ṉ' => 'Ṉ',
  44754. 'ṋ' => 'Ṋ',
  44755. '�' => 'Ṍ',
  44756. '�' => 'Ṏ',
  44757. 'ṑ' => '�',
  44758. 'ṓ' => 'Ṓ',
  44759. 'ṕ' => 'Ṕ',
  44760. 'á¹—' => 'á¹–',
  44761. 'ṙ' => 'Ṙ',
  44762. 'ṛ' => 'Ṛ',
  44763. '�' => 'Ṝ',
  44764. 'ṟ' => 'Ṟ',
  44765. 'ṡ' => 'Ṡ',
  44766. 'á¹£' => 'á¹¢',
  44767. 'ṥ' => 'Ṥ',
  44768. 'ṧ' => 'Ṧ',
  44769. 'ṩ' => 'Ṩ',
  44770. 'ṫ' => 'Ṫ',
  44771. 'ṭ' => 'Ṭ',
  44772. 'ṯ' => 'Ṯ',
  44773. 'á¹±' => 'á¹°',
  44774. 'á¹³' => 'á¹²',
  44775. 'á¹µ' => 'á¹´',
  44776. 'ṷ' => 'Ṷ',
  44777. 'ṹ' => 'Ṹ',
  44778. 'ṻ' => 'Ṻ',
  44779. 'á¹½' => 'á¹¼',
  44780. 'ṿ' => 'Ṿ',
  44781. '�' => 'Ẁ',
  44782. 'ẃ' => 'Ẃ',
  44783. 'ẅ' => 'Ẅ',
  44784. 'ẇ' => 'Ẇ',
  44785. 'ẉ' => 'Ẉ',
  44786. 'ẋ' => 'Ẋ',
  44787. '�' => 'Ẍ',
  44788. '�' => 'Ẏ',
  44789. 'ẑ' => '�',
  44790. 'ẓ' => 'Ẓ',
  44791. 'ẕ' => 'Ẕ',
  44792. 'ẛ' => 'Ṡ',
  44793. 'ạ' => 'Ạ',
  44794. 'ả' => 'Ả',
  44795. 'ấ' => 'Ấ',
  44796. 'ầ' => 'Ầ',
  44797. 'ẩ' => 'Ẩ',
  44798. 'ẫ' => 'Ẫ',
  44799. 'ậ' => 'Ậ',
  44800. 'ắ' => 'Ắ',
  44801. 'ằ' => 'Ằ',
  44802. 'ẳ' => 'Ẳ',
  44803. 'ẵ' => 'Ẵ',
  44804. 'ặ' => 'Ặ',
  44805. 'ẹ' => 'Ẹ',
  44806. 'ẻ' => 'Ẻ',
  44807. 'ẽ' => 'Ẽ',
  44808. 'ế' => 'Ế',
  44809. '�' => 'Ề',
  44810. 'ể' => 'Ể',
  44811. 'ễ' => 'Ễ',
  44812. 'ệ' => 'Ệ',
  44813. 'ỉ' => 'Ỉ',
  44814. 'ị' => 'Ị',
  44815. '�' => 'Ọ',
  44816. '�' => 'Ỏ',
  44817. 'ố' => '�',
  44818. 'ồ' => 'Ồ',
  44819. 'ổ' => 'Ổ',
  44820. 'á»—' => 'á»–',
  44821. 'ộ' => 'Ộ',
  44822. 'ớ' => 'Ớ',
  44823. '�' => 'Ờ',
  44824. 'ở' => 'Ở',
  44825. 'ỡ' => 'Ỡ',
  44826. 'ợ' => 'Ợ',
  44827. 'ụ' => 'Ụ',
  44828. 'ủ' => 'Ủ',
  44829. 'ứ' => 'Ứ',
  44830. 'ừ' => 'Ừ',
  44831. 'ử' => 'Ử',
  44832. 'ữ' => 'Ữ',
  44833. 'á»±' => 'á»°',
  44834. 'ỳ' => 'Ỳ',
  44835. 'ỵ' => 'Ỵ',
  44836. 'ỷ' => 'Ỷ',
  44837. 'ỹ' => 'Ỹ',
  44838. 'ỻ' => 'Ỻ',
  44839. 'ỽ' => 'Ỽ',
  44840. 'ỿ' => 'Ỿ',
  44841. 'ἀ' => 'Ἀ',
  44842. '�' => 'Ἁ',
  44843. 'ἂ' => 'Ἂ',
  44844. 'ἃ' => 'Ἃ',
  44845. 'ἄ' => 'Ἄ',
  44846. 'ἅ' => '�',
  44847. 'ἆ' => 'Ἆ',
  44848. 'ἇ' => '�',
  44849. '�' => 'Ἐ',
  44850. 'ἑ' => 'Ἑ',
  44851. 'ἒ' => 'Ἒ',
  44852. 'ἓ' => 'Ἓ',
  44853. 'ἔ' => 'Ἔ',
  44854. 'ἕ' => '�',
  44855. 'ἠ' => 'Ἠ',
  44856. 'ἡ' => 'Ἡ',
  44857. 'ἢ' => 'Ἢ',
  44858. 'ἣ' => 'Ἣ',
  44859. 'ἤ' => 'Ἤ',
  44860. 'á¼¥' => 'á¼­',
  44861. 'ἦ' => 'Ἦ',
  44862. 'ἧ' => 'Ἧ',
  44863. 'ἰ' => 'Ἰ',
  44864. 'á¼±' => 'á¼¹',
  44865. 'ἲ' => 'Ἲ',
  44866. 'á¼³' => 'á¼»',
  44867. 'á¼´' => 'á¼¼',
  44868. 'á¼µ' => 'á¼½',
  44869. 'ἶ' => 'Ἶ',
  44870. 'ἷ' => 'Ἷ',
  44871. 'ὀ' => 'Ὀ',
  44872. '�' => 'Ὁ',
  44873. 'ὂ' => 'Ὂ',
  44874. 'ὃ' => 'Ὃ',
  44875. 'ὄ' => 'Ὄ',
  44876. 'ὅ' => '�',
  44877. 'ὑ' => 'Ὑ',
  44878. 'ὓ' => 'Ὓ',
  44879. 'ὕ' => '�',
  44880. 'ὗ' => 'Ὗ',
  44881. 'ὠ' => 'Ὠ',
  44882. 'ὡ' => 'Ὡ',
  44883. 'ὢ' => 'Ὢ',
  44884. 'ὣ' => 'Ὣ',
  44885. 'ὤ' => 'Ὤ',
  44886. 'á½¥' => 'á½­',
  44887. 'ὦ' => 'Ὦ',
  44888. 'ὧ' => 'Ὧ',
  44889. 'ὰ' => 'Ὰ',
  44890. 'á½±' => 'á¾»',
  44891. 'ὲ' => 'Ὲ',
  44892. 'έ' => 'Έ',
  44893. 'á½´' => 'á¿Š',
  44894. 'á½µ' => 'á¿‹',
  44895. 'ὶ' => 'Ὶ',
  44896. 'á½·' => 'á¿›',
  44897. 'ὸ' => 'Ὸ',
  44898. 'ό' => 'Ό',
  44899. 'ὺ' => 'Ὺ',
  44900. 'á½»' => 'á¿«',
  44901. 'ὼ' => 'Ὼ',
  44902. 'á½½' => 'á¿»',
  44903. 'ᾀ' => 'ᾈ',
  44904. '�' => 'ᾉ',
  44905. 'ᾂ' => 'ᾊ',
  44906. 'ᾃ' => 'ᾋ',
  44907. 'ᾄ' => 'ᾌ',
  44908. 'ᾅ' => '�',
  44909. 'ᾆ' => 'ᾎ',
  44910. 'ᾇ' => '�',
  44911. '�' => 'ᾘ',
  44912. 'ᾑ' => 'ᾙ',
  44913. 'ᾒ' => 'ᾚ',
  44914. 'ᾓ' => 'ᾛ',
  44915. 'ᾔ' => 'ᾜ',
  44916. 'ᾕ' => '�',
  44917. 'ᾖ' => 'ᾞ',
  44918. 'ᾗ' => 'ᾟ',
  44919. 'ᾠ' => 'ᾨ',
  44920. 'ᾡ' => 'ᾩ',
  44921. 'ᾢ' => 'ᾪ',
  44922. 'ᾣ' => 'ᾫ',
  44923. 'ᾤ' => 'ᾬ',
  44924. 'á¾¥' => 'á¾­',
  44925. 'ᾦ' => 'ᾮ',
  44926. 'ᾧ' => 'ᾯ',
  44927. 'ᾰ' => 'Ᾰ',
  44928. 'á¾±' => 'á¾¹',
  44929. 'á¾³' => 'á¾¼',
  44930. 'ι' => 'Ι',
  44931. 'ῃ' => 'ῌ',
  44932. '�' => 'Ῐ',
  44933. 'á¿‘' => 'á¿™',
  44934. 'ῠ' => 'Ῠ',
  44935. 'á¿¡' => 'á¿©',
  44936. 'ῥ' => 'Ῥ',
  44937. 'ῳ' => 'ῼ',
  44938. 'ⅎ' => 'Ⅎ',
  44939. 'â…°' => 'â… ',
  44940. 'â…±' => 'â…¡',
  44941. 'â…²' => 'â…¢',
  44942. 'â…³' => 'â…£',
  44943. 'â…´' => 'â…¤',
  44944. 'â…µ' => 'â…¥',
  44945. 'â…¶' => 'â…¦',
  44946. 'â…·' => 'â…§',
  44947. 'â…¸' => 'â…¨',
  44948. 'â…¹' => 'â…©',
  44949. 'â…º' => 'â…ª',
  44950. 'â…»' => 'â…«',
  44951. 'â…¼' => 'â…¬',
  44952. 'â…½' => 'â…­',
  44953. 'â…¾' => 'â…®',
  44954. 'â…¿' => 'â…¯',
  44955. 'ↄ' => 'Ↄ',
  44956. '�' => 'Ⓐ',
  44957. 'â“‘' => 'â’·',
  44958. 'â“’' => 'â’¸',
  44959. 'â““' => 'â’¹',
  44960. 'â“”' => 'â’º',
  44961. 'â“•' => 'â’»',
  44962. 'â“–' => 'â’¼',
  44963. 'â“—' => 'â’½',
  44964. 'ⓘ' => 'Ⓘ',
  44965. 'â“™' => 'â’¿',
  44966. 'â“š' => 'â“€',
  44967. 'ⓛ' => '�',
  44968. 'ⓜ' => 'Ⓜ',
  44969. '�' => 'Ⓝ',
  44970. 'â“ž' => 'â“„',
  44971. 'â“Ÿ' => 'â“…',
  44972. 'ⓠ' => 'Ⓠ',
  44973. 'ⓡ' => 'Ⓡ',
  44974. 'ⓢ' => 'Ⓢ',
  44975. 'ⓣ' => 'Ⓣ',
  44976. 'ⓤ' => 'Ⓤ',
  44977. 'â“¥' => 'â“‹',
  44978. 'ⓦ' => 'Ⓦ',
  44979. 'ⓧ' => '�',
  44980. 'ⓨ' => 'Ⓨ',
  44981. 'ⓩ' => '�',
  44982. 'â°°' => 'â°€',
  44983. 'â°±' => 'â°�',
  44984. 'â°²' => 'â°‚',
  44985. 'â°³' => 'â°ƒ',
  44986. 'â°´' => 'â°„',
  44987. 'â°µ' => 'â°…',
  44988. 'â°¶' => 'â°†',
  44989. 'â°·' => 'â°‡',
  44990. 'â°¸' => 'â°ˆ',
  44991. 'â°¹' => 'â°‰',
  44992. 'â°º' => 'â°Š',
  44993. 'â°»' => 'â°‹',
  44994. 'ⰼ' => 'Ⰼ',
  44995. 'â°½' => 'â°�',
  44996. 'â°¾' => 'â°Ž',
  44997. 'â°¿' => 'â°�',
  44998. 'â±€' => 'â°�',
  44999. '�' => 'Ⱁ',
  45000. 'ⱂ' => 'Ⱂ',
  45001. 'ⱃ' => 'Ⱃ',
  45002. 'ⱄ' => 'Ⱄ',
  45003. 'â±…' => 'â°•',
  45004. 'ⱆ' => 'Ⱆ',
  45005. 'ⱇ' => 'Ⱇ',
  45006. 'ⱈ' => 'Ⱈ',
  45007. 'ⱉ' => 'Ⱉ',
  45008. 'ⱊ' => 'Ⱊ',
  45009. 'ⱋ' => 'Ⱋ',
  45010. 'ⱌ' => 'Ⱌ',
  45011. '�' => '�',
  45012. 'ⱎ' => 'Ⱎ',
  45013. '�' => 'Ⱏ',
  45014. '�' => 'Ⱐ',
  45015. 'ⱑ' => 'Ⱑ',
  45016. 'â±’' => 'â°¢',
  45017. 'ⱓ' => 'Ⱓ',
  45018. 'â±”' => 'â°¤',
  45019. 'ⱕ' => 'Ⱕ',
  45020. 'â±–' => 'â°¦',
  45021. 'â±—' => 'â°§',
  45022. 'ⱘ' => 'Ⱘ',
  45023. 'â±™' => 'â°©',
  45024. 'ⱚ' => 'Ⱚ',
  45025. 'â±›' => 'â°«',
  45026. 'ⱜ' => 'Ⱜ',
  45027. '�' => 'Ⱝ',
  45028. 'ⱞ' => 'Ⱞ',
  45029. 'ⱡ' => 'Ⱡ',
  45030. 'ⱥ' => 'Ⱥ',
  45031. 'ⱦ' => 'Ⱦ',
  45032. 'ⱨ' => 'Ⱨ',
  45033. 'ⱪ' => 'Ⱪ',
  45034. 'ⱬ' => 'Ⱬ',
  45035. 'â±³' => 'â±²',
  45036. 'ⱶ' => 'Ⱶ',
  45037. '�' => 'Ⲁ',
  45038. 'ⲃ' => 'Ⲃ',
  45039. 'ⲅ' => 'Ⲅ',
  45040. 'ⲇ' => 'Ⲇ',
  45041. 'ⲉ' => 'Ⲉ',
  45042. 'ⲋ' => 'Ⲋ',
  45043. '�' => 'Ⲍ',
  45044. '�' => 'Ⲏ',
  45045. 'ⲑ' => '�',
  45046. 'ⲓ' => 'Ⲓ',
  45047. 'ⲕ' => 'Ⲕ',
  45048. 'â²—' => 'â²–',
  45049. 'ⲙ' => 'Ⲙ',
  45050. 'ⲛ' => 'Ⲛ',
  45051. '�' => 'Ⲝ',
  45052. 'ⲟ' => 'Ⲟ',
  45053. 'ⲡ' => 'Ⲡ',
  45054. 'â²£' => 'â²¢',
  45055. 'ⲥ' => 'Ⲥ',
  45056. 'ⲧ' => 'Ⲧ',
  45057. 'ⲩ' => 'Ⲩ',
  45058. 'ⲫ' => 'Ⲫ',
  45059. 'ⲭ' => 'Ⲭ',
  45060. 'ⲯ' => 'Ⲯ',
  45061. 'â²±' => 'â²°',
  45062. 'â²³' => 'â²²',
  45063. 'â²µ' => 'â²´',
  45064. 'ⲷ' => 'Ⲷ',
  45065. 'ⲹ' => 'Ⲹ',
  45066. 'ⲻ' => 'Ⲻ',
  45067. 'â²½' => 'â²¼',
  45068. 'ⲿ' => 'Ⲿ',
  45069. '�' => 'Ⳁ',
  45070. 'ⳃ' => 'Ⳃ',
  45071. 'ⳅ' => 'Ⳅ',
  45072. 'ⳇ' => 'Ⳇ',
  45073. 'ⳉ' => 'Ⳉ',
  45074. 'ⳋ' => 'Ⳋ',
  45075. '�' => 'Ⳍ',
  45076. '�' => 'Ⳏ',
  45077. 'ⳑ' => '�',
  45078. 'ⳓ' => 'Ⳓ',
  45079. 'ⳕ' => 'Ⳕ',
  45080. 'â³—' => 'â³–',
  45081. 'ⳙ' => 'Ⳙ',
  45082. 'ⳛ' => 'Ⳛ',
  45083. '�' => 'Ⳝ',
  45084. 'ⳟ' => 'Ⳟ',
  45085. 'ⳡ' => 'Ⳡ',
  45086. 'â³£' => 'â³¢',
  45087. 'ⳬ' => 'Ⳬ',
  45088. 'â³®' => 'â³­',
  45089. 'â³³' => 'â³²',
  45090. 'â´€' => 'á‚ ',
  45091. 'â´�' => 'á‚¡',
  45092. 'â´‚' => 'á‚¢',
  45093. 'â´ƒ' => 'á‚£',
  45094. 'ⴄ' => 'Ⴄ',
  45095. 'â´…' => 'á‚¥',
  45096. 'ⴆ' => 'Ⴆ',
  45097. 'ⴇ' => 'Ⴇ',
  45098. 'ⴈ' => 'Ⴈ',
  45099. 'â´‰' => 'á‚©',
  45100. 'ⴊ' => 'Ⴊ',
  45101. 'â´‹' => 'á‚«',
  45102. 'ⴌ' => 'Ⴌ',
  45103. 'â´�' => 'á‚­',
  45104. 'â´Ž' => 'á‚®',
  45105. '�' => 'Ⴏ',
  45106. 'â´�' => 'á‚°',
  45107. 'ⴑ' => 'Ⴑ',
  45108. 'ⴒ' => 'Ⴒ',
  45109. 'ⴓ' => 'Ⴓ',
  45110. 'â´”' => 'á‚´',
  45111. 'ⴕ' => 'Ⴕ',
  45112. 'ⴖ' => 'Ⴖ',
  45113. 'â´—' => 'á‚·',
  45114. 'ⴘ' => 'Ⴘ',
  45115. 'ⴙ' => 'Ⴙ',
  45116. 'ⴚ' => 'Ⴚ',
  45117. 'â´›' => 'á‚»',
  45118. 'ⴜ' => 'Ⴜ',
  45119. '�' => 'Ⴝ',
  45120. 'ⴞ' => 'Ⴞ',
  45121. 'â´Ÿ' => 'á‚¿',
  45122. 'ⴠ' => 'Ⴠ',
  45123. 'ⴡ' => '�',
  45124. 'ⴢ' => 'Ⴢ',
  45125. 'ⴣ' => 'Ⴣ',
  45126. 'ⴤ' => 'Ⴤ',
  45127. 'ⴥ' => 'Ⴥ',
  45128. 'ⴧ' => 'Ⴧ',
  45129. 'ⴭ' => '�',
  45130. '�' => 'Ꙁ',
  45131. 'ꙃ' => 'Ꙃ',
  45132. 'ꙅ' => 'Ꙅ',
  45133. 'ꙇ' => 'Ꙇ',
  45134. 'ꙉ' => 'Ꙉ',
  45135. 'ꙋ' => 'Ꙋ',
  45136. '�' => 'Ꙍ',
  45137. '�' => 'Ꙏ',
  45138. 'ꙑ' => '�',
  45139. 'ꙓ' => 'Ꙓ',
  45140. 'ꙕ' => 'Ꙕ',
  45141. 'ê™—' => 'ê™–',
  45142. 'ꙙ' => 'Ꙙ',
  45143. 'ꙛ' => 'Ꙛ',
  45144. '�' => 'Ꙝ',
  45145. 'ꙟ' => 'Ꙟ',
  45146. 'ꙡ' => 'Ꙡ',
  45147. 'ꙣ' => 'Ꙣ',
  45148. 'ꙥ' => 'Ꙥ',
  45149. 'ꙧ' => 'Ꙧ',
  45150. 'ꙩ' => 'Ꙩ',
  45151. 'ꙫ' => 'Ꙫ',
  45152. 'ꙭ' => 'Ꙭ',
  45153. '�' => 'Ꚁ',
  45154. 'ꚃ' => 'Ꚃ',
  45155. 'êš…' => 'êš„',
  45156. 'ꚇ' => 'Ꚇ',
  45157. 'ꚉ' => 'Ꚉ',
  45158. 'ꚋ' => 'Ꚋ',
  45159. '�' => 'Ꚍ',
  45160. '�' => 'Ꚏ',
  45161. 'ꚑ' => '�',
  45162. 'êš“' => 'êš’',
  45163. 'êš•' => 'êš”',
  45164. 'êš—' => 'êš–',
  45165. 'ꚙ' => 'Ꚙ',
  45166. 'êš›' => 'êšš',
  45167. 'ꜣ' => 'Ꜣ',
  45168. 'ꜥ' => 'Ꜥ',
  45169. 'ꜧ' => 'Ꜧ',
  45170. 'ꜩ' => 'Ꜩ',
  45171. 'ꜫ' => 'Ꜫ',
  45172. 'ꜭ' => 'Ꜭ',
  45173. 'ꜯ' => 'Ꜯ',
  45174. 'ꜳ' => 'Ꜳ',
  45175. 'ꜵ' => 'Ꜵ',
  45176. 'ꜷ' => 'Ꜷ',
  45177. 'ꜹ' => 'Ꜹ',
  45178. 'ꜻ' => 'Ꜻ',
  45179. 'ꜽ' => 'Ꜽ',
  45180. 'ꜿ' => 'Ꜿ',
  45181. '�' => '�',
  45182. '�' => '�',
  45183. '�' => '�',
  45184. '�' => '�',
  45185. '�' => '�',
  45186. '�' => '�',
  45187. '�' => '�',
  45188. '�' => '�',
  45189. '�' => '�',
  45190. '�' => '�',
  45191. '�' => '�',
  45192. '�' => '�',
  45193. '�' => '�',
  45194. '�' => '�',
  45195. '�' => '�',
  45196. '�' => '�',
  45197. '�' => '�',
  45198. '�' => '�',
  45199. '�' => '�',
  45200. '�' => '�',
  45201. '�' => '�',
  45202. '�' => '�',
  45203. '�' => '�',
  45204. '�' => '�',
  45205. '�' => '�',
  45206. '�' => '�',
  45207. '�' => '�',
  45208. '�' => 'Ꞁ',
  45209. 'ꞃ' => 'Ꞃ',
  45210. 'êž…' => 'êž„',
  45211. 'ꞇ' => 'Ꞇ',
  45212. 'ꞌ' => 'Ꞌ',
  45213. 'ꞑ' => '�',
  45214. 'êž“' => 'êž’',
  45215. 'êž—' => 'êž–',
  45216. 'ꞙ' => 'Ꞙ',
  45217. 'êž›' => 'êžš',
  45218. '�' => 'Ꞝ',
  45219. 'ꞟ' => 'Ꞟ',
  45220. 'êž¡' => 'êž ',
  45221. 'ꞣ' => 'Ꞣ',
  45222. 'ꞥ' => 'Ꞥ',
  45223. 'ꞧ' => 'Ꞧ',
  45224. 'ꞩ' => 'Ꞩ',
  45225. '�' => 'A',
  45226. 'b' => 'B',
  45227. 'c' => 'C',
  45228. 'd' => 'D',
  45229. 'ï½…' => 'ï¼¥',
  45230. 'f' => 'F',
  45231. 'g' => 'G',
  45232. 'h' => 'H',
  45233. 'i' => 'I',
  45234. 'j' => 'J',
  45235. 'k' => 'K',
  45236. 'l' => 'L',
  45237. '�' => 'M',
  45238. 'n' => 'N',
  45239. '�' => 'O',
  45240. '�' => 'P',
  45241. 'q' => 'Q',
  45242. 'ï½’' => 'ï¼²',
  45243. 's' => 'S',
  45244. 'ï½”' => 'ï¼´',
  45245. 'u' => 'U',
  45246. 'v' => 'V',
  45247. 'ï½—' => 'ï¼·',
  45248. 'x' => 'X',
  45249. 'ï½™' => 'ï¼¹',
  45250. 'z' => 'Z',
  45251. '�' => '�',
  45252. '�' => '�',
  45253. '�' => '�',
  45254. '�' => '�',
  45255. '�' => '�',
  45256. '�' => '�',
  45257. '�' => '�',
  45258. '�' => '�',
  45259. '�' => '�',
  45260. '�' => '�',
  45261. '�' => '�',
  45262. '�' => '�',
  45263. '�' => '�',
  45264. '�' => '�',
  45265. '�' => '�',
  45266. '�' => '�',
  45267. '�' => '�',
  45268. '�' => '�',
  45269. '�' => '�',
  45270. '�' => '�',
  45271. '�' => '�',
  45272. '�' => '�',
  45273. '�' => '�',
  45274. '�' => '�',
  45275. '�' => '�',
  45276. '�' => '�',
  45277. '�' => '�',
  45278. '�' => '�',
  45279. '�' => '�',
  45280. '�' => '�',
  45281. '�' => '�',
  45282. '�' => '�',
  45283. '�' => '�',
  45284. '�' => '�',
  45285. '�' => '�',
  45286. '�' => '�',
  45287. '�' => '�',
  45288. '�' => '�',
  45289. '�' => '�',
  45290. '�' => '�',
  45291. 'ð‘£€' => 'ð‘¢ ',
  45292. '�' => '𑢡',
  45293. '𑣂' => '𑢢',
  45294. '𑣃' => '𑢣',
  45295. '𑣄' => '𑢤',
  45296. 'ð‘£…' => 'ð‘¢¥',
  45297. '𑣆' => '𑢦',
  45298. '𑣇' => '𑢧',
  45299. '𑣈' => '𑢨',
  45300. '𑣉' => '𑢩',
  45301. '𑣊' => '𑢪',
  45302. '𑣋' => '𑢫',
  45303. '𑣌' => '𑢬',
  45304. '�' => '𑢭',
  45305. '𑣎' => '𑢮',
  45306. '�' => '𑢯',
  45307. '�' => '𑢰',
  45308. '𑣑' => '𑢱',
  45309. 'ð‘£’' => 'ð‘¢²',
  45310. '𑣓' => '𑢳',
  45311. 'ð‘£”' => 'ð‘¢´',
  45312. '𑣕' => '𑢵',
  45313. '𑣖' => '𑢶',
  45314. 'ð‘£—' => 'ð‘¢·',
  45315. '𑣘' => '𑢸',
  45316. 'ð‘£™' => 'ð‘¢¹',
  45317. '𑣚' => '𑢺',
  45318. 'ð‘£›' => 'ð‘¢»',
  45319. '𑣜' => '𑢼',
  45320. '�' => '𑢽',
  45321. '𑣞' => '𑢾',
  45322. '𑣟' => '𑢿',
  45323. );
  45324. <?php
  45325. use Symfony\Polyfill\Mbstring as p;
  45326. if (!function_exists('mb_strlen')) {
  45327. define('MB_CASE_UPPER', 0);
  45328. define('MB_CASE_LOWER', 1);
  45329. define('MB_CASE_TITLE', 2);
  45330. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  45331. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  45332. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  45333. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  45334. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  45335. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  45336. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  45337. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  45338. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  45339. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  45340. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  45341. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  45342. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  45343. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  45344. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  45345. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  45346. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  45347. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  45348. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  45349. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  45350. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  45351. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  45352. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  45353. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  45354. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  45355. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  45356. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  45357. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  45358. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  45359. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  45360. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  45361. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  45362. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  45363. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  45364. }
  45365. if (!function_exists('mb_chr')) {
  45366. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  45367. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  45368. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  45369. }
  45370. <?php
  45371. namespace Symfony\Component\Process\Exception;
  45372. interface ExceptionInterface
  45373. {
  45374. }
  45375. <?php
  45376. namespace Symfony\Component\Process\Exception;
  45377. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45378. {
  45379. }
  45380. <?php
  45381. namespace Symfony\Component\Process\Exception;
  45382. class LogicException extends \LogicException implements ExceptionInterface
  45383. {
  45384. }
  45385. <?php
  45386. namespace Symfony\Component\Process\Exception;
  45387. use Symfony\Component\Process\Process;
  45388. class ProcessFailedException extends RuntimeException
  45389. {
  45390. private $process;
  45391. public function __construct(Process $process)
  45392. {
  45393. if ($process->isSuccessful()) {
  45394. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  45395. }
  45396. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  45397. $process->getCommandLine(),
  45398. $process->getExitCode(),
  45399. $process->getExitCodeText(),
  45400. $process->getWorkingDirectory()
  45401. );
  45402. if (!$process->isOutputDisabled()) {
  45403. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  45404. $process->getOutput(),
  45405. $process->getErrorOutput()
  45406. );
  45407. }
  45408. parent::__construct($error);
  45409. $this->process = $process;
  45410. }
  45411. public function getProcess()
  45412. {
  45413. return $this->process;
  45414. }
  45415. }
  45416. <?php
  45417. namespace Symfony\Component\Process\Exception;
  45418. use Symfony\Component\Process\Process;
  45419. class ProcessTimedOutException extends RuntimeException
  45420. {
  45421. const TYPE_GENERAL = 1;
  45422. const TYPE_IDLE = 2;
  45423. private $process;
  45424. private $timeoutType;
  45425. public function __construct(Process $process, $timeoutType)
  45426. {
  45427. $this->process = $process;
  45428. $this->timeoutType = $timeoutType;
  45429. parent::__construct(sprintf(
  45430. 'The process "%s" exceeded the timeout of %s seconds.',
  45431. $process->getCommandLine(),
  45432. $this->getExceededTimeout()
  45433. ));
  45434. }
  45435. public function getProcess()
  45436. {
  45437. return $this->process;
  45438. }
  45439. public function isGeneralTimeout()
  45440. {
  45441. return self::TYPE_GENERAL === $this->timeoutType;
  45442. }
  45443. public function isIdleTimeout()
  45444. {
  45445. return self::TYPE_IDLE === $this->timeoutType;
  45446. }
  45447. public function getExceededTimeout()
  45448. {
  45449. switch ($this->timeoutType) {
  45450. case self::TYPE_GENERAL:
  45451. return $this->process->getTimeout();
  45452. case self::TYPE_IDLE:
  45453. return $this->process->getIdleTimeout();
  45454. default:
  45455. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  45456. }
  45457. }
  45458. }
  45459. <?php
  45460. namespace Symfony\Component\Process\Exception;
  45461. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45462. {
  45463. }
  45464. <?php
  45465. namespace Symfony\Component\Process;
  45466. class ExecutableFinder
  45467. {
  45468. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  45469. public function setSuffixes(array $suffixes)
  45470. {
  45471. $this->suffixes = $suffixes;
  45472. }
  45473. public function addSuffix($suffix)
  45474. {
  45475. $this->suffixes[] = $suffix;
  45476. }
  45477. public function find($name, $default = null, array $extraDirs = array())
  45478. {
  45479. if (ini_get('open_basedir')) {
  45480. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  45481. $dirs = array();
  45482. foreach ($searchPath as $path) {
  45483. if (@is_dir($path)) {
  45484. $dirs[] = $path;
  45485. } else {
  45486. if (basename($path) == $name && @is_executable($path)) {
  45487. return $path;
  45488. }
  45489. }
  45490. }
  45491. } else {
  45492. $dirs = array_merge(
  45493. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  45494. $extraDirs
  45495. );
  45496. }
  45497. $suffixes = array('');
  45498. if ('\\' === \DIRECTORY_SEPARATOR) {
  45499. $pathExt = getenv('PATHEXT');
  45500. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  45501. }
  45502. foreach ($suffixes as $suffix) {
  45503. foreach ($dirs as $dir) {
  45504. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  45505. return $file;
  45506. }
  45507. }
  45508. }
  45509. return $default;
  45510. }
  45511. }
  45512. Copyright (c) 2004-2018 Fabien Potencier
  45513. Permission is hereby granted, free of charge, to any person obtaining a copy
  45514. of this software and associated documentation files (the "Software"), to deal
  45515. in the Software without restriction, including without limitation the rights
  45516. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45517. copies of the Software, and to permit persons to whom the Software is furnished
  45518. to do so, subject to the following conditions:
  45519. The above copyright notice and this permission notice shall be included in all
  45520. copies or substantial portions of the Software.
  45521. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45522. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45523. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45524. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45525. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45526. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45527. THE SOFTWARE.
  45528. <?php
  45529. namespace Symfony\Component\Process;
  45530. class PhpExecutableFinder
  45531. {
  45532. private $executableFinder;
  45533. public function __construct()
  45534. {
  45535. $this->executableFinder = new ExecutableFinder();
  45536. }
  45537. public function find($includeArgs = true)
  45538. {
  45539. $args = $this->findArguments();
  45540. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  45541. if (\defined('HHVM_VERSION')) {
  45542. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  45543. }
  45544. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  45545. return PHP_BINARY.$args;
  45546. }
  45547. if ($php = getenv('PHP_PATH')) {
  45548. if (!@is_executable($php)) {
  45549. return false;
  45550. }
  45551. return $php;
  45552. }
  45553. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  45554. if (@is_executable($php)) {
  45555. return $php;
  45556. }
  45557. }
  45558. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  45559. return $php;
  45560. }
  45561. $dirs = array(PHP_BINDIR);
  45562. if ('\\' === \DIRECTORY_SEPARATOR) {
  45563. $dirs[] = 'C:\xampp\php\\';
  45564. }
  45565. return $this->executableFinder->find('php', false, $dirs);
  45566. }
  45567. public function findArguments()
  45568. {
  45569. $arguments = array();
  45570. if (\defined('HHVM_VERSION')) {
  45571. $arguments[] = '--php';
  45572. } elseif ('phpdbg' === \PHP_SAPI) {
  45573. $arguments[] = '-qrr';
  45574. }
  45575. return $arguments;
  45576. }
  45577. }
  45578. <?php
  45579. namespace Symfony\Component\Process;
  45580. use Symfony\Component\Process\Exception\RuntimeException;
  45581. class PhpProcess extends Process
  45582. {
  45583. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  45584. {
  45585. $executableFinder = new PhpExecutableFinder();
  45586. if (false === $php = $executableFinder->find()) {
  45587. $php = null;
  45588. }
  45589. if ('phpdbg' === \PHP_SAPI) {
  45590. $file = tempnam(sys_get_temp_dir(), 'dbg');
  45591. file_put_contents($file, $script);
  45592. register_shutdown_function('unlink', $file);
  45593. $php .= ' '.ProcessUtils::escapeArgument($file);
  45594. $script = null;
  45595. }
  45596. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  45597. $php = 'exec '.$php;
  45598. }
  45599. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  45600. }
  45601. public function setPhpBinary($php)
  45602. {
  45603. $this->setCommandLine($php);
  45604. }
  45605. public function start($callback = null)
  45606. {
  45607. if (null === $this->getCommandLine()) {
  45608. throw new RuntimeException('Unable to find the PHP executable.');
  45609. }
  45610. parent::start($callback);
  45611. }
  45612. }
  45613. <?php
  45614. namespace Symfony\Component\Process\Pipes;
  45615. abstract class AbstractPipes implements PipesInterface
  45616. {
  45617. public $pipes = array();
  45618. private $inputBuffer = '';
  45619. private $input;
  45620. private $blocked = true;
  45621. private $lastError;
  45622. public function __construct($input)
  45623. {
  45624. if (\is_resource($input)) {
  45625. $this->input = $input;
  45626. } elseif (\is_string($input)) {
  45627. $this->inputBuffer = $input;
  45628. } else {
  45629. $this->inputBuffer = (string) $input;
  45630. }
  45631. }
  45632. public function close()
  45633. {
  45634. foreach ($this->pipes as $pipe) {
  45635. fclose($pipe);
  45636. }
  45637. $this->pipes = array();
  45638. }
  45639. protected function hasSystemCallBeenInterrupted()
  45640. {
  45641. $lastError = $this->lastError;
  45642. $this->lastError = null;
  45643. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  45644. }
  45645. protected function unblock()
  45646. {
  45647. if (!$this->blocked) {
  45648. return;
  45649. }
  45650. foreach ($this->pipes as $pipe) {
  45651. stream_set_blocking($pipe, 0);
  45652. }
  45653. if (null !== $this->input) {
  45654. stream_set_blocking($this->input, 0);
  45655. }
  45656. $this->blocked = false;
  45657. }
  45658. protected function write()
  45659. {
  45660. if (!isset($this->pipes[0])) {
  45661. return;
  45662. }
  45663. $input = $this->input;
  45664. $r = $e = array();
  45665. $w = array($this->pipes[0]);
  45666. if (false === @stream_select($r, $w, $e, 0, 0)) {
  45667. return;
  45668. }
  45669. foreach ($w as $stdin) {
  45670. if (isset($this->inputBuffer[0])) {
  45671. $written = fwrite($stdin, $this->inputBuffer);
  45672. $this->inputBuffer = substr($this->inputBuffer, $written);
  45673. if (isset($this->inputBuffer[0])) {
  45674. return array($this->pipes[0]);
  45675. }
  45676. }
  45677. if ($input) {
  45678. for (;;) {
  45679. $data = fread($input, self::CHUNK_SIZE);
  45680. if (!isset($data[0])) {
  45681. break;
  45682. }
  45683. $written = fwrite($stdin, $data);
  45684. $data = substr($data, $written);
  45685. if (isset($data[0])) {
  45686. $this->inputBuffer = $data;
  45687. return array($this->pipes[0]);
  45688. }
  45689. }
  45690. if (feof($input)) {
  45691. $this->input = null;
  45692. }
  45693. }
  45694. }
  45695. if (null === $this->input && !isset($this->inputBuffer[0])) {
  45696. fclose($this->pipes[0]);
  45697. unset($this->pipes[0]);
  45698. } elseif (!$w) {
  45699. return array($this->pipes[0]);
  45700. }
  45701. }
  45702. public function handleError($type, $msg)
  45703. {
  45704. $this->lastError = $msg;
  45705. }
  45706. }
  45707. <?php
  45708. namespace Symfony\Component\Process\Pipes;
  45709. interface PipesInterface
  45710. {
  45711. const CHUNK_SIZE = 16384;
  45712. public function getDescriptors();
  45713. public function getFiles();
  45714. public function readAndWrite($blocking, $close = false);
  45715. public function areOpen();
  45716. public function close();
  45717. }
  45718. <?php
  45719. namespace Symfony\Component\Process\Pipes;
  45720. use Symfony\Component\Process\Process;
  45721. class UnixPipes extends AbstractPipes
  45722. {
  45723. private $ttyMode;
  45724. private $ptyMode;
  45725. private $disableOutput;
  45726. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  45727. {
  45728. $this->ttyMode = (bool) $ttyMode;
  45729. $this->ptyMode = (bool) $ptyMode;
  45730. $this->disableOutput = (bool) $disableOutput;
  45731. parent::__construct($input);
  45732. }
  45733. public function __destruct()
  45734. {
  45735. $this->close();
  45736. }
  45737. public function getDescriptors()
  45738. {
  45739. if ($this->disableOutput) {
  45740. $nullstream = fopen('/dev/null', 'c');
  45741. return array(
  45742. array('pipe', 'r'),
  45743. $nullstream,
  45744. $nullstream,
  45745. );
  45746. }
  45747. if ($this->ttyMode) {
  45748. return array(
  45749. array('file', '/dev/tty', 'r'),
  45750. array('file', '/dev/tty', 'w'),
  45751. array('file', '/dev/tty', 'w'),
  45752. );
  45753. }
  45754. if ($this->ptyMode && Process::isPtySupported()) {
  45755. return array(
  45756. array('pty'),
  45757. array('pty'),
  45758. array('pty'),
  45759. );
  45760. }
  45761. return array(
  45762. array('pipe', 'r'),
  45763. array('pipe', 'w'),
  45764. array('pipe', 'w'),
  45765. );
  45766. }
  45767. public function getFiles()
  45768. {
  45769. return array();
  45770. }
  45771. public function readAndWrite($blocking, $close = false)
  45772. {
  45773. $this->unblock();
  45774. $w = $this->write();
  45775. $read = $e = array();
  45776. $r = $this->pipes;
  45777. unset($r[0]);
  45778. set_error_handler(array($this, 'handleError'));
  45779. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  45780. restore_error_handler();
  45781. if (!$this->hasSystemCallBeenInterrupted()) {
  45782. $this->pipes = array();
  45783. }
  45784. return $read;
  45785. }
  45786. restore_error_handler();
  45787. foreach ($r as $pipe) {
  45788. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  45789. do {
  45790. $data = fread($pipe, self::CHUNK_SIZE);
  45791. $read[$type] .= $data;
  45792. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  45793. if (!isset($read[$type][0])) {
  45794. unset($read[$type]);
  45795. }
  45796. if ($close && feof($pipe)) {
  45797. fclose($pipe);
  45798. unset($this->pipes[$type]);
  45799. }
  45800. }
  45801. return $read;
  45802. }
  45803. public function areOpen()
  45804. {
  45805. return (bool) $this->pipes;
  45806. }
  45807. public static function create(Process $process, $input)
  45808. {
  45809. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  45810. }
  45811. }
  45812. <?php
  45813. namespace Symfony\Component\Process\Pipes;
  45814. use Symfony\Component\Process\Exception\RuntimeException;
  45815. use Symfony\Component\Process\Process;
  45816. class WindowsPipes extends AbstractPipes
  45817. {
  45818. private $files = array();
  45819. private $fileHandles = array();
  45820. private $lockHandles = array();
  45821. private $readBytes = array(
  45822. Process::STDOUT => 0,
  45823. Process::STDERR => 0,
  45824. );
  45825. private $disableOutput;
  45826. public function __construct($disableOutput, $input)
  45827. {
  45828. $this->disableOutput = (bool) $disableOutput;
  45829. if (!$this->disableOutput) {
  45830. $pipes = array(
  45831. Process::STDOUT => Process::OUT,
  45832. Process::STDERR => Process::ERR,
  45833. );
  45834. $tmpDir = sys_get_temp_dir();
  45835. $lastError = 'unknown reason';
  45836. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  45837. for ($i = 0;; ++$i) {
  45838. foreach ($pipes as $pipe => $name) {
  45839. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  45840. if (!$h = fopen($file.'.lock', 'w')) {
  45841. restore_error_handler();
  45842. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  45843. }
  45844. if (!flock($h, LOCK_EX | LOCK_NB)) {
  45845. continue 2;
  45846. }
  45847. if (isset($this->lockHandles[$pipe])) {
  45848. flock($this->lockHandles[$pipe], LOCK_UN);
  45849. fclose($this->lockHandles[$pipe]);
  45850. }
  45851. $this->lockHandles[$pipe] = $h;
  45852. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  45853. flock($this->lockHandles[$pipe], LOCK_UN);
  45854. fclose($this->lockHandles[$pipe]);
  45855. unset($this->lockHandles[$pipe]);
  45856. continue 2;
  45857. }
  45858. $this->fileHandles[$pipe] = $h;
  45859. $this->files[$pipe] = $file;
  45860. }
  45861. break;
  45862. }
  45863. restore_error_handler();
  45864. }
  45865. parent::__construct($input);
  45866. }
  45867. public function __destruct()
  45868. {
  45869. $this->close();
  45870. }
  45871. public function getDescriptors()
  45872. {
  45873. if ($this->disableOutput) {
  45874. $nullstream = fopen('NUL', 'c');
  45875. return array(
  45876. array('pipe', 'r'),
  45877. $nullstream,
  45878. $nullstream,
  45879. );
  45880. }
  45881. return array(
  45882. array('pipe', 'r'),
  45883. array('file', 'NUL', 'w'),
  45884. array('file', 'NUL', 'w'),
  45885. );
  45886. }
  45887. public function getFiles()
  45888. {
  45889. return $this->files;
  45890. }
  45891. public function readAndWrite($blocking, $close = false)
  45892. {
  45893. $this->unblock();
  45894. $w = $this->write();
  45895. $read = $r = $e = array();
  45896. if ($blocking) {
  45897. if ($w) {
  45898. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  45899. } elseif ($this->fileHandles) {
  45900. usleep(Process::TIMEOUT_PRECISION * 1E6);
  45901. }
  45902. }
  45903. foreach ($this->fileHandles as $type => $fileHandle) {
  45904. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  45905. if (isset($data[0])) {
  45906. $this->readBytes[$type] += \strlen($data);
  45907. $read[$type] = $data;
  45908. }
  45909. if ($close) {
  45910. ftruncate($fileHandle, 0);
  45911. fclose($fileHandle);
  45912. flock($this->lockHandles[$type], LOCK_UN);
  45913. fclose($this->lockHandles[$type]);
  45914. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  45915. }
  45916. }
  45917. return $read;
  45918. }
  45919. public function areOpen()
  45920. {
  45921. return $this->pipes && $this->fileHandles;
  45922. }
  45923. public function close()
  45924. {
  45925. parent::close();
  45926. foreach ($this->fileHandles as $type => $handle) {
  45927. ftruncate($handle, 0);
  45928. fclose($handle);
  45929. flock($this->lockHandles[$type], LOCK_UN);
  45930. fclose($this->lockHandles[$type]);
  45931. }
  45932. $this->fileHandles = $this->lockHandles = array();
  45933. }
  45934. public static function create(Process $process, $input)
  45935. {
  45936. return new static($process->isOutputDisabled(), $input);
  45937. }
  45938. }
  45939. <?php
  45940. namespace Symfony\Component\Process;
  45941. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45942. use Symfony\Component\Process\Exception\LogicException;
  45943. use Symfony\Component\Process\Exception\ProcessFailedException;
  45944. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  45945. use Symfony\Component\Process\Exception\RuntimeException;
  45946. use Symfony\Component\Process\Pipes\PipesInterface;
  45947. use Symfony\Component\Process\Pipes\UnixPipes;
  45948. use Symfony\Component\Process\Pipes\WindowsPipes;
  45949. class Process
  45950. {
  45951. const ERR = 'err';
  45952. const OUT = 'out';
  45953. const STATUS_READY = 'ready';
  45954. const STATUS_STARTED = 'started';
  45955. const STATUS_TERMINATED = 'terminated';
  45956. const STDIN = 0;
  45957. const STDOUT = 1;
  45958. const STDERR = 2;
  45959. const TIMEOUT_PRECISION = 0.2;
  45960. private $callback;
  45961. private $commandline;
  45962. private $cwd;
  45963. private $env;
  45964. private $input;
  45965. private $starttime;
  45966. private $lastOutputTime;
  45967. private $timeout;
  45968. private $idleTimeout;
  45969. private $options;
  45970. private $exitcode;
  45971. private $fallbackStatus = array();
  45972. private $processInformation;
  45973. private $outputDisabled = false;
  45974. private $stdout;
  45975. private $stderr;
  45976. private $enhanceWindowsCompatibility = true;
  45977. private $enhanceSigchildCompatibility;
  45978. private $process;
  45979. private $status = self::STATUS_READY;
  45980. private $incrementalOutputOffset = 0;
  45981. private $incrementalErrorOutputOffset = 0;
  45982. private $tty;
  45983. private $pty;
  45984. private $useFileHandles = false;
  45985. private $processPipes;
  45986. private $latestSignal;
  45987. private static $sigchild;
  45988. public static $exitCodes = array(
  45989. 0 => 'OK',
  45990. 1 => 'General error',
  45991. 2 => 'Misuse of shell builtins',
  45992. 126 => 'Invoked command cannot execute',
  45993. 127 => 'Command not found',
  45994. 128 => 'Invalid exit argument',
  45995. 129 => 'Hangup',
  45996. 130 => 'Interrupt',
  45997. 131 => 'Quit and dump core',
  45998. 132 => 'Illegal instruction',
  45999. 133 => 'Trace/breakpoint trap',
  46000. 134 => 'Process aborted',
  46001. 135 => 'Bus error: "access to undefined portion of memory object"',
  46002. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  46003. 137 => 'Kill (terminate immediately)',
  46004. 138 => 'User-defined 1',
  46005. 139 => 'Segmentation violation',
  46006. 140 => 'User-defined 2',
  46007. 141 => 'Write to pipe with no one reading',
  46008. 142 => 'Signal raised by alarm',
  46009. 143 => 'Termination (request to terminate)',
  46010. 145 => 'Child process terminated, stopped (or continued*)',
  46011. 146 => 'Continue if stopped',
  46012. 147 => 'Stop executing temporarily',
  46013. 148 => 'Terminal stop signal',
  46014. 149 => 'Background process attempting to read from tty ("in")',
  46015. 150 => 'Background process attempting to write to tty ("out")',
  46016. 151 => 'Urgent data available on socket',
  46017. 152 => 'CPU time limit exceeded',
  46018. 153 => 'File size limit exceeded',
  46019. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  46020. 155 => 'Profiling timer expired',
  46021. 157 => 'Pollable event',
  46022. 159 => 'Bad syscall',
  46023. );
  46024. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  46025. {
  46026. if (!\function_exists('proc_open')) {
  46027. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  46028. }
  46029. $this->commandline = $commandline;
  46030. $this->cwd = $cwd;
  46031. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  46032. $this->cwd = getcwd();
  46033. }
  46034. if (null !== $env) {
  46035. $this->setEnv($env);
  46036. }
  46037. $this->setInput($input);
  46038. $this->setTimeout($timeout);
  46039. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  46040. $this->pty = false;
  46041. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  46042. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  46043. }
  46044. public function __destruct()
  46045. {
  46046. $this->stop(0);
  46047. }
  46048. public function __clone()
  46049. {
  46050. $this->resetProcessData();
  46051. }
  46052. public function run($callback = null)
  46053. {
  46054. $this->start($callback);
  46055. return $this->wait();
  46056. }
  46057. public function mustRun($callback = null)
  46058. {
  46059. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46060. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46061. }
  46062. if (0 !== $this->run($callback)) {
  46063. throw new ProcessFailedException($this);
  46064. }
  46065. return $this;
  46066. }
  46067. public function start($callback = null)
  46068. {
  46069. if ($this->isRunning()) {
  46070. throw new RuntimeException('Process is already running');
  46071. }
  46072. if ($this->outputDisabled && null !== $callback) {
  46073. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  46074. }
  46075. $this->resetProcessData();
  46076. $this->starttime = $this->lastOutputTime = microtime(true);
  46077. $this->callback = $this->buildCallback($callback);
  46078. $descriptors = $this->getDescriptors();
  46079. $commandline = $this->commandline;
  46080. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  46081. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  46082. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  46083. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  46084. }
  46085. $commandline .= '"';
  46086. if (!isset($this->options['bypass_shell'])) {
  46087. $this->options['bypass_shell'] = true;
  46088. }
  46089. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46090. $descriptors[3] = array('pipe', 'w');
  46091. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  46092. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  46093. $ptsWorkaround = fopen(__FILE__, 'r');
  46094. }
  46095. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  46096. if (!\is_resource($this->process)) {
  46097. throw new RuntimeException('Unable to launch a new process.');
  46098. }
  46099. $this->status = self::STATUS_STARTED;
  46100. if (isset($descriptors[3])) {
  46101. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  46102. }
  46103. if ($this->tty) {
  46104. return;
  46105. }
  46106. $this->updateStatus(false);
  46107. $this->checkTimeout();
  46108. }
  46109. public function restart($callback = null)
  46110. {
  46111. if ($this->isRunning()) {
  46112. throw new RuntimeException('Process is already running');
  46113. }
  46114. $process = clone $this;
  46115. $process->start($callback);
  46116. return $process;
  46117. }
  46118. public function wait($callback = null)
  46119. {
  46120. $this->requireProcessIsStarted(__FUNCTION__);
  46121. $this->updateStatus(false);
  46122. if (null !== $callback) {
  46123. $this->callback = $this->buildCallback($callback);
  46124. }
  46125. do {
  46126. $this->checkTimeout();
  46127. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  46128. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46129. } while ($running);
  46130. while ($this->isRunning()) {
  46131. usleep(1000);
  46132. }
  46133. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  46134. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  46135. }
  46136. return $this->exitcode;
  46137. }
  46138. public function getPid()
  46139. {
  46140. return $this->isRunning() ? $this->processInformation['pid'] : null;
  46141. }
  46142. public function signal($signal)
  46143. {
  46144. $this->doSignal($signal, true);
  46145. return $this;
  46146. }
  46147. public function disableOutput()
  46148. {
  46149. if ($this->isRunning()) {
  46150. throw new RuntimeException('Disabling output while the process is running is not possible.');
  46151. }
  46152. if (null !== $this->idleTimeout) {
  46153. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  46154. }
  46155. $this->outputDisabled = true;
  46156. return $this;
  46157. }
  46158. public function enableOutput()
  46159. {
  46160. if ($this->isRunning()) {
  46161. throw new RuntimeException('Enabling output while the process is running is not possible.');
  46162. }
  46163. $this->outputDisabled = false;
  46164. return $this;
  46165. }
  46166. public function isOutputDisabled()
  46167. {
  46168. return $this->outputDisabled;
  46169. }
  46170. public function getOutput()
  46171. {
  46172. $this->readPipesForOutput(__FUNCTION__);
  46173. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  46174. return '';
  46175. }
  46176. return $ret;
  46177. }
  46178. public function getIncrementalOutput()
  46179. {
  46180. $this->readPipesForOutput(__FUNCTION__);
  46181. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  46182. $this->incrementalOutputOffset = ftell($this->stdout);
  46183. if (false === $latest) {
  46184. return '';
  46185. }
  46186. return $latest;
  46187. }
  46188. public function clearOutput()
  46189. {
  46190. ftruncate($this->stdout, 0);
  46191. fseek($this->stdout, 0);
  46192. $this->incrementalOutputOffset = 0;
  46193. return $this;
  46194. }
  46195. public function getErrorOutput()
  46196. {
  46197. $this->readPipesForOutput(__FUNCTION__);
  46198. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  46199. return '';
  46200. }
  46201. return $ret;
  46202. }
  46203. public function getIncrementalErrorOutput()
  46204. {
  46205. $this->readPipesForOutput(__FUNCTION__);
  46206. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  46207. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  46208. if (false === $latest) {
  46209. return '';
  46210. }
  46211. return $latest;
  46212. }
  46213. public function clearErrorOutput()
  46214. {
  46215. ftruncate($this->stderr, 0);
  46216. fseek($this->stderr, 0);
  46217. $this->incrementalErrorOutputOffset = 0;
  46218. return $this;
  46219. }
  46220. public function getExitCode()
  46221. {
  46222. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46223. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46224. }
  46225. $this->updateStatus(false);
  46226. return $this->exitcode;
  46227. }
  46228. public function getExitCodeText()
  46229. {
  46230. if (null === $exitcode = $this->getExitCode()) {
  46231. return;
  46232. }
  46233. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  46234. }
  46235. public function isSuccessful()
  46236. {
  46237. return 0 === $this->getExitCode();
  46238. }
  46239. public function hasBeenSignaled()
  46240. {
  46241. $this->requireProcessIsTerminated(__FUNCTION__);
  46242. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46243. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46244. }
  46245. return $this->processInformation['signaled'];
  46246. }
  46247. public function getTermSignal()
  46248. {
  46249. $this->requireProcessIsTerminated(__FUNCTION__);
  46250. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  46251. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46252. }
  46253. return $this->processInformation['termsig'];
  46254. }
  46255. public function hasBeenStopped()
  46256. {
  46257. $this->requireProcessIsTerminated(__FUNCTION__);
  46258. return $this->processInformation['stopped'];
  46259. }
  46260. public function getStopSignal()
  46261. {
  46262. $this->requireProcessIsTerminated(__FUNCTION__);
  46263. return $this->processInformation['stopsig'];
  46264. }
  46265. public function isRunning()
  46266. {
  46267. if (self::STATUS_STARTED !== $this->status) {
  46268. return false;
  46269. }
  46270. $this->updateStatus(false);
  46271. return $this->processInformation['running'];
  46272. }
  46273. public function isStarted()
  46274. {
  46275. return self::STATUS_READY != $this->status;
  46276. }
  46277. public function isTerminated()
  46278. {
  46279. $this->updateStatus(false);
  46280. return self::STATUS_TERMINATED == $this->status;
  46281. }
  46282. public function getStatus()
  46283. {
  46284. $this->updateStatus(false);
  46285. return $this->status;
  46286. }
  46287. public function stop($timeout = 10, $signal = null)
  46288. {
  46289. $timeoutMicro = microtime(true) + $timeout;
  46290. if ($this->isRunning()) {
  46291. $this->doSignal(15, false);
  46292. do {
  46293. usleep(1000);
  46294. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  46295. if ($this->isRunning()) {
  46296. $this->doSignal($signal ?: 9, false);
  46297. }
  46298. }
  46299. if ($this->isRunning()) {
  46300. if (isset($this->fallbackStatus['pid'])) {
  46301. unset($this->fallbackStatus['pid']);
  46302. return $this->stop(0, $signal);
  46303. }
  46304. $this->close();
  46305. }
  46306. return $this->exitcode;
  46307. }
  46308. public function addOutput($line)
  46309. {
  46310. $this->lastOutputTime = microtime(true);
  46311. fseek($this->stdout, 0, SEEK_END);
  46312. fwrite($this->stdout, $line);
  46313. fseek($this->stdout, $this->incrementalOutputOffset);
  46314. }
  46315. public function addErrorOutput($line)
  46316. {
  46317. $this->lastOutputTime = microtime(true);
  46318. fseek($this->stderr, 0, SEEK_END);
  46319. fwrite($this->stderr, $line);
  46320. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  46321. }
  46322. public function getCommandLine()
  46323. {
  46324. return $this->commandline;
  46325. }
  46326. public function setCommandLine($commandline)
  46327. {
  46328. $this->commandline = $commandline;
  46329. return $this;
  46330. }
  46331. public function getTimeout()
  46332. {
  46333. return $this->timeout;
  46334. }
  46335. public function getIdleTimeout()
  46336. {
  46337. return $this->idleTimeout;
  46338. }
  46339. public function setTimeout($timeout)
  46340. {
  46341. $this->timeout = $this->validateTimeout($timeout);
  46342. return $this;
  46343. }
  46344. public function setIdleTimeout($timeout)
  46345. {
  46346. if (null !== $timeout && $this->outputDisabled) {
  46347. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  46348. }
  46349. $this->idleTimeout = $this->validateTimeout($timeout);
  46350. return $this;
  46351. }
  46352. public function setTty($tty)
  46353. {
  46354. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  46355. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  46356. }
  46357. if ($tty) {
  46358. static $isTtySupported;
  46359. if (null === $isTtySupported) {
  46360. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  46361. }
  46362. if (!$isTtySupported) {
  46363. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  46364. }
  46365. }
  46366. $this->tty = (bool) $tty;
  46367. return $this;
  46368. }
  46369. public function isTty()
  46370. {
  46371. return $this->tty;
  46372. }
  46373. public function setPty($bool)
  46374. {
  46375. $this->pty = (bool) $bool;
  46376. return $this;
  46377. }
  46378. public function isPty()
  46379. {
  46380. return $this->pty;
  46381. }
  46382. public function getWorkingDirectory()
  46383. {
  46384. if (null === $this->cwd) {
  46385. return getcwd() ?: null;
  46386. }
  46387. return $this->cwd;
  46388. }
  46389. public function setWorkingDirectory($cwd)
  46390. {
  46391. $this->cwd = $cwd;
  46392. return $this;
  46393. }
  46394. public function getEnv()
  46395. {
  46396. return $this->env;
  46397. }
  46398. public function setEnv(array $env)
  46399. {
  46400. $env = array_filter($env, function ($value) {
  46401. return !\is_array($value);
  46402. });
  46403. $this->env = array();
  46404. foreach ($env as $key => $value) {
  46405. $this->env[$key] = (string) $value;
  46406. }
  46407. return $this;
  46408. }
  46409. public function getStdin()
  46410. {
  46411. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  46412. return $this->getInput();
  46413. }
  46414. public function getInput()
  46415. {
  46416. return $this->input;
  46417. }
  46418. public function setStdin($stdin)
  46419. {
  46420. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  46421. return $this->setInput($stdin);
  46422. }
  46423. public function setInput($input)
  46424. {
  46425. if ($this->isRunning()) {
  46426. throw new LogicException('Input can not be set while the process is running.');
  46427. }
  46428. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46429. return $this;
  46430. }
  46431. public function getOptions()
  46432. {
  46433. return $this->options;
  46434. }
  46435. public function setOptions(array $options)
  46436. {
  46437. $this->options = $options;
  46438. return $this;
  46439. }
  46440. public function getEnhanceWindowsCompatibility()
  46441. {
  46442. return $this->enhanceWindowsCompatibility;
  46443. }
  46444. public function setEnhanceWindowsCompatibility($enhance)
  46445. {
  46446. $this->enhanceWindowsCompatibility = (bool) $enhance;
  46447. return $this;
  46448. }
  46449. public function getEnhanceSigchildCompatibility()
  46450. {
  46451. return $this->enhanceSigchildCompatibility;
  46452. }
  46453. public function setEnhanceSigchildCompatibility($enhance)
  46454. {
  46455. $this->enhanceSigchildCompatibility = (bool) $enhance;
  46456. return $this;
  46457. }
  46458. public function checkTimeout()
  46459. {
  46460. if (self::STATUS_STARTED !== $this->status) {
  46461. return;
  46462. }
  46463. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  46464. $this->stop(0);
  46465. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  46466. }
  46467. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  46468. $this->stop(0);
  46469. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  46470. }
  46471. }
  46472. public static function isPtySupported()
  46473. {
  46474. static $result;
  46475. if (null !== $result) {
  46476. return $result;
  46477. }
  46478. if ('\\' === \DIRECTORY_SEPARATOR) {
  46479. return $result = false;
  46480. }
  46481. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  46482. }
  46483. private function getDescriptors()
  46484. {
  46485. if ('\\' === \DIRECTORY_SEPARATOR) {
  46486. $this->processPipes = WindowsPipes::create($this, $this->input);
  46487. } else {
  46488. $this->processPipes = UnixPipes::create($this, $this->input);
  46489. }
  46490. return $this->processPipes->getDescriptors();
  46491. }
  46492. protected function buildCallback($callback)
  46493. {
  46494. $that = $this;
  46495. $out = self::OUT;
  46496. $callback = function ($type, $data) use ($that, $callback, $out) {
  46497. if ($out == $type) {
  46498. $that->addOutput($data);
  46499. } else {
  46500. $that->addErrorOutput($data);
  46501. }
  46502. if (null !== $callback) {
  46503. \call_user_func($callback, $type, $data);
  46504. }
  46505. };
  46506. return $callback;
  46507. }
  46508. protected function updateStatus($blocking)
  46509. {
  46510. if (self::STATUS_STARTED !== $this->status) {
  46511. return;
  46512. }
  46513. $this->processInformation = proc_get_status($this->process);
  46514. $running = $this->processInformation['running'];
  46515. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46516. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46517. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  46518. }
  46519. if (!$running) {
  46520. $this->close();
  46521. }
  46522. }
  46523. protected function isSigchildEnabled()
  46524. {
  46525. if (null !== self::$sigchild) {
  46526. return self::$sigchild;
  46527. }
  46528. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  46529. return self::$sigchild = false;
  46530. }
  46531. ob_start();
  46532. phpinfo(INFO_GENERAL);
  46533. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  46534. }
  46535. private function readPipesForOutput($caller)
  46536. {
  46537. if ($this->outputDisabled) {
  46538. throw new LogicException('Output has been disabled.');
  46539. }
  46540. $this->requireProcessIsStarted($caller);
  46541. $this->updateStatus(false);
  46542. }
  46543. private function validateTimeout($timeout)
  46544. {
  46545. $timeout = (float) $timeout;
  46546. if (0.0 === $timeout) {
  46547. $timeout = null;
  46548. } elseif ($timeout < 0) {
  46549. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46550. }
  46551. return $timeout;
  46552. }
  46553. private function readPipes($blocking, $close)
  46554. {
  46555. $result = $this->processPipes->readAndWrite($blocking, $close);
  46556. $callback = $this->callback;
  46557. foreach ($result as $type => $data) {
  46558. if (3 !== $type) {
  46559. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  46560. } elseif (!isset($this->fallbackStatus['signaled'])) {
  46561. $this->fallbackStatus['exitcode'] = (int) $data;
  46562. }
  46563. }
  46564. }
  46565. private function close()
  46566. {
  46567. $this->processPipes->close();
  46568. if (\is_resource($this->process)) {
  46569. proc_close($this->process);
  46570. }
  46571. $this->exitcode = $this->processInformation['exitcode'];
  46572. $this->status = self::STATUS_TERMINATED;
  46573. if (-1 === $this->exitcode) {
  46574. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  46575. $this->exitcode = 128 + $this->processInformation['termsig'];
  46576. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46577. $this->processInformation['signaled'] = true;
  46578. $this->processInformation['termsig'] = -1;
  46579. }
  46580. }
  46581. $this->callback = null;
  46582. return $this->exitcode;
  46583. }
  46584. private function resetProcessData()
  46585. {
  46586. $this->starttime = null;
  46587. $this->callback = null;
  46588. $this->exitcode = null;
  46589. $this->fallbackStatus = array();
  46590. $this->processInformation = null;
  46591. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  46592. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  46593. $this->process = null;
  46594. $this->latestSignal = null;
  46595. $this->status = self::STATUS_READY;
  46596. $this->incrementalOutputOffset = 0;
  46597. $this->incrementalErrorOutputOffset = 0;
  46598. }
  46599. private function doSignal($signal, $throwException)
  46600. {
  46601. if (null === $pid = $this->getPid()) {
  46602. if ($throwException) {
  46603. throw new LogicException('Can not send signal on a non running process.');
  46604. }
  46605. return false;
  46606. }
  46607. if ('\\' === \DIRECTORY_SEPARATOR) {
  46608. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  46609. if ($exitCode && $this->isRunning()) {
  46610. if ($throwException) {
  46611. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  46612. }
  46613. return false;
  46614. }
  46615. } else {
  46616. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  46617. $ok = @proc_terminate($this->process, $signal);
  46618. } elseif (\function_exists('posix_kill')) {
  46619. $ok = @posix_kill($pid, $signal);
  46620. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  46621. $ok = false === fgets($pipes[2]);
  46622. }
  46623. if (!$ok) {
  46624. if ($throwException) {
  46625. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  46626. }
  46627. return false;
  46628. }
  46629. }
  46630. $this->latestSignal = (int) $signal;
  46631. $this->fallbackStatus['signaled'] = true;
  46632. $this->fallbackStatus['exitcode'] = -1;
  46633. $this->fallbackStatus['termsig'] = $this->latestSignal;
  46634. return true;
  46635. }
  46636. private function requireProcessIsStarted($functionName)
  46637. {
  46638. if (!$this->isStarted()) {
  46639. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  46640. }
  46641. }
  46642. private function requireProcessIsTerminated($functionName)
  46643. {
  46644. if (!$this->isTerminated()) {
  46645. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  46646. }
  46647. }
  46648. }
  46649. <?php
  46650. namespace Symfony\Component\Process;
  46651. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46652. use Symfony\Component\Process\Exception\LogicException;
  46653. class ProcessBuilder
  46654. {
  46655. private $arguments;
  46656. private $cwd;
  46657. private $env = array();
  46658. private $input;
  46659. private $timeout = 60;
  46660. private $options = array();
  46661. private $inheritEnv = true;
  46662. private $prefix = array();
  46663. private $outputDisabled = false;
  46664. public function __construct(array $arguments = array())
  46665. {
  46666. $this->arguments = $arguments;
  46667. }
  46668. public static function create(array $arguments = array())
  46669. {
  46670. return new static($arguments);
  46671. }
  46672. public function add($argument)
  46673. {
  46674. $this->arguments[] = $argument;
  46675. return $this;
  46676. }
  46677. public function setPrefix($prefix)
  46678. {
  46679. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  46680. return $this;
  46681. }
  46682. public function setArguments(array $arguments)
  46683. {
  46684. $this->arguments = $arguments;
  46685. return $this;
  46686. }
  46687. public function setWorkingDirectory($cwd)
  46688. {
  46689. $this->cwd = $cwd;
  46690. return $this;
  46691. }
  46692. public function inheritEnvironmentVariables($inheritEnv = true)
  46693. {
  46694. $this->inheritEnv = $inheritEnv;
  46695. return $this;
  46696. }
  46697. public function setEnv($name, $value)
  46698. {
  46699. $this->env[$name] = $value;
  46700. return $this;
  46701. }
  46702. public function addEnvironmentVariables(array $variables)
  46703. {
  46704. $this->env = array_replace($this->env, $variables);
  46705. return $this;
  46706. }
  46707. public function setInput($input)
  46708. {
  46709. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46710. return $this;
  46711. }
  46712. public function setTimeout($timeout)
  46713. {
  46714. if (null === $timeout) {
  46715. $this->timeout = null;
  46716. return $this;
  46717. }
  46718. $timeout = (float) $timeout;
  46719. if ($timeout < 0) {
  46720. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46721. }
  46722. $this->timeout = $timeout;
  46723. return $this;
  46724. }
  46725. public function setOption($name, $value)
  46726. {
  46727. $this->options[$name] = $value;
  46728. return $this;
  46729. }
  46730. public function disableOutput()
  46731. {
  46732. $this->outputDisabled = true;
  46733. return $this;
  46734. }
  46735. public function enableOutput()
  46736. {
  46737. $this->outputDisabled = false;
  46738. return $this;
  46739. }
  46740. public function getProcess()
  46741. {
  46742. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  46743. throw new LogicException('You must add() command arguments before calling getProcess().');
  46744. }
  46745. $options = $this->options;
  46746. $arguments = array_merge($this->prefix, $this->arguments);
  46747. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  46748. if ($this->inheritEnv) {
  46749. $env = array_replace($_ENV, $_SERVER, $this->env);
  46750. } else {
  46751. $env = $this->env;
  46752. }
  46753. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  46754. if ($this->outputDisabled) {
  46755. $process->disableOutput();
  46756. }
  46757. return $process;
  46758. }
  46759. }
  46760. <?php
  46761. namespace Symfony\Component\Process;
  46762. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46763. class ProcessUtils
  46764. {
  46765. private function __construct()
  46766. {
  46767. }
  46768. public static function escapeArgument($argument)
  46769. {
  46770. if ('\\' === \DIRECTORY_SEPARATOR) {
  46771. if ('' === $argument) {
  46772. return escapeshellarg($argument);
  46773. }
  46774. $escapedArgument = '';
  46775. $quote = false;
  46776. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  46777. if ('"' === $part) {
  46778. $escapedArgument .= '\\"';
  46779. } elseif (self::isSurroundedBy($part, '%')) {
  46780. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  46781. } else {
  46782. if ('\\' === substr($part, -1)) {
  46783. $part .= '\\';
  46784. }
  46785. $quote = true;
  46786. $escapedArgument .= $part;
  46787. }
  46788. }
  46789. if ($quote) {
  46790. $escapedArgument = '"'.$escapedArgument.'"';
  46791. }
  46792. return $escapedArgument;
  46793. }
  46794. return "'".str_replace("'", "'\\''", $argument)."'";
  46795. }
  46796. public static function validateInput($caller, $input)
  46797. {
  46798. if (null !== $input) {
  46799. if (\is_resource($input)) {
  46800. return $input;
  46801. }
  46802. if (\is_string($input)) {
  46803. return $input;
  46804. }
  46805. if (is_scalar($input)) {
  46806. return (string) $input;
  46807. }
  46808. if (\is_object($input) && method_exists($input, '__toString')) {
  46809. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  46810. return (string) $input;
  46811. }
  46812. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  46813. }
  46814. return $input;
  46815. }
  46816. private static function isSurroundedBy($arg, $char)
  46817. {
  46818. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  46819. }
  46820. }
  46821. Copyright (c) 2011 Jordi Boggiano
  46822. Permission is hereby granted, free of charge, to any person obtaining a copy
  46823. of this software and associated documentation files (the "Software"), to deal
  46824. in the Software without restriction, including without limitation the rights
  46825. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46826. copies of the Software, and to permit persons to whom the Software is furnished
  46827. to do so, subject to the following conditions:
  46828. The above copyright notice and this permission notice shall be included in all
  46829. copies or substantial portions of the Software.
  46830. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46831. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46832. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46833. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46834. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46835. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46836. THE SOFTWARE.
  46837. <?php
  46838. namespace Seld\JsonLint;
  46839. class DuplicateKeyException extends ParsingException
  46840. {
  46841. public function __construct($message, $key, array $details = array())
  46842. {
  46843. $details['key'] = $key;
  46844. parent::__construct($message, $details);
  46845. }
  46846. public function getKey()
  46847. {
  46848. return $this->details['key'];
  46849. }
  46850. }
  46851. <?php
  46852. namespace Seld\JsonLint;
  46853. use stdClass;
  46854. class JsonParser
  46855. {
  46856. const DETECT_KEY_CONFLICTS = 1;
  46857. const ALLOW_DUPLICATE_KEYS = 2;
  46858. const PARSE_TO_ASSOC = 4;
  46859. private $lexer;
  46860. private $flags;
  46861. private $stack;
  46862. private $vstack;
  46863. private $lstack;
  46864. private $symbols = array(
  46865. 'error' => 2,
  46866. 'JSONString' => 3,
  46867. 'STRING' => 4,
  46868. 'JSONNumber' => 5,
  46869. 'NUMBER' => 6,
  46870. 'JSONNullLiteral' => 7,
  46871. 'NULL' => 8,
  46872. 'JSONBooleanLiteral' => 9,
  46873. 'TRUE' => 10,
  46874. 'FALSE' => 11,
  46875. 'JSONText' => 12,
  46876. 'JSONValue' => 13,
  46877. 'EOF' => 14,
  46878. 'JSONObject' => 15,
  46879. 'JSONArray' => 16,
  46880. '{' => 17,
  46881. '}' => 18,
  46882. 'JSONMemberList' => 19,
  46883. 'JSONMember' => 20,
  46884. ':' => 21,
  46885. ',' => 22,
  46886. '[' => 23,
  46887. ']' => 24,
  46888. 'JSONElementList' => 25,
  46889. '$accept' => 0,
  46890. '$end' => 1,
  46891. );
  46892. private $terminals_ = array(
  46893. 2 => "error",
  46894. 4 => "STRING",
  46895. 6 => "NUMBER",
  46896. 8 => "NULL",
  46897. 10 => "TRUE",
  46898. 11 => "FALSE",
  46899. 14 => "EOF",
  46900. 17 => "{",
  46901. 18 => "}",
  46902. 21 => ":",
  46903. 22 => ",",
  46904. 23 => "[",
  46905. 24 => "]",
  46906. );
  46907. private $productions_ = array(
  46908. 0,
  46909. array(3, 1),
  46910. array(5, 1),
  46911. array(7, 1),
  46912. array(9, 1),
  46913. array(9, 1),
  46914. array(12, 2),
  46915. array(13, 1),
  46916. array(13, 1),
  46917. array(13, 1),
  46918. array(13, 1),
  46919. array(13, 1),
  46920. array(13, 1),
  46921. array(15, 2),
  46922. array(15, 3),
  46923. array(20, 3),
  46924. array(19, 1),
  46925. array(19, 3),
  46926. array(16, 2),
  46927. array(16, 3),
  46928. array(25, 1),
  46929. array(25, 3)
  46930. );
  46931. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  46932. );
  46933. private $defaultActions = array(
  46934. 16 => array(2, 6)
  46935. );
  46936. public function lint($input, $flags = 0)
  46937. {
  46938. try {
  46939. $this->parse($input, $flags);
  46940. } catch (ParsingException $e) {
  46941. return $e;
  46942. }
  46943. }
  46944. public function parse($input, $flags = 0)
  46945. {
  46946. $this->failOnBOM($input);
  46947. $this->flags = $flags;
  46948. $this->stack = array(0);
  46949. $this->vstack = array(null);
  46950. $this->lstack = array();
  46951. $yytext = '';
  46952. $yylineno = 0;
  46953. $yyleng = 0;
  46954. $recovering = 0;
  46955. $TERROR = 2;
  46956. $EOF = 1;
  46957. $this->lexer = new Lexer();
  46958. $this->lexer->setInput($input);
  46959. $yyloc = $this->lexer->yylloc;
  46960. $this->lstack[] = $yyloc;
  46961. $symbol = null;
  46962. $preErrorSymbol = null;
  46963. $state = null;
  46964. $action = null;
  46965. $a = null;
  46966. $r = null;
  46967. $yyval = new stdClass;
  46968. $p = null;
  46969. $len = null;
  46970. $newState = null;
  46971. $expected = null;
  46972. $errStr = null;
  46973. while (true) {
  46974. $state = $this->stack[count($this->stack)-1];
  46975. if (isset($this->defaultActions[$state])) {
  46976. $action = $this->defaultActions[$state];
  46977. } else {
  46978. if ($symbol == null) {
  46979. $symbol = $this->lex();
  46980. }
  46981. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  46982. }
  46983. if (!$action || !$action[0]) {
  46984. if (!$recovering) {
  46985. $expected = array();
  46986. foreach ($this->table[$state] as $p => $ignore) {
  46987. if (isset($this->terminals_[$p]) && $p > 2) {
  46988. $expected[] = "'" . $this->terminals_[$p] . "'";
  46989. }
  46990. }
  46991. $message = null;
  46992. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  46993. $message = "Invalid string";
  46994. if ("'" === substr($this->lexer->match, 0, 1)) {
  46995. $message .= ", it appears you used single quotes instead of double quotes";
  46996. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  46997. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  46998. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  46999. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  47000. }
  47001. }
  47002. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47003. $errStr .= $this->lexer->showPosition() . "\n";
  47004. if ($message) {
  47005. $errStr .= $message;
  47006. } else {
  47007. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  47008. $errStr .= implode(', ', $expected);
  47009. }
  47010. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  47011. $errStr .= " - It appears you have an extra trailing comma";
  47012. }
  47013. $this->parseError($errStr, array(
  47014. 'text' => $this->lexer->match,
  47015. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  47016. 'line' => $this->lexer->yylineno,
  47017. 'loc' => $yyloc,
  47018. 'expected' => $expected,
  47019. ));
  47020. }
  47021. if ($recovering == 3) {
  47022. if ($symbol == $EOF) {
  47023. throw new ParsingException($errStr ?: 'Parsing halted.');
  47024. }
  47025. $yyleng = $this->lexer->yyleng;
  47026. $yytext = $this->lexer->yytext;
  47027. $yylineno = $this->lexer->yylineno;
  47028. $yyloc = $this->lexer->yylloc;
  47029. $symbol = $this->lex();
  47030. }
  47031. while (true) {
  47032. if (array_key_exists($TERROR, $this->table[$state])) {
  47033. break;
  47034. }
  47035. if ($state == 0) {
  47036. throw new ParsingException($errStr ?: 'Parsing halted.');
  47037. }
  47038. $this->popStack(1);
  47039. $state = $this->stack[count($this->stack)-1];
  47040. }
  47041. $preErrorSymbol = $symbol;
  47042. $symbol = $TERROR;
  47043. $state = $this->stack[count($this->stack)-1];
  47044. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  47045. $recovering = 3;
  47046. }
  47047. if (is_array($action[0]) && count($action) > 1) {
  47048. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  47049. }
  47050. switch ($action[0]) {
  47051. case 1:
  47052. $this->stack[] = $symbol;
  47053. $this->vstack[] = $this->lexer->yytext;
  47054. $this->lstack[] = $this->lexer->yylloc;
  47055. $this->stack[] = $action[1];
  47056. $symbol = null;
  47057. if (!$preErrorSymbol) {
  47058. $yyleng = $this->lexer->yyleng;
  47059. $yytext = $this->lexer->yytext;
  47060. $yylineno = $this->lexer->yylineno;
  47061. $yyloc = $this->lexer->yylloc;
  47062. if ($recovering > 0) {
  47063. $recovering--;
  47064. }
  47065. } else {
  47066. $symbol = $preErrorSymbol;
  47067. $preErrorSymbol = null;
  47068. }
  47069. break;
  47070. case 2:
  47071. $len = $this->productions_[$action[1]][1];
  47072. $yyval->token = $this->vstack[count($this->vstack) - $len];
  47073. $yyval->store = array(
  47074. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  47075. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  47076. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  47077. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  47078. );
  47079. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  47080. if (!$r instanceof Undefined) {
  47081. return $r;
  47082. }
  47083. if ($len) {
  47084. $this->popStack($len);
  47085. }
  47086. $this->stack[] = $this->productions_[$action[1]][0];
  47087. $this->vstack[] = $yyval->token;
  47088. $this->lstack[] = $yyval->store;
  47089. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  47090. $this->stack[] = $newState;
  47091. break;
  47092. case 3:
  47093. return true;
  47094. }
  47095. }
  47096. return true;
  47097. }
  47098. protected function parseError($str, $hash)
  47099. {
  47100. throw new ParsingException($str, $hash);
  47101. }
  47102. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  47103. {
  47104. $len = count($tokens) - 1;
  47105. switch ($yystate) {
  47106. case 1:
  47107. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  47108. $yyval->token = $yytext;
  47109. break;
  47110. case 2:
  47111. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  47112. $yyval->token = floatval($yytext);
  47113. } else {
  47114. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  47115. }
  47116. break;
  47117. case 3:
  47118. $yyval->token = null;
  47119. break;
  47120. case 4:
  47121. $yyval->token = true;
  47122. break;
  47123. case 5:
  47124. $yyval->token = false;
  47125. break;
  47126. case 6:
  47127. return $yyval->token = $tokens[$len-1];
  47128. case 13:
  47129. if ($this->flags & self::PARSE_TO_ASSOC) {
  47130. $yyval->token = array();
  47131. } else {
  47132. $yyval->token = new stdClass;
  47133. }
  47134. break;
  47135. case 14:
  47136. $yyval->token = $tokens[$len-1];
  47137. break;
  47138. case 15:
  47139. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  47140. break;
  47141. case 16:
  47142. if (PHP_VERSION_ID < 70100) {
  47143. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47144. } else {
  47145. $property = $tokens[$len][0];
  47146. }
  47147. if ($this->flags & self::PARSE_TO_ASSOC) {
  47148. $yyval->token = array();
  47149. $yyval->token[$property] = $tokens[$len][1];
  47150. } else {
  47151. $yyval->token = new stdClass;
  47152. $yyval->token->$property = $tokens[$len][1];
  47153. }
  47154. break;
  47155. case 17:
  47156. if ($this->flags & self::PARSE_TO_ASSOC) {
  47157. $yyval->token =& $tokens[$len-2];
  47158. $key = $tokens[$len][0];
  47159. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  47160. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47161. $errStr .= $this->lexer->showPosition() . "\n";
  47162. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47163. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47164. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  47165. $duplicateCount = 1;
  47166. do {
  47167. $duplicateKey = $key . '.' . $duplicateCount++;
  47168. } while (isset($tokens[$len-2][$duplicateKey]));
  47169. $key = $duplicateKey;
  47170. }
  47171. $tokens[$len-2][$key] = $tokens[$len][1];
  47172. } else {
  47173. $yyval->token = $tokens[$len-2];
  47174. if (PHP_VERSION_ID < 70100) {
  47175. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47176. } else {
  47177. $key = $tokens[$len][0];
  47178. }
  47179. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  47180. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47181. $errStr .= $this->lexer->showPosition() . "\n";
  47182. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47183. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47184. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  47185. $duplicateCount = 1;
  47186. do {
  47187. $duplicateKey = $key . '.' . $duplicateCount++;
  47188. } while (isset($tokens[$len-2]->$duplicateKey));
  47189. $key = $duplicateKey;
  47190. }
  47191. $tokens[$len-2]->$key = $tokens[$len][1];
  47192. }
  47193. break;
  47194. case 18:
  47195. $yyval->token = array();
  47196. break;
  47197. case 19:
  47198. $yyval->token = $tokens[$len-1];
  47199. break;
  47200. case 20:
  47201. $yyval->token = array($tokens[$len]);
  47202. break;
  47203. case 21:
  47204. $tokens[$len-2][] = $tokens[$len];
  47205. $yyval->token = $tokens[$len-2];
  47206. break;
  47207. }
  47208. return new Undefined();
  47209. }
  47210. private function stringInterpolation($match)
  47211. {
  47212. switch ($match[0]) {
  47213. case '\\\\':
  47214. return '\\';
  47215. case '\"':
  47216. return '"';
  47217. case '\b':
  47218. return chr(8);
  47219. case '\f':
  47220. return chr(12);
  47221. case '\n':
  47222. return "\n";
  47223. case '\r':
  47224. return "\r";
  47225. case '\t':
  47226. return "\t";
  47227. case '\/':
  47228. return "/";
  47229. default:
  47230. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  47231. }
  47232. }
  47233. private function popStack($n)
  47234. {
  47235. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  47236. $this->vstack = array_slice($this->vstack, 0, - $n);
  47237. $this->lstack = array_slice($this->lstack, 0, - $n);
  47238. }
  47239. private function lex()
  47240. {
  47241. $token = $this->lexer->lex() ?: 1;
  47242. if (!is_numeric($token)) {
  47243. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  47244. }
  47245. return $token;
  47246. }
  47247. private function failOnBOM($input)
  47248. {
  47249. $bom = "\xEF\xBB\xBF";
  47250. if (substr($input, 0, 3) === $bom) {
  47251. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  47252. }
  47253. }
  47254. }
  47255. <?php
  47256. namespace Seld\JsonLint;
  47257. class Lexer
  47258. {
  47259. private $EOF = 1;
  47260. private $rules = array(
  47261. 0 => '/^\s+/',
  47262. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  47263. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  47264. 3 => '/^\{/',
  47265. 4 => '/^\}/',
  47266. 5 => '/^\[/',
  47267. 6 => '/^\]/',
  47268. 7 => '/^,/',
  47269. 8 => '/^:/',
  47270. 9 => '/^true\b/',
  47271. 10 => '/^false\b/',
  47272. 11 => '/^null\b/',
  47273. 12 => '/^$/',
  47274. 13 => '/^./',
  47275. );
  47276. private $conditions = array(
  47277. "INITIAL" => array(
  47278. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  47279. "inclusive" => true,
  47280. ),
  47281. );
  47282. private $conditionStack;
  47283. private $input;
  47284. private $more;
  47285. private $done;
  47286. private $matched;
  47287. public $match;
  47288. public $yylineno;
  47289. public $yyleng;
  47290. public $yytext;
  47291. public $yylloc;
  47292. public function lex()
  47293. {
  47294. $r = $this->next();
  47295. if (!$r instanceof Undefined) {
  47296. return $r;
  47297. }
  47298. return $this->lex();
  47299. }
  47300. public function setInput($input)
  47301. {
  47302. $this->input = $input;
  47303. $this->more = false;
  47304. $this->done = false;
  47305. $this->yylineno = $this->yyleng = 0;
  47306. $this->yytext = $this->matched = $this->match = '';
  47307. $this->conditionStack = array('INITIAL');
  47308. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  47309. return $this;
  47310. }
  47311. public function showPosition()
  47312. {
  47313. $pre = str_replace("\n", '', $this->getPastInput());
  47314. $c = str_repeat('-', max(0, strlen($pre) - 1));
  47315. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  47316. }
  47317. public function getPastInput()
  47318. {
  47319. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  47320. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  47321. }
  47322. public function getUpcomingInput()
  47323. {
  47324. $next = $this->match;
  47325. if (strlen($next) < 20) {
  47326. $next .= substr($this->input, 0, 20 - strlen($next));
  47327. }
  47328. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  47329. }
  47330. protected function parseError($str, $hash)
  47331. {
  47332. throw new \Exception($str);
  47333. }
  47334. private function next()
  47335. {
  47336. if ($this->done) {
  47337. return $this->EOF;
  47338. }
  47339. if ($this->input === '') {
  47340. $this->done = true;
  47341. }
  47342. $token = null;
  47343. $match = null;
  47344. $col = null;
  47345. $lines = null;
  47346. if (!$this->more) {
  47347. $this->yytext = '';
  47348. $this->match = '';
  47349. }
  47350. $rules = $this->getCurrentRules();
  47351. $rulesLen = count($rules);
  47352. for ($i=0; $i < $rulesLen; $i++) {
  47353. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  47354. preg_match_all('/\n.*/', $match[0], $lines);
  47355. $lines = $lines[0];
  47356. if ($lines) {
  47357. $this->yylineno += count($lines);
  47358. }
  47359. $this->yylloc = array(
  47360. 'first_line' => $this->yylloc['last_line'],
  47361. 'last_line' => $this->yylineno+1,
  47362. 'first_column' => $this->yylloc['last_column'],
  47363. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  47364. );
  47365. $this->yytext .= $match[0];
  47366. $this->match .= $match[0];
  47367. $this->yyleng = strlen($this->yytext);
  47368. $this->more = false;
  47369. $this->input = substr($this->input, strlen($match[0]));
  47370. $this->matched .= $match[0];
  47371. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  47372. if ($token) {
  47373. return $token;
  47374. }
  47375. return new Undefined();
  47376. }
  47377. }
  47378. if ($this->input === "") {
  47379. return $this->EOF;
  47380. }
  47381. $this->parseError(
  47382. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  47383. array(
  47384. 'text' => "",
  47385. 'token' => null,
  47386. 'line' => $this->yylineno,
  47387. )
  47388. );
  47389. }
  47390. private function getCurrentRules()
  47391. {
  47392. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  47393. }
  47394. private function performAction($avoiding_name_collisions, $YY_START)
  47395. {
  47396. switch ($avoiding_name_collisions) {
  47397. case 0:
  47398. break;
  47399. case 1:
  47400. return 6;
  47401. break;
  47402. case 2:
  47403. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  47404. return 4;
  47405. case 3:
  47406. return 17;
  47407. case 4:
  47408. return 18;
  47409. case 5:
  47410. return 23;
  47411. case 6:
  47412. return 24;
  47413. case 7:
  47414. return 22;
  47415. case 8:
  47416. return 21;
  47417. case 9:
  47418. return 10;
  47419. case 10:
  47420. return 11;
  47421. case 11:
  47422. return 8;
  47423. case 12:
  47424. return 14;
  47425. case 13:
  47426. return 'INVALID';
  47427. }
  47428. }
  47429. }
  47430. <?php
  47431. namespace Seld\JsonLint;
  47432. class ParsingException extends \Exception
  47433. {
  47434. protected $details;
  47435. public function __construct($message, $details = array())
  47436. {
  47437. $this->details = $details;
  47438. parent::__construct($message);
  47439. }
  47440. public function getDetails()
  47441. {
  47442. return $this->details;
  47443. }
  47444. }
  47445. <?php
  47446. namespace Seld\JsonLint;
  47447. class Undefined
  47448. {
  47449. }
  47450. MIT License
  47451. Copyright (c) 2016
  47452. Permission is hereby granted, free of charge, to any person obtaining a copy
  47453. of this software and associated documentation files (the "Software"), to deal
  47454. in the Software without restriction, including without limitation the rights
  47455. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47456. copies of the Software, and to permit persons to whom the Software is
  47457. furnished to do so, subject to the following conditions:
  47458. The above copyright notice and this permission notice shall be included in all
  47459. copies or substantial portions of the Software.
  47460. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47461. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47462. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47463. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47464. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47465. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47466. SOFTWARE.
  47467. <?php
  47468. require __DIR__ . '/../vendor/autoload.php';
  47469. $data = json_decode(file_get_contents('data.json'));
  47470. $validator = new JsonSchema\Validator();
  47471. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  47472. if ($validator->isValid()) {
  47473. echo "The supplied JSON validates against the schema.\n";
  47474. } else {
  47475. echo "JSON does not validate. Violations:\n";
  47476. foreach ($validator->getErrors() as $error) {
  47477. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  47478. }
  47479. }
  47480. <?php
  47481. namespace JsonSchema\Constraints;
  47482. use JsonSchema\Entity\JsonPointer;
  47483. use JsonSchema\Exception\InvalidArgumentException;
  47484. use JsonSchema\Exception\ValidationException;
  47485. use JsonSchema\Validator;
  47486. class BaseConstraint
  47487. {
  47488. protected $errors = array();
  47489. protected $errorMask = Validator::ERROR_NONE;
  47490. protected $factory;
  47491. public function __construct(Factory $factory = null)
  47492. {
  47493. $this->factory = $factory ?: new Factory();
  47494. }
  47495. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47496. {
  47497. $error = array(
  47498. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  47499. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  47500. 'message' => $message,
  47501. 'constraint' => $constraint,
  47502. 'context' => $this->factory->getErrorContext(),
  47503. );
  47504. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  47505. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  47506. }
  47507. if (is_array($more) && count($more) > 0) {
  47508. $error += $more;
  47509. }
  47510. $this->errors[] = $error;
  47511. $this->errorMask |= $error['context'];
  47512. }
  47513. public function addErrors(array $errors)
  47514. {
  47515. if ($errors) {
  47516. $this->errors = array_merge($this->errors, $errors);
  47517. $errorMask = &$this->errorMask;
  47518. array_walk($errors, function ($error) use (&$errorMask) {
  47519. if (isset($error['context'])) {
  47520. $errorMask |= $error['context'];
  47521. }
  47522. });
  47523. }
  47524. }
  47525. public function getErrors($errorContext = Validator::ERROR_ALL)
  47526. {
  47527. if ($errorContext === Validator::ERROR_ALL) {
  47528. return $this->errors;
  47529. }
  47530. return array_filter($this->errors, function ($error) use ($errorContext) {
  47531. if ($errorContext & $error['context']) {
  47532. return true;
  47533. }
  47534. });
  47535. }
  47536. public function numErrors($errorContext = Validator::ERROR_ALL)
  47537. {
  47538. if ($errorContext === Validator::ERROR_ALL) {
  47539. return count($this->errors);
  47540. }
  47541. return count($this->getErrors($errorContext));
  47542. }
  47543. public function isValid()
  47544. {
  47545. return !$this->getErrors();
  47546. }
  47547. public function reset()
  47548. {
  47549. $this->errors = array();
  47550. $this->errorMask = Validator::ERROR_NONE;
  47551. }
  47552. public function getErrorMask()
  47553. {
  47554. return $this->errorMask;
  47555. }
  47556. public static function arrayToObjectRecursive($array)
  47557. {
  47558. $json = json_encode($array);
  47559. if (json_last_error() !== \JSON_ERROR_NONE) {
  47560. $message = 'Unable to encode schema array as JSON';
  47561. if (function_exists('json_last_error_msg')) {
  47562. $message .= ': ' . json_last_error_msg();
  47563. }
  47564. throw new InvalidArgumentException($message);
  47565. }
  47566. return (object) json_decode($json);
  47567. }
  47568. }
  47569. <?php
  47570. namespace JsonSchema\Constraints;
  47571. use JsonSchema\Entity\JsonPointer;
  47572. class CollectionConstraint extends Constraint
  47573. {
  47574. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47575. {
  47576. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  47577. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  47578. }
  47579. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  47580. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  47581. }
  47582. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  47583. $unique = $value;
  47584. if (is_array($value) && count($value)) {
  47585. $unique = array_map(function ($e) {
  47586. return var_export($e, true);
  47587. }, $value);
  47588. }
  47589. if (count(array_unique($unique)) != count($value)) {
  47590. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  47591. }
  47592. }
  47593. if (isset($schema->items)) {
  47594. $this->validateItems($value, $schema, $path, $i);
  47595. }
  47596. }
  47597. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47598. {
  47599. if (is_object($schema->items)) {
  47600. if (isset($schema->items->type)
  47601. && (
  47602. $schema->items->type == 'string'
  47603. || $schema->items->type == 'number'
  47604. || $schema->items->type == 'integer'
  47605. )
  47606. && !isset($schema->additionalItems)
  47607. ) {
  47608. $type = $schema->items->type;
  47609. $typeValidator = $this->factory->createInstanceFor('type');
  47610. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  47611. foreach ($value as $k => &$v) {
  47612. $k_path = $this->incrementPath($path, $k);
  47613. $typeValidator->check($v, $schema->items, $k_path, $i);
  47614. $validator->check($v, $schema->items, $k_path, $i);
  47615. }
  47616. unset($v);
  47617. $this->addErrors($typeValidator->getErrors());
  47618. $this->addErrors($validator->getErrors());
  47619. } else {
  47620. foreach ($value as $k => &$v) {
  47621. $initErrors = $this->getErrors();
  47622. $this->checkUndefined($v, $schema->items, $path, $k);
  47623. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  47624. $secondErrors = $this->getErrors();
  47625. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47626. }
  47627. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  47628. $this->errors = $secondErrors;
  47629. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  47630. $this->errors = $initErrors;
  47631. }
  47632. }
  47633. unset($v);
  47634. }
  47635. } else {
  47636. foreach ($value as $k => &$v) {
  47637. if (array_key_exists($k, $schema->items)) {
  47638. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  47639. } else {
  47640. if (property_exists($schema, 'additionalItems')) {
  47641. if ($schema->additionalItems !== false) {
  47642. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47643. } else {
  47644. $this->addError(
  47645. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  47646. }
  47647. } else {
  47648. $this->checkUndefined($v, new \stdClass(), $path, $k);
  47649. }
  47650. }
  47651. }
  47652. unset($v);
  47653. if (count($value) > 0) {
  47654. for ($k = count($value); $k < count($schema->items); $k++) {
  47655. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  47656. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  47657. }
  47658. }
  47659. }
  47660. }
  47661. }
  47662. <?php
  47663. namespace JsonSchema\Constraints;
  47664. use JsonSchema\Entity\JsonPointer;
  47665. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  47666. {
  47667. protected $inlineSchemaProperty = '$schema';
  47668. const CHECK_MODE_NONE = 0x00000000;
  47669. const CHECK_MODE_NORMAL = 0x00000001;
  47670. const CHECK_MODE_TYPE_CAST = 0x00000002;
  47671. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  47672. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  47673. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  47674. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  47675. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  47676. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  47677. protected function incrementPath(JsonPointer $path = null, $i)
  47678. {
  47679. $path = $path ?: new JsonPointer('');
  47680. $path = $path->withPropertyPaths(
  47681. array_merge(
  47682. $path->getPropertyPaths(),
  47683. array_filter(array($i), 'strlen')
  47684. )
  47685. );
  47686. return $path;
  47687. }
  47688. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47689. {
  47690. $validator = $this->factory->createInstanceFor('collection');
  47691. $validator->check($value, $schema, $path, $i);
  47692. $this->addErrors($validator->getErrors());
  47693. }
  47694. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  47695. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  47696. {
  47697. $validator = $this->factory->createInstanceFor('object');
  47698. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  47699. $this->addErrors($validator->getErrors());
  47700. }
  47701. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47702. {
  47703. $validator = $this->factory->createInstanceFor('type');
  47704. $validator->check($value, $schema, $path, $i);
  47705. $this->addErrors($validator->getErrors());
  47706. }
  47707. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47708. {
  47709. $validator = $this->factory->createInstanceFor('undefined');
  47710. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  47711. $this->addErrors($validator->getErrors());
  47712. }
  47713. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  47714. {
  47715. $validator = $this->factory->createInstanceFor('string');
  47716. $validator->check($value, $schema, $path, $i);
  47717. $this->addErrors($validator->getErrors());
  47718. }
  47719. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  47720. {
  47721. $validator = $this->factory->createInstanceFor('number');
  47722. $validator->check($value, $schema, $path, $i);
  47723. $this->addErrors($validator->getErrors());
  47724. }
  47725. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  47726. {
  47727. $validator = $this->factory->createInstanceFor('enum');
  47728. $validator->check($value, $schema, $path, $i);
  47729. $this->addErrors($validator->getErrors());
  47730. }
  47731. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  47732. {
  47733. $validator = $this->factory->createInstanceFor('format');
  47734. $validator->check($value, $schema, $path, $i);
  47735. $this->addErrors($validator->getErrors());
  47736. }
  47737. protected function getTypeCheck()
  47738. {
  47739. return $this->factory->getTypeCheck();
  47740. }
  47741. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  47742. {
  47743. $result = array_map(
  47744. function ($path) {
  47745. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  47746. },
  47747. $pointer->getPropertyPaths()
  47748. );
  47749. return trim(implode('', $result), '.');
  47750. }
  47751. }
  47752. <?php
  47753. namespace JsonSchema\Constraints;
  47754. use JsonSchema\Entity\JsonPointer;
  47755. interface ConstraintInterface
  47756. {
  47757. public function getErrors();
  47758. public function addErrors(array $errors);
  47759. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  47760. public function isValid();
  47761. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  47762. }
  47763. <?php
  47764. namespace JsonSchema\Constraints;
  47765. use JsonSchema\Entity\JsonPointer;
  47766. class EnumConstraint extends Constraint
  47767. {
  47768. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47769. {
  47770. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  47771. return;
  47772. }
  47773. $type = gettype($element);
  47774. foreach ($schema->enum as $enum) {
  47775. $enumType = gettype($enum);
  47776. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  47777. if ((object) $element == $enum) {
  47778. return;
  47779. }
  47780. }
  47781. if ($type === gettype($enum)) {
  47782. if ($type == 'object') {
  47783. if ($element == $enum) {
  47784. return;
  47785. }
  47786. } elseif ($element === $enum) {
  47787. return;
  47788. }
  47789. }
  47790. }
  47791. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  47792. }
  47793. }
  47794. <?php
  47795. namespace JsonSchema\Constraints;
  47796. use JsonSchema\Exception\InvalidArgumentException;
  47797. use JsonSchema\SchemaStorage;
  47798. use JsonSchema\SchemaStorageInterface;
  47799. use JsonSchema\Uri\UriRetriever;
  47800. use JsonSchema\UriRetrieverInterface;
  47801. use JsonSchema\Validator;
  47802. class Factory
  47803. {
  47804. protected $schemaStorage;
  47805. protected $uriRetriever;
  47806. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  47807. private $typeCheck = array();
  47808. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  47809. protected $constraintMap = array(
  47810. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  47811. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  47812. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  47813. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  47814. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  47815. 'string' => 'JsonSchema\Constraints\StringConstraint',
  47816. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  47817. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  47818. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  47819. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  47820. 'validator' => 'JsonSchema\Validator'
  47821. );
  47822. private $instanceCache = array();
  47823. public function __construct(
  47824. SchemaStorageInterface $schemaStorage = null,
  47825. UriRetrieverInterface $uriRetriever = null,
  47826. $checkMode = Constraint::CHECK_MODE_NORMAL
  47827. ) {
  47828. $this->setConfig($checkMode);
  47829. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47830. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  47831. }
  47832. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  47833. {
  47834. $this->checkMode = $checkMode;
  47835. }
  47836. public function addConfig($options)
  47837. {
  47838. $this->checkMode |= $options;
  47839. }
  47840. public function removeConfig($options)
  47841. {
  47842. $this->checkMode &= ~$options;
  47843. }
  47844. public function getConfig($options = null)
  47845. {
  47846. if ($options === null) {
  47847. return $this->checkMode;
  47848. }
  47849. return $this->checkMode & $options;
  47850. }
  47851. public function getUriRetriever()
  47852. {
  47853. return $this->uriRetriever;
  47854. }
  47855. public function getSchemaStorage()
  47856. {
  47857. return $this->schemaStorage;
  47858. }
  47859. public function getTypeCheck()
  47860. {
  47861. if (!isset($this->typeCheck[$this->checkMode])) {
  47862. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  47863. ? new TypeCheck\LooseTypeCheck()
  47864. : new TypeCheck\StrictTypeCheck();
  47865. }
  47866. return $this->typeCheck[$this->checkMode];
  47867. }
  47868. public function setConstraintClass($name, $class)
  47869. {
  47870. if (!class_exists($class)) {
  47871. throw new InvalidArgumentException('Unknown constraint ' . $name);
  47872. }
  47873. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  47874. throw new InvalidArgumentException('Invalid class ' . $name);
  47875. }
  47876. $this->constraintMap[$name] = $class;
  47877. return $this;
  47878. }
  47879. public function createInstanceFor($constraintName)
  47880. {
  47881. if (!isset($this->constraintMap[$constraintName])) {
  47882. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  47883. }
  47884. if (!isset($this->instanceCache[$constraintName])) {
  47885. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  47886. }
  47887. return clone $this->instanceCache[$constraintName];
  47888. }
  47889. public function getErrorContext()
  47890. {
  47891. return $this->errorContext;
  47892. }
  47893. public function setErrorContext($errorContext)
  47894. {
  47895. $this->errorContext = $errorContext;
  47896. }
  47897. }
  47898. <?php
  47899. namespace JsonSchema\Constraints;
  47900. use JsonSchema\Entity\JsonPointer;
  47901. use JsonSchema\Rfc3339;
  47902. class FormatConstraint extends Constraint
  47903. {
  47904. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47905. {
  47906. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  47907. return;
  47908. }
  47909. switch ($schema->format) {
  47910. case 'date':
  47911. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  47912. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  47913. }
  47914. break;
  47915. case 'time':
  47916. if (!$this->validateDateTime($element, 'H:i:s')) {
  47917. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  47918. }
  47919. break;
  47920. case 'date-time':
  47921. if (null === Rfc3339::createFromString($element)) {
  47922. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  47923. }
  47924. break;
  47925. case 'utc-millisec':
  47926. if (!$this->validateDateTime($element, 'U')) {
  47927. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  47928. }
  47929. break;
  47930. case 'regex':
  47931. if (!$this->validateRegex($element)) {
  47932. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  47933. }
  47934. break;
  47935. case 'color':
  47936. if (!$this->validateColor($element)) {
  47937. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  47938. }
  47939. break;
  47940. case 'style':
  47941. if (!$this->validateStyle($element)) {
  47942. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  47943. }
  47944. break;
  47945. case 'phone':
  47946. if (!$this->validatePhone($element)) {
  47947. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  47948. }
  47949. break;
  47950. case 'uri':
  47951. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47952. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47953. }
  47954. break;
  47955. case 'uriref':
  47956. case 'uri-reference':
  47957. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47958. if (substr($element, 0, 2) === '//') {
  47959. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47960. } elseif (substr($element, 0, 1) === '/') {
  47961. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47962. } elseif (strlen($element)) {
  47963. $pathParts = explode('/', $element, 2);
  47964. if (strpos($pathParts[0], ':') !== false) {
  47965. $validURL = null;
  47966. } else {
  47967. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47968. }
  47969. } else {
  47970. $validURL = null;
  47971. }
  47972. if ($validURL === null) {
  47973. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47974. }
  47975. }
  47976. break;
  47977. case 'email':
  47978. $filterFlags = FILTER_NULL_ON_FAILURE;
  47979. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  47980. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  47981. }
  47982. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  47983. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  47984. }
  47985. break;
  47986. case 'ip-address':
  47987. case 'ipv4':
  47988. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  47989. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47990. }
  47991. break;
  47992. case 'ipv6':
  47993. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  47994. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47995. }
  47996. break;
  47997. case 'host-name':
  47998. case 'hostname':
  47999. if (!$this->validateHostname($element)) {
  48000. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48001. }
  48002. break;
  48003. default:
  48004. break;
  48005. }
  48006. }
  48007. protected function validateDateTime($datetime, $format)
  48008. {
  48009. $dt = \DateTime::createFromFormat($format, $datetime);
  48010. if (!$dt) {
  48011. return false;
  48012. }
  48013. if ($datetime === $dt->format($format)) {
  48014. return true;
  48015. }
  48016. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48017. return true;
  48018. }
  48019. return false;
  48020. }
  48021. protected function validateRegex($regex)
  48022. {
  48023. return false !== @preg_match('/' . $regex . '/u', '');
  48024. }
  48025. protected function validateColor($color)
  48026. {
  48027. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48028. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48029. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48030. return true;
  48031. }
  48032. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48033. }
  48034. protected function validateStyle($style)
  48035. {
  48036. $properties = explode(';', rtrim($style, ';'));
  48037. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48038. return empty($invalidEntries);
  48039. }
  48040. protected function validatePhone($phone)
  48041. {
  48042. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48043. }
  48044. protected function validateHostname($host)
  48045. {
  48046. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  48047. return preg_match($hostnameRegex, $host);
  48048. }
  48049. }
  48050. <?php
  48051. namespace JsonSchema\Constraints;
  48052. use JsonSchema\Entity\JsonPointer;
  48053. class NumberConstraint extends Constraint
  48054. {
  48055. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48056. {
  48057. if (isset($schema->exclusiveMinimum)) {
  48058. if (isset($schema->minimum)) {
  48059. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48060. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48061. } elseif ($element < $schema->minimum) {
  48062. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48063. }
  48064. } else {
  48065. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48066. }
  48067. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48068. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48069. }
  48070. if (isset($schema->exclusiveMaximum)) {
  48071. if (isset($schema->maximum)) {
  48072. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48073. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48074. } elseif ($element > $schema->maximum) {
  48075. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48076. }
  48077. } else {
  48078. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48079. }
  48080. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48081. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48082. }
  48083. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48084. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48085. }
  48086. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48087. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48088. }
  48089. $this->checkFormat($element, $schema, $path, $i);
  48090. }
  48091. private function fmod($number1, $number2)
  48092. {
  48093. $number1 = abs($number1);
  48094. $modulus = fmod($number1, $number2);
  48095. $precision = abs(0.0000000001);
  48096. $diff = (float) ($modulus - $number2);
  48097. if (-$precision < $diff && $diff < $precision) {
  48098. return 0.0;
  48099. }
  48100. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  48101. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  48102. return (float) round($modulus, max($decimals1, $decimals2));
  48103. }
  48104. }
  48105. <?php
  48106. namespace JsonSchema\Constraints;
  48107. use JsonSchema\Entity\JsonPointer;
  48108. class ObjectConstraint extends Constraint
  48109. {
  48110. protected $appliedDefaults = array();
  48111. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48112. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48113. {
  48114. if ($element instanceof UndefinedConstraint) {
  48115. return;
  48116. }
  48117. $this->appliedDefaults = $appliedDefaults;
  48118. $matches = array();
  48119. if ($patternProperties) {
  48120. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48121. }
  48122. if ($properties) {
  48123. $this->validateProperties($element, $properties, $path);
  48124. }
  48125. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48126. }
  48127. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48128. {
  48129. $try = array('/', '#', '+', '~', '%');
  48130. $matches = array();
  48131. foreach ($patternProperties as $pregex => $schema) {
  48132. $delimiter = '/';
  48133. foreach ($try as $delimiter) {
  48134. if (strpos($pregex, $delimiter) === false) {
  48135. break;
  48136. }
  48137. }
  48138. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48139. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48140. continue;
  48141. }
  48142. foreach ($element as $i => $value) {
  48143. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48144. $matches[] = $i;
  48145. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48146. }
  48147. }
  48148. }
  48149. return $matches;
  48150. }
  48151. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48152. $properties = null, $additionalProp = null)
  48153. {
  48154. $this->validateMinMaxConstraint($element, $schema, $path);
  48155. foreach ($element as $i => $value) {
  48156. $definition = $this->getProperty($properties, $i);
  48157. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48158. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48159. }
  48160. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48161. if ($additionalProp === true) {
  48162. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48163. } else {
  48164. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48165. }
  48166. }
  48167. $require = $this->getProperty($definition, 'requires');
  48168. if ($require && !$this->getProperty($element, $require)) {
  48169. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48170. }
  48171. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48172. if (is_object($property)) {
  48173. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48174. }
  48175. }
  48176. }
  48177. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48178. {
  48179. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48180. foreach ($properties as $i => $value) {
  48181. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48182. $definition = $this->getProperty($properties, $i);
  48183. if (is_object($definition)) {
  48184. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48185. }
  48186. }
  48187. }
  48188. protected function &getProperty(&$element, $property, $fallback = null)
  48189. {
  48190. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48191. return $element[$property];
  48192. } elseif (is_object($element) && property_exists($element, $property)) {
  48193. return $element->$property;
  48194. }
  48195. return $fallback;
  48196. }
  48197. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48198. {
  48199. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48200. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48201. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48202. }
  48203. }
  48204. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48205. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48206. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48207. }
  48208. }
  48209. }
  48210. }
  48211. <?php
  48212. namespace JsonSchema\Constraints;
  48213. use JsonSchema\Entity\JsonPointer;
  48214. use JsonSchema\Exception\InvalidArgumentException;
  48215. use JsonSchema\Exception\InvalidSchemaException;
  48216. use JsonSchema\Exception\RuntimeException;
  48217. use JsonSchema\Validator;
  48218. class SchemaConstraint extends Constraint
  48219. {
  48220. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48221. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48222. {
  48223. if ($schema !== null) {
  48224. $validationSchema = $schema;
  48225. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48226. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48227. } else {
  48228. throw new InvalidArgumentException('no schema found to verify against');
  48229. }
  48230. if (is_array($validationSchema)) {
  48231. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48232. }
  48233. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48234. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48235. throw new RuntimeException('Cannot validate the schema of a non-object');
  48236. }
  48237. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48238. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48239. } else {
  48240. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48241. }
  48242. $schemaStorage = $this->factory->getSchemaStorage();
  48243. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48244. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48245. }
  48246. $initialErrorCount = $this->numErrors();
  48247. $initialConfig = $this->factory->getConfig();
  48248. $initialContext = $this->factory->getErrorContext();
  48249. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48250. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48251. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48252. try {
  48253. $this->check($validationSchema, $schemaSpec);
  48254. } catch (\Exception $e) {
  48255. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48256. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48257. }
  48258. }
  48259. if ($this->numErrors() > $initialErrorCount) {
  48260. $this->addError($path, 'Schema is not valid', 'schema');
  48261. }
  48262. $this->factory->setConfig($initialConfig);
  48263. $this->factory->setErrorContext($initialContext);
  48264. }
  48265. $this->checkUndefined($element, $validationSchema, $path, $i);
  48266. }
  48267. }
  48268. <?php
  48269. namespace JsonSchema\Constraints;
  48270. use JsonSchema\Entity\JsonPointer;
  48271. class StringConstraint extends Constraint
  48272. {
  48273. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48274. {
  48275. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48276. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48277. 'maxLength' => $schema->maxLength,
  48278. ));
  48279. }
  48280. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48281. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48282. 'minLength' => $schema->minLength,
  48283. ));
  48284. }
  48285. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48286. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48287. 'pattern' => $schema->pattern,
  48288. ));
  48289. }
  48290. $this->checkFormat($element, $schema, $path, $i);
  48291. }
  48292. private function strlen($string)
  48293. {
  48294. if (extension_loaded('mbstring')) {
  48295. return mb_strlen($string, mb_detect_encoding($string));
  48296. }
  48297. return strlen($string);
  48298. }
  48299. }
  48300. <?php
  48301. namespace JsonSchema\Constraints\TypeCheck;
  48302. class LooseTypeCheck implements TypeCheckInterface
  48303. {
  48304. public static function isObject($value)
  48305. {
  48306. return
  48307. is_object($value) ||
  48308. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48309. }
  48310. public static function isArray($value)
  48311. {
  48312. return
  48313. is_array($value) &&
  48314. (count($value) == 0 || !self::isAssociativeArray($value));
  48315. }
  48316. public static function propertyGet($value, $property)
  48317. {
  48318. if (is_object($value)) {
  48319. return $value->{$property};
  48320. }
  48321. return $value[$property];
  48322. }
  48323. public static function propertySet(&$value, $property, $data)
  48324. {
  48325. if (is_object($value)) {
  48326. $value->{$property} = $data;
  48327. } else {
  48328. $value[$property] = $data;
  48329. }
  48330. }
  48331. public static function propertyExists($value, $property)
  48332. {
  48333. if (is_object($value)) {
  48334. return property_exists($value, $property);
  48335. }
  48336. return array_key_exists($property, $value);
  48337. }
  48338. public static function propertyCount($value)
  48339. {
  48340. if (is_object($value)) {
  48341. return count(get_object_vars($value));
  48342. }
  48343. return count($value);
  48344. }
  48345. private static function isAssociativeArray($arr)
  48346. {
  48347. return array_keys($arr) !== range(0, count($arr) - 1);
  48348. }
  48349. }
  48350. <?php
  48351. namespace JsonSchema\Constraints\TypeCheck;
  48352. class StrictTypeCheck implements TypeCheckInterface
  48353. {
  48354. public static function isObject($value)
  48355. {
  48356. return is_object($value);
  48357. }
  48358. public static function isArray($value)
  48359. {
  48360. return is_array($value);
  48361. }
  48362. public static function propertyGet($value, $property)
  48363. {
  48364. return $value->{$property};
  48365. }
  48366. public static function propertySet(&$value, $property, $data)
  48367. {
  48368. $value->{$property} = $data;
  48369. }
  48370. public static function propertyExists($value, $property)
  48371. {
  48372. return property_exists($value, $property);
  48373. }
  48374. public static function propertyCount($value)
  48375. {
  48376. return count(get_object_vars($value));
  48377. }
  48378. }
  48379. <?php
  48380. namespace JsonSchema\Constraints\TypeCheck;
  48381. interface TypeCheckInterface
  48382. {
  48383. public static function isObject($value);
  48384. public static function isArray($value);
  48385. public static function propertyGet($value, $property);
  48386. public static function propertySet(&$value, $property, $data);
  48387. public static function propertyExists($value, $property);
  48388. public static function propertyCount($value);
  48389. }
  48390. <?php
  48391. namespace JsonSchema\Constraints;
  48392. use JsonSchema\Entity\JsonPointer;
  48393. use JsonSchema\Exception\InvalidArgumentException;
  48394. use UnexpectedValueException as StandardUnexpectedValueException;
  48395. class TypeConstraint extends Constraint
  48396. {
  48397. public static $wording = array(
  48398. 'integer' => 'an integer',
  48399. 'number' => 'a number',
  48400. 'boolean' => 'a boolean',
  48401. 'object' => 'an object',
  48402. 'array' => 'an array',
  48403. 'string' => 'a string',
  48404. 'null' => 'a null',
  48405. 'any' => null,
  48406. 0 => null,
  48407. );
  48408. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48409. {
  48410. $type = isset($schema->type) ? $schema->type : null;
  48411. $isValid = false;
  48412. $wording = array();
  48413. if (is_array($type)) {
  48414. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48415. } elseif (is_object($type)) {
  48416. $this->checkUndefined($value, $type, $path);
  48417. return;
  48418. } else {
  48419. $isValid = $this->validateType($value, $type);
  48420. }
  48421. if ($isValid === false) {
  48422. if (!is_array($type)) {
  48423. $this->validateTypeNameWording($type);
  48424. $wording[] = self::$wording[$type];
  48425. }
  48426. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48427. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48428. }
  48429. }
  48430. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48431. {
  48432. foreach ($type as $tp) {
  48433. if (is_object($tp)) {
  48434. if (!$isValid) {
  48435. $validator = $this->factory->createInstanceFor('type');
  48436. $subSchema = new \stdClass();
  48437. $subSchema->type = $tp;
  48438. $validator->check($value, $subSchema, $path, null);
  48439. $error = $validator->getErrors();
  48440. $isValid = !(bool) $error;
  48441. $validTypesWording[] = self::$wording['object'];
  48442. }
  48443. } else {
  48444. $this->validateTypeNameWording($tp);
  48445. $validTypesWording[] = self::$wording[$tp];
  48446. if (!$isValid) {
  48447. $isValid = $this->validateType($value, $tp);
  48448. }
  48449. }
  48450. }
  48451. }
  48452. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48453. {
  48454. if ($listEnd === false || !isset($elements[1])) {
  48455. return implode($delimiter, $elements);
  48456. }
  48457. $lastElement = array_slice($elements, -1);
  48458. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48459. $implodedElements = array_merge(array($firsElements), $lastElement);
  48460. return join(" $listEnd ", $implodedElements);
  48461. }
  48462. protected function validateTypeNameWording($type)
  48463. {
  48464. if (!isset(self::$wording[$type])) {
  48465. throw new StandardUnexpectedValueException(
  48466. sprintf(
  48467. 'No wording for %s available, expected wordings are: [%s]',
  48468. var_export($type, true),
  48469. implode(', ', array_filter(self::$wording)))
  48470. );
  48471. }
  48472. }
  48473. protected function validateType(&$value, $type)
  48474. {
  48475. if (!$type) {
  48476. return true;
  48477. }
  48478. if ('any' === $type) {
  48479. return true;
  48480. }
  48481. if ('object' === $type) {
  48482. return $this->getTypeCheck()->isObject($value);
  48483. }
  48484. if ('array' === $type) {
  48485. return $this->getTypeCheck()->isArray($value);
  48486. }
  48487. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48488. if ('integer' === $type) {
  48489. if ($coerce) {
  48490. $value = $this->toInteger($value);
  48491. }
  48492. return is_int($value);
  48493. }
  48494. if ('number' === $type) {
  48495. if ($coerce) {
  48496. $value = $this->toNumber($value);
  48497. }
  48498. return is_numeric($value) && !is_string($value);
  48499. }
  48500. if ('boolean' === $type) {
  48501. if ($coerce) {
  48502. $value = $this->toBoolean($value);
  48503. }
  48504. return is_bool($value);
  48505. }
  48506. if ('string' === $type) {
  48507. return is_string($value);
  48508. }
  48509. if ('email' === $type) {
  48510. return is_string($value);
  48511. }
  48512. if ('null' === $type) {
  48513. return is_null($value);
  48514. }
  48515. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  48516. }
  48517. protected function toBoolean($value)
  48518. {
  48519. if ($value === 'true') {
  48520. return true;
  48521. }
  48522. if ($value === 'false') {
  48523. return false;
  48524. }
  48525. return $value;
  48526. }
  48527. protected function toNumber($value)
  48528. {
  48529. if (is_numeric($value)) {
  48530. return $value + 0;
  48531. }
  48532. return $value;
  48533. }
  48534. protected function toInteger($value)
  48535. {
  48536. if (is_numeric($value) && (int) $value == $value) {
  48537. return (int) $value;
  48538. }
  48539. return $value;
  48540. }
  48541. }
  48542. <?php
  48543. namespace JsonSchema\Constraints;
  48544. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  48545. use JsonSchema\Entity\JsonPointer;
  48546. use JsonSchema\Exception\ValidationException;
  48547. use JsonSchema\Uri\UriResolver;
  48548. class UndefinedConstraint extends Constraint
  48549. {
  48550. protected $appliedDefaults = array();
  48551. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48552. {
  48553. if (is_null($schema) || !is_object($schema)) {
  48554. return;
  48555. }
  48556. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  48557. if ($fromDefault) {
  48558. $path->setFromDefault();
  48559. }
  48560. $this->validateCommonProperties($value, $schema, $path, $i);
  48561. $this->validateOfProperties($value, $schema, $path, '');
  48562. $this->validateTypes($value, $schema, $path, $i);
  48563. }
  48564. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  48565. {
  48566. if ($this->getTypeCheck()->isArray($value)) {
  48567. $this->checkArray($value, $schema, $path, $i);
  48568. }
  48569. if (LooseTypeCheck::isObject($value)) {
  48570. $this->checkObject(
  48571. $value,
  48572. $schema,
  48573. $path,
  48574. isset($schema->properties) ? $schema->properties : null,
  48575. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  48576. isset($schema->patternProperties) ? $schema->patternProperties : null,
  48577. $this->appliedDefaults
  48578. );
  48579. }
  48580. if (is_string($value)) {
  48581. $this->checkString($value, $schema, $path, $i);
  48582. }
  48583. if (is_numeric($value)) {
  48584. $this->checkNumber($value, $schema, $path, $i);
  48585. }
  48586. if (isset($schema->enum)) {
  48587. $this->checkEnum($value, $schema, $path, $i);
  48588. }
  48589. }
  48590. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  48591. {
  48592. if (isset($schema->extends)) {
  48593. if (is_string($schema->extends)) {
  48594. $schema->extends = $this->validateUri($schema, $schema->extends);
  48595. }
  48596. if (is_array($schema->extends)) {
  48597. foreach ($schema->extends as $extends) {
  48598. $this->checkUndefined($value, $extends, $path, $i);
  48599. }
  48600. } else {
  48601. $this->checkUndefined($value, $schema->extends, $path, $i);
  48602. }
  48603. }
  48604. if (!$path->fromDefault()) {
  48605. $this->applyDefaultValues($value, $schema, $path);
  48606. }
  48607. if ($this->getTypeCheck()->isObject($value)) {
  48608. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  48609. foreach ($schema->required as $required) {
  48610. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  48611. $this->addError(
  48612. $this->incrementPath($path ?: new JsonPointer(''), $required),
  48613. 'The property ' . $required . ' is required',
  48614. 'required'
  48615. );
  48616. }
  48617. }
  48618. } elseif (isset($schema->required) && !is_array($schema->required)) {
  48619. if ($schema->required && $value instanceof self) {
  48620. $propertyPaths = $path->getPropertyPaths();
  48621. $propertyName = end($propertyPaths);
  48622. $this->addError(
  48623. $path,
  48624. 'The property ' . $propertyName . ' is required',
  48625. 'required'
  48626. );
  48627. }
  48628. }
  48629. }
  48630. if (!($value instanceof self)) {
  48631. $this->checkType($value, $schema, $path, $i);
  48632. }
  48633. if (isset($schema->disallow)) {
  48634. $initErrors = $this->getErrors();
  48635. $typeSchema = new \stdClass();
  48636. $typeSchema->type = $schema->disallow;
  48637. $this->checkType($value, $typeSchema, $path);
  48638. if (count($this->getErrors()) == count($initErrors)) {
  48639. $this->addError($path, 'Disallowed value was matched', 'disallow');
  48640. } else {
  48641. $this->errors = $initErrors;
  48642. }
  48643. }
  48644. if (isset($schema->not)) {
  48645. $initErrors = $this->getErrors();
  48646. $this->checkUndefined($value, $schema->not, $path, $i);
  48647. if (count($this->getErrors()) == count($initErrors)) {
  48648. $this->addError($path, 'Matched a schema which it should not', 'not');
  48649. } else {
  48650. $this->errors = $initErrors;
  48651. }
  48652. }
  48653. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  48654. $this->validateDependencies($value, $schema->dependencies, $path);
  48655. }
  48656. }
  48657. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  48658. {
  48659. if (!$requiredOnly) {
  48660. return true;
  48661. }
  48662. if (
  48663. $name !== null
  48664. && isset($parentSchema->required)
  48665. && is_array($parentSchema->required)
  48666. && in_array($name, $parentSchema->required)
  48667. ) {
  48668. return true;
  48669. }
  48670. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  48671. return true;
  48672. }
  48673. return false;
  48674. }
  48675. protected function applyDefaultValues(&$value, $schema, $path)
  48676. {
  48677. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  48678. return;
  48679. }
  48680. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  48681. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  48682. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  48683. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  48684. if (
  48685. !LooseTypeCheck::propertyExists($value, $currentProperty)
  48686. && property_exists($propertyDefinition, 'default')
  48687. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  48688. ) {
  48689. if (is_object($propertyDefinition->default)) {
  48690. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  48691. } else {
  48692. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  48693. }
  48694. $this->appliedDefaults[] = $currentProperty;
  48695. }
  48696. }
  48697. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  48698. $items = array();
  48699. if (LooseTypeCheck::isArray($schema->items)) {
  48700. $items = $schema->items;
  48701. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  48702. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  48703. }
  48704. foreach ($items as $currentItem => $itemDefinition) {
  48705. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  48706. if (
  48707. !array_key_exists($currentItem, $value)
  48708. && property_exists($itemDefinition, 'default')
  48709. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  48710. if (is_object($itemDefinition->default)) {
  48711. $value[$currentItem] = clone $itemDefinition->default;
  48712. } else {
  48713. $value[$currentItem] = $itemDefinition->default;
  48714. }
  48715. }
  48716. $path->setFromDefault();
  48717. }
  48718. } elseif (
  48719. $value instanceof self
  48720. && property_exists($schema, 'default')
  48721. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  48722. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  48723. $path->setFromDefault();
  48724. }
  48725. }
  48726. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  48727. {
  48728. if ($value instanceof self) {
  48729. return;
  48730. }
  48731. if (isset($schema->allOf)) {
  48732. $isValid = true;
  48733. foreach ($schema->allOf as $allOf) {
  48734. $initErrors = $this->getErrors();
  48735. $this->checkUndefined($value, $allOf, $path, $i);
  48736. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  48737. }
  48738. if (!$isValid) {
  48739. $this->addError($path, 'Failed to match all schemas', 'allOf');
  48740. }
  48741. }
  48742. if (isset($schema->anyOf)) {
  48743. $isValid = false;
  48744. $startErrors = $this->getErrors();
  48745. $caughtException = null;
  48746. foreach ($schema->anyOf as $anyOf) {
  48747. $initErrors = $this->getErrors();
  48748. try {
  48749. $this->checkUndefined($value, $anyOf, $path, $i);
  48750. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  48751. break;
  48752. }
  48753. } catch (ValidationException $e) {
  48754. $isValid = false;
  48755. }
  48756. }
  48757. if (!$isValid) {
  48758. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  48759. } else {
  48760. $this->errors = $startErrors;
  48761. }
  48762. }
  48763. if (isset($schema->oneOf)) {
  48764. $allErrors = array();
  48765. $matchedSchemas = 0;
  48766. $startErrors = $this->getErrors();
  48767. foreach ($schema->oneOf as $oneOf) {
  48768. try {
  48769. $this->errors = array();
  48770. $this->checkUndefined($value, $oneOf, $path, $i);
  48771. if (count($this->getErrors()) == 0) {
  48772. $matchedSchemas++;
  48773. }
  48774. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  48775. } catch (ValidationException $e) {
  48776. }
  48777. }
  48778. if ($matchedSchemas !== 1) {
  48779. $this->addErrors(array_merge($allErrors, $startErrors));
  48780. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  48781. } else {
  48782. $this->errors = $startErrors;
  48783. }
  48784. }
  48785. }
  48786. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  48787. {
  48788. foreach ($dependencies as $key => $dependency) {
  48789. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  48790. if (is_string($dependency)) {
  48791. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  48792. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  48793. }
  48794. } elseif (is_array($dependency)) {
  48795. foreach ($dependency as $d) {
  48796. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  48797. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  48798. }
  48799. }
  48800. } elseif (is_object($dependency)) {
  48801. $this->checkUndefined($value, $dependency, $path, $i);
  48802. }
  48803. }
  48804. }
  48805. }
  48806. protected function validateUri($schema, $schemaUri = null)
  48807. {
  48808. $resolver = new UriResolver();
  48809. $retriever = $this->factory->getUriRetriever();
  48810. $jsonSchema = null;
  48811. if ($resolver->isValid($schemaUri)) {
  48812. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  48813. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  48814. }
  48815. return $jsonSchema;
  48816. }
  48817. }
  48818. <?php
  48819. namespace JsonSchema\Entity;
  48820. use JsonSchema\Exception\InvalidArgumentException;
  48821. class JsonPointer
  48822. {
  48823. private $filename;
  48824. private $propertyPaths = array();
  48825. private $fromDefault = false;
  48826. public function __construct($value)
  48827. {
  48828. if (!is_string($value)) {
  48829. throw new InvalidArgumentException('Ref value must be a string');
  48830. }
  48831. $splitRef = explode('#', $value, 2);
  48832. $this->filename = $splitRef[0];
  48833. if (array_key_exists(1, $splitRef)) {
  48834. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  48835. }
  48836. }
  48837. private function decodePropertyPaths($propertyPathString)
  48838. {
  48839. $paths = array();
  48840. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  48841. $path = $this->decodePath($path);
  48842. if (is_string($path) && '' !== $path) {
  48843. $paths[] = $path;
  48844. }
  48845. }
  48846. return $paths;
  48847. }
  48848. private function encodePropertyPaths()
  48849. {
  48850. return array_map(
  48851. array($this, 'encodePath'),
  48852. $this->getPropertyPaths()
  48853. );
  48854. }
  48855. private function decodePath($path)
  48856. {
  48857. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  48858. }
  48859. private function encodePath($path)
  48860. {
  48861. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  48862. }
  48863. public function getFilename()
  48864. {
  48865. return $this->filename;
  48866. }
  48867. public function getPropertyPaths()
  48868. {
  48869. return $this->propertyPaths;
  48870. }
  48871. public function withPropertyPaths(array $propertyPaths)
  48872. {
  48873. $new = clone $this;
  48874. $new->propertyPaths = $propertyPaths;
  48875. return $new;
  48876. }
  48877. public function getPropertyPathAsString()
  48878. {
  48879. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  48880. }
  48881. public function __toString()
  48882. {
  48883. return $this->getFilename() . $this->getPropertyPathAsString();
  48884. }
  48885. public function setFromDefault()
  48886. {
  48887. $this->fromDefault = true;
  48888. }
  48889. public function fromDefault()
  48890. {
  48891. return $this->fromDefault;
  48892. }
  48893. }
  48894. <?php
  48895. namespace JsonSchema\Exception;
  48896. interface ExceptionInterface
  48897. {
  48898. }
  48899. <?php
  48900. namespace JsonSchema\Exception;
  48901. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48902. {
  48903. }
  48904. <?php
  48905. namespace JsonSchema\Exception;
  48906. class InvalidConfigException extends RuntimeException
  48907. {
  48908. }
  48909. <?php
  48910. namespace JsonSchema\Exception;
  48911. class InvalidSchemaException extends RuntimeException
  48912. {
  48913. }
  48914. <?php
  48915. namespace JsonSchema\Exception;
  48916. class InvalidSchemaMediaTypeException extends RuntimeException
  48917. {
  48918. }
  48919. <?php
  48920. namespace JsonSchema\Exception;
  48921. class InvalidSourceUriException extends InvalidArgumentException
  48922. {
  48923. }
  48924. <?php
  48925. namespace JsonSchema\Exception;
  48926. class JsonDecodingException extends RuntimeException
  48927. {
  48928. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  48929. {
  48930. switch ($code) {
  48931. case JSON_ERROR_DEPTH:
  48932. $message = 'The maximum stack depth has been exceeded';
  48933. break;
  48934. case JSON_ERROR_STATE_MISMATCH:
  48935. $message = 'Invalid or malformed JSON';
  48936. break;
  48937. case JSON_ERROR_CTRL_CHAR:
  48938. $message = 'Control character error, possibly incorrectly encoded';
  48939. break;
  48940. case JSON_ERROR_UTF8:
  48941. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  48942. break;
  48943. case JSON_ERROR_SYNTAX:
  48944. $message = 'JSON syntax is malformed';
  48945. break;
  48946. default:
  48947. $message = 'Syntax error';
  48948. }
  48949. parent::__construct($message, $code, $previous);
  48950. }
  48951. }
  48952. <?php
  48953. namespace JsonSchema\Exception;
  48954. class ResourceNotFoundException extends RuntimeException
  48955. {
  48956. }
  48957. <?php
  48958. namespace JsonSchema\Exception;
  48959. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48960. {
  48961. }
  48962. <?php
  48963. namespace JsonSchema\Exception;
  48964. class UnresolvableJsonPointerException extends InvalidArgumentException
  48965. {
  48966. }
  48967. <?php
  48968. namespace JsonSchema\Exception;
  48969. class UriResolverException extends RuntimeException
  48970. {
  48971. }
  48972. <?php
  48973. namespace JsonSchema\Exception;
  48974. class ValidationException extends RuntimeException
  48975. {
  48976. }
  48977. <?php
  48978. namespace JsonSchema\Iterator;
  48979. class ObjectIterator implements \Iterator, \Countable
  48980. {
  48981. private $object;
  48982. private $position = 0;
  48983. private $data = array();
  48984. private $initialized = false;
  48985. public function __construct($object)
  48986. {
  48987. $this->object = $object;
  48988. }
  48989. public function current()
  48990. {
  48991. $this->initialize();
  48992. return $this->data[$this->position];
  48993. }
  48994. public function next()
  48995. {
  48996. $this->initialize();
  48997. $this->position++;
  48998. }
  48999. public function key()
  49000. {
  49001. $this->initialize();
  49002. return $this->position;
  49003. }
  49004. public function valid()
  49005. {
  49006. $this->initialize();
  49007. return isset($this->data[$this->position]);
  49008. }
  49009. public function rewind()
  49010. {
  49011. $this->initialize();
  49012. $this->position = 0;
  49013. }
  49014. public function count()
  49015. {
  49016. $this->initialize();
  49017. return count($this->data);
  49018. }
  49019. private function initialize()
  49020. {
  49021. if (!$this->initialized) {
  49022. $this->data = $this->buildDataFromObject($this->object);
  49023. $this->initialized = true;
  49024. }
  49025. }
  49026. private function buildDataFromObject($object)
  49027. {
  49028. $result = array();
  49029. $stack = new \SplStack();
  49030. $stack->push($object);
  49031. while (!$stack->isEmpty()) {
  49032. $current = $stack->pop();
  49033. if (is_object($current)) {
  49034. array_push($result, $current);
  49035. }
  49036. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49037. if (is_object($propertyValue) || is_array($propertyValue)) {
  49038. $stack->push($propertyValue);
  49039. }
  49040. }
  49041. }
  49042. return $result;
  49043. }
  49044. private function getDataFromItem($item)
  49045. {
  49046. if (!is_object($item) && !is_array($item)) {
  49047. return array();
  49048. }
  49049. return is_object($item) ? get_object_vars($item) : $item;
  49050. }
  49051. }
  49052. <?php
  49053. namespace JsonSchema;
  49054. class Rfc3339
  49055. {
  49056. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49057. public static function createFromString($string)
  49058. {
  49059. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49060. return null;
  49061. }
  49062. $dateAndTime = $matches[1];
  49063. $microseconds = $matches[2] ?: '.000000';
  49064. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49065. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49066. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49067. return $dateTime ?: null;
  49068. }
  49069. }
  49070. <?php
  49071. namespace JsonSchema;
  49072. use JsonSchema\Constraints\BaseConstraint;
  49073. use JsonSchema\Entity\JsonPointer;
  49074. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49075. use JsonSchema\Uri\UriResolver;
  49076. use JsonSchema\Uri\UriRetriever;
  49077. class SchemaStorage implements SchemaStorageInterface
  49078. {
  49079. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49080. protected $uriRetriever;
  49081. protected $uriResolver;
  49082. protected $schemas = array();
  49083. public function __construct(
  49084. UriRetrieverInterface $uriRetriever = null,
  49085. UriResolverInterface $uriResolver = null
  49086. ) {
  49087. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49088. $this->uriResolver = $uriResolver ?: new UriResolver();
  49089. }
  49090. public function getUriRetriever()
  49091. {
  49092. return $this->uriRetriever;
  49093. }
  49094. public function getUriResolver()
  49095. {
  49096. return $this->uriResolver;
  49097. }
  49098. public function addSchema($id, $schema = null)
  49099. {
  49100. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49101. $schema = $this->uriRetriever->retrieve($id);
  49102. }
  49103. if (is_array($schema)) {
  49104. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49105. }
  49106. if (is_object($schema) && property_exists($schema, 'id')) {
  49107. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49108. $schema->properties->id->format = 'uri-reference';
  49109. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49110. $schema->properties->id->format = 'uri-reference';
  49111. $schema->properties->{'$ref'}->format = 'uri-reference';
  49112. }
  49113. }
  49114. $this->expandRefs($schema, $id);
  49115. $this->schemas[$id] = $schema;
  49116. }
  49117. private function expandRefs(&$schema, $base = null)
  49118. {
  49119. if (!is_object($schema)) {
  49120. if (is_array($schema)) {
  49121. foreach ($schema as &$member) {
  49122. $this->expandRefs($member, $base);
  49123. }
  49124. }
  49125. return;
  49126. }
  49127. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49128. $base = $this->uriResolver->resolve($schema->id, $base);
  49129. }
  49130. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49131. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49132. $schema->{'$ref'} = (string) $refPointer;
  49133. }
  49134. foreach ($schema as &$member) {
  49135. $this->expandRefs($member, $base);
  49136. }
  49137. }
  49138. public function getSchema($id)
  49139. {
  49140. if (!array_key_exists($id, $this->schemas)) {
  49141. $this->addSchema($id);
  49142. }
  49143. return $this->schemas[$id];
  49144. }
  49145. public function resolveRef($ref)
  49146. {
  49147. $jsonPointer = new JsonPointer($ref);
  49148. $fileName = $jsonPointer->getFilename();
  49149. if (!strlen($fileName)) {
  49150. throw new UnresolvableJsonPointerException(sprintf(
  49151. "Could not resolve fragment '%s': no file is defined",
  49152. $jsonPointer->getPropertyPathAsString()
  49153. ));
  49154. }
  49155. $refSchema = $this->getSchema($fileName);
  49156. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49157. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49158. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49159. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49160. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49161. } else {
  49162. throw new UnresolvableJsonPointerException(sprintf(
  49163. 'File: %s is found, but could not resolve fragment: %s',
  49164. $jsonPointer->getFilename(),
  49165. $jsonPointer->getPropertyPathAsString()
  49166. ));
  49167. }
  49168. }
  49169. return $refSchema;
  49170. }
  49171. public function resolveRefSchema($refSchema)
  49172. {
  49173. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49174. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49175. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49176. unset($refSchema->{'$ref'});
  49177. }
  49178. return $refSchema;
  49179. }
  49180. }
  49181. <?php
  49182. namespace JsonSchema;
  49183. interface SchemaStorageInterface
  49184. {
  49185. public function addSchema($id, $schema = null);
  49186. public function getSchema($id);
  49187. public function resolveRef($ref);
  49188. public function resolveRefSchema($refSchema);
  49189. }
  49190. <?php
  49191. namespace JsonSchema\Uri\Retrievers;
  49192. abstract class AbstractRetriever implements UriRetrieverInterface
  49193. {
  49194. protected $contentType;
  49195. public function getContentType()
  49196. {
  49197. return $this->contentType;
  49198. }
  49199. }
  49200. <?php
  49201. namespace JsonSchema\Uri\Retrievers;
  49202. use JsonSchema\Exception\RuntimeException;
  49203. use JsonSchema\Validator;
  49204. class Curl extends AbstractRetriever
  49205. {
  49206. protected $messageBody;
  49207. public function __construct()
  49208. {
  49209. if (!function_exists('curl_init')) {
  49210. throw new RuntimeException('cURL not installed');
  49211. }
  49212. }
  49213. public function retrieve($uri)
  49214. {
  49215. $ch = curl_init();
  49216. curl_setopt($ch, CURLOPT_URL, $uri);
  49217. curl_setopt($ch, CURLOPT_HEADER, true);
  49218. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49219. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49220. $response = curl_exec($ch);
  49221. if (false === $response) {
  49222. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49223. }
  49224. $this->fetchMessageBody($response);
  49225. $this->fetchContentType($response);
  49226. curl_close($ch);
  49227. return $this->messageBody;
  49228. }
  49229. private function fetchMessageBody($response)
  49230. {
  49231. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49232. $this->messageBody = $match[1];
  49233. }
  49234. protected function fetchContentType($response)
  49235. {
  49236. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49237. $this->contentType = trim($match[1]);
  49238. return true;
  49239. }
  49240. return false;
  49241. }
  49242. }
  49243. <?php
  49244. namespace JsonSchema\Uri\Retrievers;
  49245. use JsonSchema\Exception\ResourceNotFoundException;
  49246. class FileGetContents extends AbstractRetriever
  49247. {
  49248. protected $messageBody;
  49249. public function retrieve($uri)
  49250. {
  49251. $errorMessage = null;
  49252. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49253. $errorMessage = $errstr;
  49254. });
  49255. $response = file_get_contents($uri);
  49256. restore_error_handler();
  49257. if ($errorMessage) {
  49258. throw new ResourceNotFoundException($errorMessage);
  49259. }
  49260. if (false === $response) {
  49261. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49262. }
  49263. if ($response == ''
  49264. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49265. ) {
  49266. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49267. }
  49268. $this->messageBody = $response;
  49269. if (!empty($http_response_header)) {
  49270. $this->fetchContentType($http_response_header);
  49271. } else {
  49272. $this->contentType = null;
  49273. }
  49274. return $this->messageBody;
  49275. }
  49276. private function fetchContentType(array $headers)
  49277. {
  49278. foreach ($headers as $header) {
  49279. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49280. return true;
  49281. }
  49282. }
  49283. return false;
  49284. }
  49285. protected static function getContentTypeMatchInHeader($header)
  49286. {
  49287. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49288. return trim($match[1]);
  49289. }
  49290. return null;
  49291. }
  49292. }
  49293. <?php
  49294. namespace JsonSchema\Uri\Retrievers;
  49295. use JsonSchema\Validator;
  49296. class PredefinedArray extends AbstractRetriever
  49297. {
  49298. private $schemas;
  49299. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49300. {
  49301. $this->schemas = $schemas;
  49302. $this->contentType = $contentType;
  49303. }
  49304. public function retrieve($uri)
  49305. {
  49306. if (!array_key_exists($uri, $this->schemas)) {
  49307. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49308. 'The JSON schema "%s" was not found.',
  49309. $uri
  49310. ));
  49311. }
  49312. return $this->schemas[$uri];
  49313. }
  49314. }
  49315. <?php
  49316. namespace JsonSchema\Uri\Retrievers;
  49317. interface UriRetrieverInterface
  49318. {
  49319. public function retrieve($uri);
  49320. public function getContentType();
  49321. }
  49322. <?php
  49323. namespace JsonSchema\Uri;
  49324. use JsonSchema\Exception\UriResolverException;
  49325. use JsonSchema\UriResolverInterface;
  49326. class UriResolver implements UriResolverInterface
  49327. {
  49328. public function parse($uri)
  49329. {
  49330. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49331. $components = array();
  49332. if (5 < count($match)) {
  49333. $components = array(
  49334. 'scheme' => $match[2],
  49335. 'authority' => $match[4],
  49336. 'path' => $match[5]
  49337. );
  49338. }
  49339. if (7 < count($match)) {
  49340. $components['query'] = $match[7];
  49341. }
  49342. if (9 < count($match)) {
  49343. $components['fragment'] = $match[9];
  49344. }
  49345. return $components;
  49346. }
  49347. public function generate(array $components)
  49348. {
  49349. $uri = $components['scheme'] . '://'
  49350. . $components['authority']
  49351. . $components['path'];
  49352. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49353. $uri .= '?' . $components['query'];
  49354. }
  49355. if (array_key_exists('fragment', $components)) {
  49356. $uri .= '#' . $components['fragment'];
  49357. }
  49358. return $uri;
  49359. }
  49360. public function resolve($uri, $baseUri = null)
  49361. {
  49362. if (
  49363. !is_null($baseUri) &&
  49364. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49365. !preg_match('|^[^/]+://|u', $baseUri)
  49366. ) {
  49367. if (is_file($baseUri)) {
  49368. $baseUri = 'file://' . realpath($baseUri);
  49369. } elseif (is_dir($baseUri)) {
  49370. $baseUri = 'file://' . realpath($baseUri) . '/';
  49371. } else {
  49372. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49373. }
  49374. }
  49375. if ($uri == '') {
  49376. return $baseUri;
  49377. }
  49378. $components = $this->parse($uri);
  49379. $path = $components['path'];
  49380. if (!empty($components['scheme'])) {
  49381. return $uri;
  49382. }
  49383. $baseComponents = $this->parse($baseUri);
  49384. $basePath = $baseComponents['path'];
  49385. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49386. if (isset($components['fragment'])) {
  49387. $baseComponents['fragment'] = $components['fragment'];
  49388. }
  49389. return $this->generate($baseComponents);
  49390. }
  49391. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49392. {
  49393. $relativePath = self::normalizePath($relativePath);
  49394. if ($relativePath == '') {
  49395. return $basePath;
  49396. }
  49397. if ($relativePath[0] == '/') {
  49398. return $relativePath;
  49399. }
  49400. $basePathSegments = explode('/', $basePath);
  49401. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49402. $numLevelUp = strlen($match[0]) /3 + 1;
  49403. if ($numLevelUp >= count($basePathSegments)) {
  49404. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49405. }
  49406. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49407. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49408. return implode('/', $basePathSegments) . '/' . $path;
  49409. }
  49410. private static function normalizePath($path)
  49411. {
  49412. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49413. $path = preg_replace('|//|', '/', $path);
  49414. return $path;
  49415. }
  49416. public function isValid($uri)
  49417. {
  49418. $components = $this->parse($uri);
  49419. return !empty($components);
  49420. }
  49421. }
  49422. <?php
  49423. namespace JsonSchema\Uri;
  49424. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49425. use JsonSchema\Exception\JsonDecodingException;
  49426. use JsonSchema\Exception\ResourceNotFoundException;
  49427. use JsonSchema\Uri\Retrievers\FileGetContents;
  49428. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49429. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49430. use JsonSchema\Validator;
  49431. class UriRetriever implements BaseUriRetrieverInterface
  49432. {
  49433. protected $translationMap = array(
  49434. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49435. );
  49436. protected $uriRetriever = null;
  49437. private $schemaCache = array();
  49438. public function confirmMediaType($uriRetriever, $uri)
  49439. {
  49440. $contentType = $uriRetriever->getContentType();
  49441. if (is_null($contentType)) {
  49442. return;
  49443. }
  49444. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49445. return;
  49446. }
  49447. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  49448. return true;
  49449. }
  49450. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49451. }
  49452. public function getUriRetriever()
  49453. {
  49454. if (is_null($this->uriRetriever)) {
  49455. $this->setUriRetriever(new FileGetContents());
  49456. }
  49457. return $this->uriRetriever;
  49458. }
  49459. public function resolvePointer($jsonSchema, $uri)
  49460. {
  49461. $resolver = new UriResolver();
  49462. $parsed = $resolver->parse($uri);
  49463. if (empty($parsed['fragment'])) {
  49464. return $jsonSchema;
  49465. }
  49466. $path = explode('/', $parsed['fragment']);
  49467. while ($path) {
  49468. $pathElement = array_shift($path);
  49469. if (!empty($pathElement)) {
  49470. $pathElement = str_replace('~1', '/', $pathElement);
  49471. $pathElement = str_replace('~0', '~', $pathElement);
  49472. if (!empty($jsonSchema->$pathElement)) {
  49473. $jsonSchema = $jsonSchema->$pathElement;
  49474. } else {
  49475. throw new ResourceNotFoundException(
  49476. 'Fragment "' . $parsed['fragment'] . '" not found'
  49477. . ' in ' . $uri
  49478. );
  49479. }
  49480. if (!is_object($jsonSchema)) {
  49481. throw new ResourceNotFoundException(
  49482. 'Fragment part "' . $pathElement . '" is no object '
  49483. . ' in ' . $uri
  49484. );
  49485. }
  49486. }
  49487. }
  49488. return $jsonSchema;
  49489. }
  49490. public function retrieve($uri, $baseUri = null, $translate = true)
  49491. {
  49492. $resolver = new UriResolver();
  49493. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49494. $arParts = $resolver->parse($resolvedUri);
  49495. if (isset($arParts['fragment'])) {
  49496. unset($arParts['fragment']);
  49497. $fetchUri = $resolver->generate($arParts);
  49498. }
  49499. if ($translate) {
  49500. $fetchUri = $this->translate($fetchUri);
  49501. }
  49502. $jsonSchema = $this->loadSchema($fetchUri);
  49503. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  49504. if ($jsonSchema instanceof \stdClass) {
  49505. $jsonSchema->id = $resolvedUri;
  49506. }
  49507. return $jsonSchema;
  49508. }
  49509. protected function loadSchema($fetchUri)
  49510. {
  49511. if (isset($this->schemaCache[$fetchUri])) {
  49512. return $this->schemaCache[$fetchUri];
  49513. }
  49514. $uriRetriever = $this->getUriRetriever();
  49515. $contents = $this->uriRetriever->retrieve($fetchUri);
  49516. $this->confirmMediaType($uriRetriever, $fetchUri);
  49517. $jsonSchema = json_decode($contents);
  49518. if (JSON_ERROR_NONE < $error = json_last_error()) {
  49519. throw new JsonDecodingException($error);
  49520. }
  49521. $this->schemaCache[$fetchUri] = $jsonSchema;
  49522. return $jsonSchema;
  49523. }
  49524. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  49525. {
  49526. $this->uriRetriever = $uriRetriever;
  49527. return $this;
  49528. }
  49529. public function parse($uri)
  49530. {
  49531. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49532. $components = array();
  49533. if (5 < count($match)) {
  49534. $components = array(
  49535. 'scheme' => $match[2],
  49536. 'authority' => $match[4],
  49537. 'path' => $match[5]
  49538. );
  49539. }
  49540. if (7 < count($match)) {
  49541. $components['query'] = $match[7];
  49542. }
  49543. if (9 < count($match)) {
  49544. $components['fragment'] = $match[9];
  49545. }
  49546. return $components;
  49547. }
  49548. public function generate(array $components)
  49549. {
  49550. $uri = $components['scheme'] . '://'
  49551. . $components['authority']
  49552. . $components['path'];
  49553. if (array_key_exists('query', $components)) {
  49554. $uri .= $components['query'];
  49555. }
  49556. if (array_key_exists('fragment', $components)) {
  49557. $uri .= $components['fragment'];
  49558. }
  49559. return $uri;
  49560. }
  49561. public function resolve($uri, $baseUri = null)
  49562. {
  49563. $components = $this->parse($uri);
  49564. $path = $components['path'];
  49565. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  49566. return $uri;
  49567. }
  49568. $baseComponents = $this->parse($baseUri);
  49569. $basePath = $baseComponents['path'];
  49570. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  49571. return $this->generate($baseComponents);
  49572. }
  49573. public function isValid($uri)
  49574. {
  49575. $components = $this->parse($uri);
  49576. return !empty($components);
  49577. }
  49578. public function setTranslation($from, $to)
  49579. {
  49580. $this->translationMap[$from] = $to;
  49581. }
  49582. public function translate($uri)
  49583. {
  49584. foreach ($this->translationMap as $from => $to) {
  49585. $uri = preg_replace($from, $to, $uri);
  49586. }
  49587. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  49588. return $uri;
  49589. }
  49590. }
  49591. <?php
  49592. namespace JsonSchema;
  49593. interface UriResolverInterface
  49594. {
  49595. public function resolve($uri, $baseUri = null);
  49596. }
  49597. <?php
  49598. namespace JsonSchema;
  49599. interface UriRetrieverInterface
  49600. {
  49601. public function retrieve($uri, $baseUri = null);
  49602. }
  49603. <?php
  49604. namespace JsonSchema;
  49605. use JsonSchema\Constraints\BaseConstraint;
  49606. use JsonSchema\Constraints\Constraint;
  49607. class Validator extends BaseConstraint
  49608. {
  49609. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  49610. const ERROR_NONE = 0x00000000;
  49611. const ERROR_ALL = 0xFFFFFFFF;
  49612. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  49613. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  49614. public function validate(&$value, $schema = null, $checkMode = null)
  49615. {
  49616. if (is_array($schema)) {
  49617. $schema = self::arrayToObjectRecursive($schema);
  49618. }
  49619. $initialCheckMode = $this->factory->getConfig();
  49620. if ($checkMode !== null) {
  49621. $this->factory->setConfig($checkMode);
  49622. }
  49623. if (is_object($schema) && property_exists($schema, 'id')) {
  49624. $schemaURI = $schema->id;
  49625. } else {
  49626. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  49627. }
  49628. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  49629. $validator = $this->factory->createInstanceFor('schema');
  49630. $validator->check(
  49631. $value,
  49632. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  49633. );
  49634. $this->factory->setConfig($initialCheckMode);
  49635. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  49636. return $validator->getErrorMask();
  49637. }
  49638. public function check($value, $schema)
  49639. {
  49640. return $this->validate($value, $schema);
  49641. }
  49642. public function coerce(&$value, $schema)
  49643. {
  49644. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  49645. }
  49646. }
  49647. Copyright (C) 2015 Composer
  49648. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49649. this software and associated documentation files (the "Software"), to deal in
  49650. the Software without restriction, including without limitation the rights to
  49651. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49652. of the Software, and to permit persons to whom the Software is furnished to do
  49653. so, subject to the following conditions:
  49654. The above copyright notice and this permission notice shall be included in all
  49655. copies or substantial portions of the Software.
  49656. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49657. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49658. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49659. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49660. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49661. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49662. SOFTWARE.
  49663. <?php
  49664. namespace Composer\Spdx;
  49665. class SpdxLicenses
  49666. {
  49667. const LICENSES_FILE = 'spdx-licenses.json';
  49668. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  49669. private $licenses;
  49670. private $licensesExpression;
  49671. private $exceptions;
  49672. private $exceptionsExpression;
  49673. public function __construct()
  49674. {
  49675. $this->loadLicenses();
  49676. $this->loadExceptions();
  49677. }
  49678. public function getLicenseByIdentifier($identifier)
  49679. {
  49680. $key = strtolower($identifier);
  49681. if (!isset($this->licenses[$key])) {
  49682. return;
  49683. }
  49684. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  49685. return array(
  49686. $name,
  49687. $isOsiApproved,
  49688. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  49689. $isDeprecatedLicenseId,
  49690. );
  49691. }
  49692. public function getLicenses()
  49693. {
  49694. return $this->licenses;
  49695. }
  49696. public function getExceptionByIdentifier($identifier)
  49697. {
  49698. $key = strtolower($identifier);
  49699. if (!isset($this->exceptions[$key])) {
  49700. return;
  49701. }
  49702. list($identifier, $name) = $this->exceptions[$key];
  49703. return array(
  49704. $name,
  49705. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  49706. );
  49707. }
  49708. public function getIdentifierByName($name)
  49709. {
  49710. foreach ($this->licenses as $licenseData) {
  49711. if ($licenseData[1] === $name) {
  49712. return $licenseData[0];
  49713. }
  49714. }
  49715. foreach ($this->exceptions as $licenseData) {
  49716. if ($licenseData[1] === $name) {
  49717. return $licenseData[0];
  49718. }
  49719. }
  49720. }
  49721. public function isOsiApprovedByIdentifier($identifier)
  49722. {
  49723. return $this->licenses[strtolower($identifier)][2];
  49724. }
  49725. public function isDeprecatedByIdentifier($identifier)
  49726. {
  49727. return $this->licenses[strtolower($identifier)][3];
  49728. }
  49729. public function validate($license)
  49730. {
  49731. if (is_array($license)) {
  49732. $count = count($license);
  49733. if ($count !== count(array_filter($license, 'is_string'))) {
  49734. throw new \InvalidArgumentException('Array of strings expected.');
  49735. }
  49736. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  49737. }
  49738. if (!is_string($license)) {
  49739. throw new \InvalidArgumentException(sprintf(
  49740. 'Array or String expected, %s given.',
  49741. gettype($license)
  49742. ));
  49743. }
  49744. return $this->isValidLicenseString($license);
  49745. }
  49746. public static function getResourcesDir()
  49747. {
  49748. return dirname(__DIR__) . '/res';
  49749. }
  49750. private function loadLicenses()
  49751. {
  49752. if (null !== $this->licenses) {
  49753. return;
  49754. }
  49755. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  49756. $this->licenses = array();
  49757. foreach (json_decode($json, true) as $identifier => $license) {
  49758. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  49759. }
  49760. }
  49761. private function loadExceptions()
  49762. {
  49763. if (null !== $this->exceptions) {
  49764. return;
  49765. }
  49766. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  49767. $this->exceptions = array();
  49768. foreach (json_decode($json, true) as $identifier => $exception) {
  49769. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  49770. }
  49771. }
  49772. private function getLicensesExpression()
  49773. {
  49774. if (null === $this->licensesExpression) {
  49775. $licenses = array_map('preg_quote', array_keys($this->licenses));
  49776. rsort($licenses);
  49777. $licenses = implode('|', $licenses);
  49778. $this->licensesExpression = $licenses;
  49779. }
  49780. return $this->licensesExpression;
  49781. }
  49782. private function getExceptionsExpression()
  49783. {
  49784. if (null === $this->exceptionsExpression) {
  49785. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  49786. rsort($exceptions);
  49787. $exceptions = implode('|', $exceptions);
  49788. $this->exceptionsExpression = $exceptions;
  49789. }
  49790. return $this->exceptionsExpression;
  49791. }
  49792. private function isValidLicenseString($license)
  49793. {
  49794. if (isset($this->licenses[strtolower($license)])) {
  49795. return true;
  49796. }
  49797. $licenses = $this->getLicensesExpression();
  49798. $exceptions = $this->getExceptionsExpression();
  49799. $regex = <<<REGEX
  49800. {
  49801. (?(DEFINE)
  49802. # idstring: 1*( ALPHA / DIGIT / - / . )
  49803. (?<idstring>[\pL\pN.-]{1,})
  49804. # license-id: taken from list
  49805. (?<licenseid>${licenses})
  49806. # license-exception-id: taken from list
  49807. (?<licenseexceptionid>${exceptions})
  49808. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  49809. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  49810. # simple-expresssion: license-id / license-id+ / license-ref
  49811. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  49812. # compound-expression: 1*(
  49813. # simple-expression /
  49814. # simple-expression WITH license-exception-id /
  49815. # compound-expression AND compound-expression /
  49816. # compound-expression OR compound-expression
  49817. # ) / ( compound-expression ) )
  49818. (?<compound_head>
  49819. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  49820. | \( \s* (?&compound_expression) \s* \)
  49821. )
  49822. (?<compound_expression>
  49823. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  49824. )
  49825. # license-expression: 1*1(simple-expression / compound-expression)
  49826. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  49827. ) # end of define
  49828. ^(NONE | NOASSERTION | (?&license_expression))$
  49829. }xi
  49830. REGEX;
  49831. $match = preg_match($regex, $license);
  49832. if (0 === $match) {
  49833. return false;
  49834. }
  49835. if (false === $match) {
  49836. throw new \RuntimeException('Regex failed to compile/run.');
  49837. }
  49838. return true;
  49839. }
  49840. }
  49841. Copyright (C) 2015 Composer
  49842. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49843. this software and associated documentation files (the "Software"), to deal in
  49844. the Software without restriction, including without limitation the rights to
  49845. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49846. of the Software, and to permit persons to whom the Software is furnished to do
  49847. so, subject to the following conditions:
  49848. The above copyright notice and this permission notice shall be included in all
  49849. copies or substantial portions of the Software.
  49850. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49851. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49852. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49853. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49854. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49855. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49856. SOFTWARE.
  49857. <?php
  49858. namespace Composer\Semver;
  49859. use Composer\Semver\Constraint\Constraint;
  49860. class Comparator
  49861. {
  49862. public static function greaterThan($version1, $version2)
  49863. {
  49864. return self::compare($version1, '>', $version2);
  49865. }
  49866. public static function greaterThanOrEqualTo($version1, $version2)
  49867. {
  49868. return self::compare($version1, '>=', $version2);
  49869. }
  49870. public static function lessThan($version1, $version2)
  49871. {
  49872. return self::compare($version1, '<', $version2);
  49873. }
  49874. public static function lessThanOrEqualTo($version1, $version2)
  49875. {
  49876. return self::compare($version1, '<=', $version2);
  49877. }
  49878. public static function equalTo($version1, $version2)
  49879. {
  49880. return self::compare($version1, '==', $version2);
  49881. }
  49882. public static function notEqualTo($version1, $version2)
  49883. {
  49884. return self::compare($version1, '!=', $version2);
  49885. }
  49886. public static function compare($version1, $operator, $version2)
  49887. {
  49888. $constraint = new Constraint($operator, $version2);
  49889. return $constraint->matches(new Constraint('==', $version1));
  49890. }
  49891. }
  49892. <?php
  49893. namespace Composer\Semver\Constraint;
  49894. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  49895. abstract class AbstractConstraint implements ConstraintInterface
  49896. {
  49897. protected $prettyString;
  49898. public function matches(ConstraintInterface $provider)
  49899. {
  49900. if ($provider instanceof $this) {
  49901. return $this->matchSpecific($provider);
  49902. }
  49903. return $provider->matches($this);
  49904. }
  49905. public function setPrettyString($prettyString)
  49906. {
  49907. $this->prettyString = $prettyString;
  49908. }
  49909. public function getPrettyString()
  49910. {
  49911. if ($this->prettyString) {
  49912. return $this->prettyString;
  49913. }
  49914. return $this->__toString();
  49915. }
  49916. }
  49917. <?php
  49918. namespace Composer\Semver\Constraint;
  49919. class Constraint implements ConstraintInterface
  49920. {
  49921. const OP_EQ = 0;
  49922. const OP_LT = 1;
  49923. const OP_LE = 2;
  49924. const OP_GT = 3;
  49925. const OP_GE = 4;
  49926. const OP_NE = 5;
  49927. private static $transOpStr = array(
  49928. '=' => self::OP_EQ,
  49929. '==' => self::OP_EQ,
  49930. '<' => self::OP_LT,
  49931. '<=' => self::OP_LE,
  49932. '>' => self::OP_GT,
  49933. '>=' => self::OP_GE,
  49934. '<>' => self::OP_NE,
  49935. '!=' => self::OP_NE,
  49936. );
  49937. private static $transOpInt = array(
  49938. self::OP_EQ => '==',
  49939. self::OP_LT => '<',
  49940. self::OP_LE => '<=',
  49941. self::OP_GT => '>',
  49942. self::OP_GE => '>=',
  49943. self::OP_NE => '!=',
  49944. );
  49945. protected $operator;
  49946. protected $version;
  49947. protected $prettyString;
  49948. public function matches(ConstraintInterface $provider)
  49949. {
  49950. if ($provider instanceof $this) {
  49951. return $this->matchSpecific($provider);
  49952. }
  49953. return $provider->matches($this);
  49954. }
  49955. public function setPrettyString($prettyString)
  49956. {
  49957. $this->prettyString = $prettyString;
  49958. }
  49959. public function getPrettyString()
  49960. {
  49961. if ($this->prettyString) {
  49962. return $this->prettyString;
  49963. }
  49964. return $this->__toString();
  49965. }
  49966. public static function getSupportedOperators()
  49967. {
  49968. return array_keys(self::$transOpStr);
  49969. }
  49970. public function __construct($operator, $version)
  49971. {
  49972. if (!isset(self::$transOpStr[$operator])) {
  49973. throw new \InvalidArgumentException(sprintf(
  49974. 'Invalid operator "%s" given, expected one of: %s',
  49975. $operator,
  49976. implode(', ', self::getSupportedOperators())
  49977. ));
  49978. }
  49979. $this->operator = self::$transOpStr[$operator];
  49980. $this->version = $version;
  49981. }
  49982. public function versionCompare($a, $b, $operator, $compareBranches = false)
  49983. {
  49984. if (!isset(self::$transOpStr[$operator])) {
  49985. throw new \InvalidArgumentException(sprintf(
  49986. 'Invalid operator "%s" given, expected one of: %s',
  49987. $operator,
  49988. implode(', ', self::getSupportedOperators())
  49989. ));
  49990. }
  49991. $aIsBranch = 'dev-' === substr($a, 0, 4);
  49992. $bIsBranch = 'dev-' === substr($b, 0, 4);
  49993. if ($aIsBranch && $bIsBranch) {
  49994. return $operator === '==' && $a === $b;
  49995. }
  49996. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  49997. return false;
  49998. }
  49999. return version_compare($a, $b, $operator);
  50000. }
  50001. public function matchSpecific(Constraint $provider, $compareBranches = false)
  50002. {
  50003. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  50004. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  50005. $isEqualOp = self::OP_EQ === $this->operator;
  50006. $isNonEqualOp = self::OP_NE === $this->operator;
  50007. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  50008. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  50009. if ($isNonEqualOp || $isProviderNonEqualOp) {
  50010. return !$isEqualOp && !$isProviderEqualOp
  50011. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  50012. }
  50013. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  50014. return true;
  50015. }
  50016. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  50017. if ($provider->version === $this->version
  50018. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  50019. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  50020. return false;
  50021. }
  50022. return true;
  50023. }
  50024. return false;
  50025. }
  50026. public function __toString()
  50027. {
  50028. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  50029. }
  50030. }
  50031. <?php
  50032. namespace Composer\Semver\Constraint;
  50033. interface ConstraintInterface
  50034. {
  50035. public function matches(ConstraintInterface $provider);
  50036. public function getPrettyString();
  50037. public function __toString();
  50038. }
  50039. <?php
  50040. namespace Composer\Semver\Constraint;
  50041. class EmptyConstraint implements ConstraintInterface
  50042. {
  50043. protected $prettyString;
  50044. public function matches(ConstraintInterface $provider)
  50045. {
  50046. return true;
  50047. }
  50048. public function setPrettyString($prettyString)
  50049. {
  50050. $this->prettyString = $prettyString;
  50051. }
  50052. public function getPrettyString()
  50053. {
  50054. if ($this->prettyString) {
  50055. return $this->prettyString;
  50056. }
  50057. return $this->__toString();
  50058. }
  50059. public function __toString()
  50060. {
  50061. return '[]';
  50062. }
  50063. }
  50064. <?php
  50065. namespace Composer\Semver\Constraint;
  50066. class MultiConstraint implements ConstraintInterface
  50067. {
  50068. protected $constraints;
  50069. protected $prettyString;
  50070. protected $conjunctive;
  50071. public function __construct(array $constraints, $conjunctive = true)
  50072. {
  50073. $this->constraints = $constraints;
  50074. $this->conjunctive = $conjunctive;
  50075. }
  50076. public function getConstraints()
  50077. {
  50078. return $this->constraints;
  50079. }
  50080. public function isConjunctive()
  50081. {
  50082. return $this->conjunctive;
  50083. }
  50084. public function isDisjunctive()
  50085. {
  50086. return !$this->conjunctive;
  50087. }
  50088. public function matches(ConstraintInterface $provider)
  50089. {
  50090. if (false === $this->conjunctive) {
  50091. foreach ($this->constraints as $constraint) {
  50092. if ($constraint->matches($provider)) {
  50093. return true;
  50094. }
  50095. }
  50096. return false;
  50097. }
  50098. foreach ($this->constraints as $constraint) {
  50099. if (!$constraint->matches($provider)) {
  50100. return false;
  50101. }
  50102. }
  50103. return true;
  50104. }
  50105. public function setPrettyString($prettyString)
  50106. {
  50107. $this->prettyString = $prettyString;
  50108. }
  50109. public function getPrettyString()
  50110. {
  50111. if ($this->prettyString) {
  50112. return $this->prettyString;
  50113. }
  50114. return $this->__toString();
  50115. }
  50116. public function __toString()
  50117. {
  50118. $constraints = array();
  50119. foreach ($this->constraints as $constraint) {
  50120. $constraints[] = (string) $constraint;
  50121. }
  50122. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50123. }
  50124. }
  50125. <?php
  50126. namespace Composer\Semver;
  50127. use Composer\Semver\Constraint\Constraint;
  50128. class Semver
  50129. {
  50130. const SORT_ASC = 1;
  50131. const SORT_DESC = -1;
  50132. private static $versionParser;
  50133. public static function satisfies($version, $constraints)
  50134. {
  50135. if (null === self::$versionParser) {
  50136. self::$versionParser = new VersionParser();
  50137. }
  50138. $versionParser = self::$versionParser;
  50139. $provider = new Constraint('==', $versionParser->normalize($version));
  50140. $constraints = $versionParser->parseConstraints($constraints);
  50141. return $constraints->matches($provider);
  50142. }
  50143. public static function satisfiedBy(array $versions, $constraints)
  50144. {
  50145. $versions = array_filter($versions, function ($version) use ($constraints) {
  50146. return Semver::satisfies($version, $constraints);
  50147. });
  50148. return array_values($versions);
  50149. }
  50150. public static function sort(array $versions)
  50151. {
  50152. return self::usort($versions, self::SORT_ASC);
  50153. }
  50154. public static function rsort(array $versions)
  50155. {
  50156. return self::usort($versions, self::SORT_DESC);
  50157. }
  50158. private static function usort(array $versions, $direction)
  50159. {
  50160. if (null === self::$versionParser) {
  50161. self::$versionParser = new VersionParser();
  50162. }
  50163. $versionParser = self::$versionParser;
  50164. $normalized = array();
  50165. foreach ($versions as $key => $version) {
  50166. $normalized[] = array($versionParser->normalize($version), $key);
  50167. }
  50168. usort($normalized, function (array $left, array $right) use ($direction) {
  50169. if ($left[0] === $right[0]) {
  50170. return 0;
  50171. }
  50172. if (Comparator::lessThan($left[0], $right[0])) {
  50173. return -$direction;
  50174. }
  50175. return $direction;
  50176. });
  50177. $sorted = array();
  50178. foreach ($normalized as $item) {
  50179. $sorted[] = $versions[$item[1]];
  50180. }
  50181. return $sorted;
  50182. }
  50183. }
  50184. <?php
  50185. namespace Composer\Semver;
  50186. use Composer\Semver\Constraint\ConstraintInterface;
  50187. use Composer\Semver\Constraint\EmptyConstraint;
  50188. use Composer\Semver\Constraint\MultiConstraint;
  50189. use Composer\Semver\Constraint\Constraint;
  50190. class VersionParser
  50191. {
  50192. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50193. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  50194. public static function parseStability($version)
  50195. {
  50196. $version = preg_replace('{#.+$}i', '', $version);
  50197. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  50198. return 'dev';
  50199. }
  50200. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50201. if (!empty($match[3])) {
  50202. return 'dev';
  50203. }
  50204. if (!empty($match[1])) {
  50205. if ('beta' === $match[1] || 'b' === $match[1]) {
  50206. return 'beta';
  50207. }
  50208. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50209. return 'alpha';
  50210. }
  50211. if ('rc' === $match[1]) {
  50212. return 'RC';
  50213. }
  50214. }
  50215. return 'stable';
  50216. }
  50217. public static function normalizeStability($stability)
  50218. {
  50219. $stability = strtolower($stability);
  50220. return $stability === 'rc' ? 'RC' : $stability;
  50221. }
  50222. public function normalize($version, $fullVersion = null)
  50223. {
  50224. $version = trim($version);
  50225. if (null === $fullVersion) {
  50226. $fullVersion = $version;
  50227. }
  50228. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50229. $version = $match[1];
  50230. }
  50231. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  50232. return '9999999-dev';
  50233. }
  50234. if ('dev-' === strtolower(substr($version, 0, 4))) {
  50235. return 'dev-' . substr($version, 4);
  50236. }
  50237. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50238. $version = $match[1];
  50239. }
  50240. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50241. $version = $matches[1]
  50242. . (!empty($matches[2]) ? $matches[2] : '.0')
  50243. . (!empty($matches[3]) ? $matches[3] : '.0')
  50244. . (!empty($matches[4]) ? $matches[4] : '.0');
  50245. $index = 5;
  50246. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  50247. $version = preg_replace('{\D}', '.', $matches[1]);
  50248. $index = 2;
  50249. }
  50250. if (isset($index)) {
  50251. if (!empty($matches[$index])) {
  50252. if ('stable' === $matches[$index]) {
  50253. return $version;
  50254. }
  50255. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  50256. }
  50257. if (!empty($matches[$index + 2])) {
  50258. $version .= '-dev';
  50259. }
  50260. return $version;
  50261. }
  50262. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50263. try {
  50264. return $this->normalizeBranch($match[1]);
  50265. } catch (\Exception $e) {
  50266. }
  50267. }
  50268. $extraMessage = '';
  50269. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  50270. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50271. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  50272. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50273. }
  50274. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  50275. }
  50276. public function parseNumericAliasPrefix($branch)
  50277. {
  50278. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  50279. return $matches['version'] . '.';
  50280. }
  50281. return false;
  50282. }
  50283. public function normalizeBranch($name)
  50284. {
  50285. $name = trim($name);
  50286. if (in_array($name, array('master', 'trunk', 'default'))) {
  50287. return $this->normalize($name);
  50288. }
  50289. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50290. $version = '';
  50291. for ($i = 1; $i < 5; ++$i) {
  50292. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50293. }
  50294. return str_replace('x', '9999999', $version) . '-dev';
  50295. }
  50296. return 'dev-' . $name;
  50297. }
  50298. public function parseConstraints($constraints)
  50299. {
  50300. $prettyConstraint = $constraints;
  50301. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  50302. $constraints = empty($match[1]) ? '*' : $match[1];
  50303. }
  50304. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  50305. $constraints = $match[1];
  50306. }
  50307. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  50308. $orGroups = array();
  50309. foreach ($orConstraints as $constraints) {
  50310. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  50311. if (count($andConstraints) > 1) {
  50312. $constraintObjects = array();
  50313. foreach ($andConstraints as $constraint) {
  50314. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  50315. $constraintObjects[] = $parsedConstraint;
  50316. }
  50317. }
  50318. } else {
  50319. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50320. }
  50321. if (1 === count($constraintObjects)) {
  50322. $constraint = $constraintObjects[0];
  50323. } else {
  50324. $constraint = new MultiConstraint($constraintObjects);
  50325. }
  50326. $orGroups[] = $constraint;
  50327. }
  50328. if (1 === count($orGroups)) {
  50329. $constraint = $orGroups[0];
  50330. } elseif (2 === count($orGroups)
  50331. && $orGroups[0] instanceof MultiConstraint
  50332. && $orGroups[1] instanceof MultiConstraint
  50333. && 2 === count($orGroups[0]->getConstraints())
  50334. && 2 === count($orGroups[1]->getConstraints())
  50335. && ($a = (string) $orGroups[0])
  50336. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  50337. && ($b = (string) $orGroups[1])
  50338. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  50339. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  50340. ) {
  50341. $constraint = new MultiConstraint(array(
  50342. new Constraint('>=', substr($a, 4, $posA - 5)),
  50343. new Constraint('<', substr($b, $posB + 2, -1)),
  50344. ));
  50345. } else {
  50346. $constraint = new MultiConstraint($orGroups, false);
  50347. }
  50348. $constraint->setPrettyString($prettyConstraint);
  50349. return $constraint;
  50350. }
  50351. private function parseConstraint($constraint)
  50352. {
  50353. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  50354. $constraint = $match[1];
  50355. if ($match[2] !== 'stable') {
  50356. $stabilityModifier = $match[2];
  50357. }
  50358. }
  50359. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  50360. return array(new EmptyConstraint());
  50361. }
  50362. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  50363. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50364. if (substr($constraint, 0, 2) === '~>') {
  50365. throw new \UnexpectedValueException(
  50366. 'Could not parse version constraint ' . $constraint . ': ' .
  50367. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50368. );
  50369. }
  50370. if (isset($matches[4]) && '' !== $matches[4]) {
  50371. $position = 4;
  50372. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  50373. $position = 3;
  50374. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  50375. $position = 2;
  50376. } else {
  50377. $position = 1;
  50378. }
  50379. $stabilitySuffix = '';
  50380. if (!empty($matches[5])) {
  50381. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  50382. }
  50383. if (!empty($matches[7])) {
  50384. $stabilitySuffix .= '-dev';
  50385. }
  50386. if (!$stabilitySuffix) {
  50387. $stabilitySuffix = '-dev';
  50388. }
  50389. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  50390. $lowerBound = new Constraint('>=', $lowVersion);
  50391. $highPosition = max(1, $position - 1);
  50392. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50393. $upperBound = new Constraint('<', $highVersion);
  50394. return array(
  50395. $lowerBound,
  50396. $upperBound,
  50397. );
  50398. }
  50399. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50400. if ('0' !== $matches[1] || '' === $matches[2]) {
  50401. $position = 1;
  50402. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  50403. $position = 2;
  50404. } else {
  50405. $position = 3;
  50406. }
  50407. $stabilitySuffix = '';
  50408. if (empty($matches[5]) && empty($matches[7])) {
  50409. $stabilitySuffix .= '-dev';
  50410. }
  50411. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50412. $lowerBound = new Constraint('>=', $lowVersion);
  50413. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50414. $upperBound = new Constraint('<', $highVersion);
  50415. return array(
  50416. $lowerBound,
  50417. $upperBound,
  50418. );
  50419. }
  50420. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50421. if (isset($matches[3]) && '' !== $matches[3]) {
  50422. $position = 3;
  50423. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  50424. $position = 2;
  50425. } else {
  50426. $position = 1;
  50427. }
  50428. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50429. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50430. if ($lowVersion === '0.0.0.0-dev') {
  50431. return array(new Constraint('<', $highVersion));
  50432. }
  50433. return array(
  50434. new Constraint('>=', $lowVersion),
  50435. new Constraint('<', $highVersion),
  50436. );
  50437. }
  50438. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50439. $lowStabilitySuffix = '';
  50440. if (empty($matches[6]) && empty($matches[8])) {
  50441. $lowStabilitySuffix = '-dev';
  50442. }
  50443. $lowVersion = $this->normalize($matches['from']);
  50444. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50445. $empty = function ($x) {
  50446. return ($x === 0 || $x === '0') ? false : empty($x);
  50447. };
  50448. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  50449. $highVersion = $this->normalize($matches['to']);
  50450. $upperBound = new Constraint('<=', $highVersion);
  50451. } else {
  50452. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  50453. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  50454. $upperBound = new Constraint('<', $highVersion);
  50455. }
  50456. return array(
  50457. $lowerBound,
  50458. $upperBound,
  50459. );
  50460. }
  50461. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50462. try {
  50463. $version = $this->normalize($matches[2]);
  50464. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  50465. $version .= '-' . $stabilityModifier;
  50466. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  50467. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50468. if (substr($matches[2], 0, 4) !== 'dev-') {
  50469. $version .= '-dev';
  50470. }
  50471. }
  50472. }
  50473. return array(new Constraint($matches[1] ?: '=', $version));
  50474. } catch (\Exception $e) {
  50475. }
  50476. }
  50477. $message = 'Could not parse version constraint ' . $constraint;
  50478. if (isset($e)) {
  50479. $message .= ': ' . $e->getMessage();
  50480. }
  50481. throw new \UnexpectedValueException($message);
  50482. }
  50483. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  50484. {
  50485. for ($i = 4; $i > 0; --$i) {
  50486. if ($i > $position) {
  50487. $matches[$i] = $pad;
  50488. } elseif ($i === $position && $increment) {
  50489. $matches[$i] += $increment;
  50490. if ($matches[$i] < 0) {
  50491. $matches[$i] = $pad;
  50492. --$position;
  50493. if ($i === 1) {
  50494. return;
  50495. }
  50496. }
  50497. }
  50498. }
  50499. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50500. }
  50501. private function expandStability($stability)
  50502. {
  50503. $stability = strtolower($stability);
  50504. switch ($stability) {
  50505. case 'a':
  50506. return 'alpha';
  50507. case 'b':
  50508. return 'beta';
  50509. case 'p':
  50510. case 'pl':
  50511. return 'patch';
  50512. case 'rc':
  50513. return 'RC';
  50514. default:
  50515. return $stability;
  50516. }
  50517. }
  50518. }
  50519. Copyright (C) 2016 Composer
  50520. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50521. this software and associated documentation files (the "Software"), to deal in
  50522. the Software without restriction, including without limitation the rights to
  50523. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50524. of the Software, and to permit persons to whom the Software is furnished to do
  50525. so, subject to the following conditions:
  50526. The above copyright notice and this permission notice shall be included in all
  50527. copies or substantial portions of the Software.
  50528. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50529. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50530. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50531. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50532. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50533. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50534. SOFTWARE.
  50535. <?php
  50536. namespace Composer\CaBundle;
  50537. use Psr\Log\LoggerInterface;
  50538. use Symfony\Component\Process\PhpProcess;
  50539. class CaBundle
  50540. {
  50541. private static $caPath;
  50542. private static $caFileValidity = array();
  50543. private static $useOpensslParse;
  50544. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  50545. {
  50546. if (self::$caPath !== null) {
  50547. return self::$caPath;
  50548. }
  50549. $envCertFile = getenv('SSL_CERT_FILE');
  50550. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  50551. return self::$caPath = $envCertFile;
  50552. }
  50553. $envCertDir = getenv('SSL_CERT_DIR');
  50554. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  50555. return self::$caPath = $envCertDir;
  50556. }
  50557. $configured = ini_get('openssl.cafile');
  50558. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  50559. return self::$caPath = $configured;
  50560. }
  50561. $configured = ini_get('openssl.capath');
  50562. if ($configured && is_dir($configured) && is_readable($configured)) {
  50563. return self::$caPath = $configured;
  50564. }
  50565. $caBundlePaths = array(
  50566. '/etc/pki/tls/certs/ca-bundle.crt',
  50567. '/etc/ssl/certs/ca-certificates.crt',
  50568. '/etc/ssl/ca-bundle.pem',
  50569. '/usr/local/share/certs/ca-root-nss.crt',
  50570. '/usr/ssl/certs/ca-bundle.crt',
  50571. '/opt/local/share/curl/curl-ca-bundle.crt',
  50572. '/usr/local/share/curl/curl-ca-bundle.crt',
  50573. '/usr/share/ssl/certs/ca-bundle.crt',
  50574. '/etc/ssl/cert.pem',
  50575. '/usr/local/etc/ssl/cert.pem',
  50576. '/usr/local/etc/openssl/cert.pem',
  50577. );
  50578. foreach ($caBundlePaths as $caBundle) {
  50579. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  50580. return self::$caPath = $caBundle;
  50581. }
  50582. }
  50583. foreach ($caBundlePaths as $caBundle) {
  50584. $caBundle = dirname($caBundle);
  50585. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  50586. return self::$caPath = $caBundle;
  50587. }
  50588. }
  50589. return self::$caPath = static::getBundledCaBundlePath();
  50590. }
  50591. public static function getBundledCaBundlePath()
  50592. {
  50593. $caBundleFile = __DIR__.'/../res/cacert.pem';
  50594. if (0 === strpos($caBundleFile, 'phar://')) {
  50595. file_put_contents(
  50596. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  50597. file_get_contents($caBundleFile)
  50598. );
  50599. register_shutdown_function(function() use ($tempCaBundleFile) {
  50600. @unlink($tempCaBundleFile);
  50601. });
  50602. $caBundleFile = $tempCaBundleFile;
  50603. }
  50604. return $caBundleFile;
  50605. }
  50606. public static function validateCaFile($filename, LoggerInterface $logger = null)
  50607. {
  50608. static $warned = false;
  50609. if (isset(self::$caFileValidity[$filename])) {
  50610. return self::$caFileValidity[$filename];
  50611. }
  50612. $contents = file_get_contents($filename);
  50613. if (!static::isOpensslParseSafe()) {
  50614. if (!$warned && $logger) {
  50615. $logger->warning(sprintf(
  50616. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  50617. PHP_VERSION
  50618. ));
  50619. $warned = true;
  50620. }
  50621. $isValid = !empty($contents);
  50622. } else {
  50623. $isValid = (bool) openssl_x509_parse($contents);
  50624. }
  50625. if ($logger) {
  50626. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  50627. }
  50628. return self::$caFileValidity[$filename] = $isValid;
  50629. }
  50630. public static function isOpensslParseSafe()
  50631. {
  50632. if (null !== self::$useOpensslParse) {
  50633. return self::$useOpensslParse;
  50634. }
  50635. if (PHP_VERSION_ID >= 50600) {
  50636. return self::$useOpensslParse = true;
  50637. }
  50638. if (
  50639. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  50640. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  50641. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  50642. ) {
  50643. return self::$useOpensslParse = true;
  50644. }
  50645. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50646. return self::$useOpensslParse = false;
  50647. }
  50648. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  50649. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  50650. if (preg_match($regex, PHP_VERSION, $m)) {
  50651. return ((int) $m[1]) >= $fixedVersion;
  50652. }
  50653. return false;
  50654. };
  50655. if (
  50656. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  50657. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  50658. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  50659. ) {
  50660. return self::$useOpensslParse = true;
  50661. }
  50662. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  50663. return self::$useOpensslParse = false;
  50664. }
  50665. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  50666. $script = <<<'EOT'
  50667. error_reporting(-1);
  50668. $info = openssl_x509_parse(base64_decode('%s'));
  50669. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  50670. EOT;
  50671. $script = '<'."?php\n".sprintf($script, $cert);
  50672. try {
  50673. $process = new PhpProcess($script);
  50674. $process->mustRun();
  50675. } catch (\Exception $e) {
  50676. return self::$useOpensslParse = false;
  50677. }
  50678. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  50679. $errorOutput = trim($process->getErrorOutput());
  50680. if (
  50681. count($output) === 3
  50682. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  50683. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  50684. && $output[2] === 'int(-1)'
  50685. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  50686. ) {
  50687. return self::$useOpensslParse = true;
  50688. }
  50689. return self::$useOpensslParse = false;
  50690. }
  50691. public static function reset()
  50692. {
  50693. self::$caFileValidity = array();
  50694. self::$caPath = null;
  50695. self::$useOpensslParse = null;
  50696. }
  50697. }
  50698. MIT License
  50699. Copyright (c) 2017 Composer
  50700. Permission is hereby granted, free of charge, to any person obtaining a copy
  50701. of this software and associated documentation files (the "Software"), to deal
  50702. in the Software without restriction, including without limitation the rights
  50703. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50704. copies of the Software, and to permit persons to whom the Software is
  50705. furnished to do so, subject to the following conditions:
  50706. The above copyright notice and this permission notice shall be included in all
  50707. copies or substantial portions of the Software.
  50708. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50709. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50710. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50711. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50712. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50713. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50714. SOFTWARE.
  50715. <?php
  50716. namespace Composer\XdebugHandler;
  50717. class PhpConfig
  50718. {
  50719. public function useOriginal()
  50720. {
  50721. $this->getDataAndReset();
  50722. return array();
  50723. }
  50724. public function useStandard()
  50725. {
  50726. if ($data = $this->getDataAndReset()) {
  50727. return array('-n', '-c', $data['tmpIni']);
  50728. }
  50729. return array();
  50730. }
  50731. public function usePersistent()
  50732. {
  50733. if ($data = $this->getDataAndReset()) {
  50734. Process::setEnv('PHPRC', $data['tmpIni']);
  50735. Process::setEnv('PHP_INI_SCAN_DIR', '');
  50736. }
  50737. return array();
  50738. }
  50739. private function getDataAndReset()
  50740. {
  50741. if ($data = XdebugHandler::getRestartSettings()) {
  50742. Process::setEnv('PHPRC', $data['phprc']);
  50743. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  50744. }
  50745. return $data;
  50746. }
  50747. }
  50748. <?php
  50749. namespace Composer\XdebugHandler;
  50750. class Process
  50751. {
  50752. public static function addColorOption(array $args, $colorOption)
  50753. {
  50754. if (!$colorOption
  50755. || in_array($colorOption, $args)
  50756. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  50757. return $args;
  50758. }
  50759. if (isset($matches[2])) {
  50760. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  50761. $args[$index] = $colorOption;
  50762. return $args;
  50763. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  50764. return $args;
  50765. }
  50766. } elseif (in_array('--no-'.$matches[1], $args)) {
  50767. return $args;
  50768. }
  50769. if (false !== ($index = array_search('--', $args))) {
  50770. array_splice($args, $index, 0, $colorOption);
  50771. } else {
  50772. $args[] = $colorOption;
  50773. }
  50774. return $args;
  50775. }
  50776. public static function escape($arg, $meta = true, $module = false)
  50777. {
  50778. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  50779. return "'".str_replace("'", "'\\''", $arg)."'";
  50780. }
  50781. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  50782. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  50783. if ($meta) {
  50784. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  50785. if (!$meta) {
  50786. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  50787. } elseif ($module && !$dquotes && $quote) {
  50788. $meta = false;
  50789. }
  50790. }
  50791. if ($quote) {
  50792. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  50793. }
  50794. if ($meta) {
  50795. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  50796. }
  50797. return $arg;
  50798. }
  50799. public static function supportsColor($output)
  50800. {
  50801. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50802. return (function_exists('sapi_windows_vt100_support')
  50803. && sapi_windows_vt100_support($output))
  50804. || false !== getenv('ANSICON')
  50805. || 'ON' === getenv('ConEmuANSI')
  50806. || 'xterm' === getenv('TERM');
  50807. }
  50808. if (function_exists('stream_isatty')) {
  50809. return stream_isatty($output);
  50810. } elseif (function_exists('posix_isatty')) {
  50811. return posix_isatty($output);
  50812. }
  50813. $stat = fstat($output);
  50814. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  50815. }
  50816. public static function setEnv($name, $value = false)
  50817. {
  50818. $unset = false === $value;
  50819. if (!putenv($unset ? $name : $name.'='.$value)) {
  50820. return false;
  50821. }
  50822. if ($unset) {
  50823. unset($_SERVER[$name]);
  50824. } else {
  50825. $_SERVER[$name] = $value;
  50826. }
  50827. return true;
  50828. }
  50829. }
  50830. <?php
  50831. namespace Composer\XdebugHandler;
  50832. use Psr\Log\LoggerInterface;
  50833. use Psr\Log\LogLevel;
  50834. class Status
  50835. {
  50836. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  50837. const CHECK = 'Check';
  50838. const ERROR = 'Error';
  50839. const INFO = 'Info';
  50840. const NORESTART = 'NoRestart';
  50841. const RESTART = 'Restart';
  50842. const RESTARTING = 'Restarting';
  50843. const RESTARTED = 'Restarted';
  50844. private $debug;
  50845. private $envAllowXdebug;
  50846. private $loaded;
  50847. private $logger;
  50848. private $time;
  50849. public function __construct($envAllowXdebug, $debug)
  50850. {
  50851. $start = getenv(self::ENV_RESTART);
  50852. Process::setEnv(self::ENV_RESTART);
  50853. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  50854. $this->envAllowXdebug = $envAllowXdebug;
  50855. $this->debug = $debug && defined('STDERR');
  50856. }
  50857. public function setLogger(LoggerInterface $logger)
  50858. {
  50859. $this->logger = $logger;
  50860. }
  50861. public function report($op, $data)
  50862. {
  50863. if ($this->logger || $this->debug) {
  50864. call_user_func(array($this, 'report'.$op), $data);
  50865. }
  50866. }
  50867. private function output($text, $level = null)
  50868. {
  50869. if ($this->logger) {
  50870. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  50871. }
  50872. if ($this->debug) {
  50873. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  50874. }
  50875. }
  50876. private function reportCheck($loaded)
  50877. {
  50878. $this->loaded = $loaded;
  50879. $this->output('Checking '.$this->envAllowXdebug);
  50880. }
  50881. private function reportError($error)
  50882. {
  50883. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  50884. }
  50885. private function reportInfo($info)
  50886. {
  50887. $this->output($info);
  50888. }
  50889. private function reportNoRestart()
  50890. {
  50891. $this->output($this->getLoadedMessage());
  50892. if ($this->loaded) {
  50893. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  50894. if (!getenv($this->envAllowXdebug)) {
  50895. $text .= ' Allowed by application';
  50896. }
  50897. $this->output($text);
  50898. }
  50899. }
  50900. private function reportRestart()
  50901. {
  50902. $this->output($this->getLoadedMessage());
  50903. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  50904. }
  50905. private function reportRestarted()
  50906. {
  50907. $loaded = $this->getLoadedMessage();
  50908. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  50909. $level = $this->loaded ? LogLevel::WARNING : null;
  50910. $this->output($text, $level);
  50911. }
  50912. private function reportRestarting($command)
  50913. {
  50914. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  50915. $this->output($text);
  50916. $text = 'Running '.$command;
  50917. $this->output($text);
  50918. }
  50919. private function getEnvAllow()
  50920. {
  50921. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  50922. }
  50923. private function getLoadedMessage()
  50924. {
  50925. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  50926. return 'The xdebug extension is '.$loaded;
  50927. }
  50928. }
  50929. <?php
  50930. namespace Composer\XdebugHandler;
  50931. use Psr\Log\LoggerInterface;
  50932. class XdebugHandler
  50933. {
  50934. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  50935. const SUFFIX_INIS = '_ORIGINAL_INIS';
  50936. const RESTART_ID = 'internal';
  50937. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  50938. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  50939. protected $tmpIni;
  50940. private static $inRestart;
  50941. private static $name;
  50942. private static $skipped;
  50943. private $cli;
  50944. private $colorOption;
  50945. private $debug;
  50946. private $envAllowXdebug;
  50947. private $envOriginalInis;
  50948. private $loaded;
  50949. private $persistent;
  50950. private $script;
  50951. private $statusWriter;
  50952. public function __construct($envPrefix, $colorOption = '')
  50953. {
  50954. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  50955. throw new \RuntimeException('Invalid constructor parameter');
  50956. }
  50957. self::$name = strtoupper($envPrefix);
  50958. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  50959. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  50960. $this->colorOption = $colorOption;
  50961. if (extension_loaded('xdebug')) {
  50962. $ext = new \ReflectionExtension('xdebug');
  50963. $this->loaded = $ext->getVersion() ?: 'unknown';
  50964. }
  50965. if ($this->cli = PHP_SAPI === 'cli') {
  50966. $this->debug = getenv(self::DEBUG);
  50967. }
  50968. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  50969. }
  50970. public function setLogger(LoggerInterface $logger)
  50971. {
  50972. $this->statusWriter->setLogger($logger);
  50973. return $this;
  50974. }
  50975. public function setMainScript($script)
  50976. {
  50977. $this->script = $script;
  50978. return $this;
  50979. }
  50980. public function setPersistent()
  50981. {
  50982. $this->persistent = true;
  50983. return $this;
  50984. }
  50985. public function check()
  50986. {
  50987. $this->notify(Status::CHECK, $this->loaded);
  50988. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  50989. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  50990. $this->notify(Status::RESTART);
  50991. if ($this->prepareRestart()) {
  50992. $command = $this->getCommand();
  50993. $this->notify(Status::RESTARTING, $command);
  50994. $this->restart($command);
  50995. }
  50996. return;
  50997. }
  50998. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  50999. $this->notify(Status::RESTARTED);
  51000. Process::setEnv($this->envAllowXdebug);
  51001. self::$inRestart = true;
  51002. if (!$this->loaded) {
  51003. self::$skipped = $envArgs[1];
  51004. }
  51005. $this->setEnvRestartSettings($envArgs);
  51006. return;
  51007. }
  51008. $this->notify(Status::NORESTART);
  51009. if ($settings = self::getRestartSettings()) {
  51010. $this->syncSettings($settings);
  51011. }
  51012. }
  51013. public static function getAllIniFiles()
  51014. {
  51015. if (!empty(self::$name)) {
  51016. $env = getenv(self::$name.self::SUFFIX_INIS);
  51017. if (false !== $env) {
  51018. return explode(PATH_SEPARATOR, $env);
  51019. }
  51020. }
  51021. $paths = array((string) php_ini_loaded_file());
  51022. if ($scanned = php_ini_scanned_files()) {
  51023. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  51024. }
  51025. return $paths;
  51026. }
  51027. public static function getRestartSettings()
  51028. {
  51029. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  51030. if (count($envArgs) !== 6
  51031. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  51032. return;
  51033. }
  51034. return array(
  51035. 'tmpIni' => $envArgs[0],
  51036. 'scannedInis' => (bool) $envArgs[1],
  51037. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  51038. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  51039. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  51040. 'skipped' => $envArgs[5],
  51041. );
  51042. }
  51043. public static function getSkippedVersion()
  51044. {
  51045. return (string) self::$skipped;
  51046. }
  51047. protected function requiresRestart($isLoaded)
  51048. {
  51049. return $isLoaded;
  51050. }
  51051. protected function restart($command)
  51052. {
  51053. $this->doRestart($command);
  51054. }
  51055. private function doRestart($command)
  51056. {
  51057. passthru($command, $exitCode);
  51058. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  51059. if ($this->debug === '2') {
  51060. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  51061. } else {
  51062. @unlink($this->tmpIni);
  51063. }
  51064. exit($exitCode);
  51065. }
  51066. private function prepareRestart()
  51067. {
  51068. $error = '';
  51069. $iniFiles = self::getAllIniFiles();
  51070. $scannedInis = count($iniFiles) > 1;
  51071. $tmpDir = sys_get_temp_dir();
  51072. if (!$this->cli) {
  51073. $error = 'Unsupported SAPI: '.PHP_SAPI;
  51074. } elseif (!defined('PHP_BINARY')) {
  51075. $error = 'PHP version is too old: '.PHP_VERSION;
  51076. } elseif (!$this->checkConfiguration($info)) {
  51077. $error = $info;
  51078. } elseif (!$this->checkScanDirConfig()) {
  51079. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  51080. } elseif (!$this->checkMainScript()) {
  51081. $error = 'Unable to access main script: '.$this->script;
  51082. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  51083. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  51084. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  51085. $error = 'Unable to set environment variables';
  51086. }
  51087. if ($error) {
  51088. $this->notify(Status::ERROR, $error);
  51089. }
  51090. return empty($error);
  51091. }
  51092. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  51093. {
  51094. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  51095. return false;
  51096. }
  51097. if (empty($iniFiles[0])) {
  51098. array_shift($iniFiles);
  51099. }
  51100. $content = '';
  51101. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  51102. foreach ($iniFiles as $file) {
  51103. if (!$data = @file_get_contents($file)) {
  51104. $error = 'Unable to read ini: '.$file;
  51105. return false;
  51106. }
  51107. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  51108. }
  51109. if ($config = parse_ini_string($content)) {
  51110. $loaded = ini_get_all(null, false);
  51111. $content .= $this->mergeLoadedConfig($loaded, $config);
  51112. }
  51113. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  51114. return @file_put_contents($this->tmpIni, $content);
  51115. }
  51116. private function getCommand()
  51117. {
  51118. $php = array(PHP_BINARY);
  51119. $args = array_slice($_SERVER['argv'], 1);
  51120. if (!$this->persistent) {
  51121. array_push($php, '-n', '-c', $this->tmpIni);
  51122. }
  51123. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  51124. $args = Process::addColorOption($args, $this->colorOption);
  51125. }
  51126. $args = array_merge($php, array($this->script), $args);
  51127. $cmd = Process::escape(array_shift($args), true, true);
  51128. foreach ($args as $arg) {
  51129. $cmd .= ' '.Process::escape($arg);
  51130. }
  51131. return $cmd;
  51132. }
  51133. private function setEnvironment($scannedInis, array $iniFiles)
  51134. {
  51135. $scanDir = getenv('PHP_INI_SCAN_DIR');
  51136. $phprc = getenv('PHPRC');
  51137. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  51138. return false;
  51139. }
  51140. if ($this->persistent) {
  51141. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  51142. return false;
  51143. }
  51144. }
  51145. $envArgs = array(
  51146. self::RESTART_ID,
  51147. $this->loaded,
  51148. (int) $scannedInis,
  51149. false === $scanDir ? '*' : $scanDir,
  51150. false === $phprc ? '*' : $phprc,
  51151. );
  51152. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  51153. }
  51154. private function notify($op, $data = null)
  51155. {
  51156. $this->statusWriter->report($op, $data);
  51157. }
  51158. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  51159. {
  51160. $content = '';
  51161. foreach ($loadedConfig as $name => $value) {
  51162. if (!is_string($value)
  51163. || strpos($name, 'xdebug') === 0
  51164. || $name === 'apc.mmap_file_mask') {
  51165. continue;
  51166. }
  51167. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  51168. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  51169. }
  51170. }
  51171. return $content;
  51172. }
  51173. private function checkMainScript()
  51174. {
  51175. if (null !== $this->script) {
  51176. return file_exists($this->script) || '--' === $this->script;
  51177. }
  51178. if (file_exists($this->script = $_SERVER['argv'][0])) {
  51179. return true;
  51180. }
  51181. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  51182. $trace = debug_backtrace($options);
  51183. if (($main = end($trace)) && isset($main['file'])) {
  51184. return file_exists($this->script = $main['file']);
  51185. }
  51186. return false;
  51187. }
  51188. private function setEnvRestartSettings($envArgs)
  51189. {
  51190. $settings = array(
  51191. php_ini_loaded_file(),
  51192. $envArgs[2],
  51193. $envArgs[3],
  51194. $envArgs[4],
  51195. getenv($this->envOriginalInis),
  51196. self::$skipped,
  51197. );
  51198. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  51199. }
  51200. private function syncSettings(array $settings)
  51201. {
  51202. if (false === getenv($this->envOriginalInis)) {
  51203. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  51204. }
  51205. self::$skipped = $settings['skipped'];
  51206. $this->notify(Status::INFO, 'Process called with existing restart settings');
  51207. }
  51208. private function checkScanDirConfig()
  51209. {
  51210. return !(getenv('PHP_INI_SCAN_DIR')
  51211. && !PHP_CONFIG_FILE_SCAN_DIR
  51212. && (PHP_VERSION_ID < 70113
  51213. || PHP_VERSION_ID === 70200));
  51214. }
  51215. private function checkConfiguration(&$info)
  51216. {
  51217. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  51218. $info = 'passthru function is disabled';
  51219. return false;
  51220. }
  51221. if (extension_loaded('uopz')) {
  51222. if (function_exists('uopz_allow_exit')) {
  51223. @uopz_allow_exit(true);
  51224. } else {
  51225. $info = 'uopz extension is not compatible';
  51226. return false;
  51227. }
  51228. }
  51229. return true;
  51230. }
  51231. }
  51232. Copyright (c) 2012 PHP Framework Interoperability Group
  51233. Permission is hereby granted, free of charge, to any person obtaining a copy
  51234. of this software and associated documentation files (the "Software"), to deal
  51235. in the Software without restriction, including without limitation the rights
  51236. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51237. copies of the Software, and to permit persons to whom the Software is
  51238. furnished to do so, subject to the following conditions:
  51239. The above copyright notice and this permission notice shall be included in
  51240. all copies or substantial portions of the Software.
  51241. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51242. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51243. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51244. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51245. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51246. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51247. THE SOFTWARE.
  51248. <?php
  51249. namespace Psr\Log;
  51250. abstract class AbstractLogger implements LoggerInterface
  51251. {
  51252. public function emergency($message, array $context = array())
  51253. {
  51254. $this->log(LogLevel::EMERGENCY, $message, $context);
  51255. }
  51256. public function alert($message, array $context = array())
  51257. {
  51258. $this->log(LogLevel::ALERT, $message, $context);
  51259. }
  51260. public function critical($message, array $context = array())
  51261. {
  51262. $this->log(LogLevel::CRITICAL, $message, $context);
  51263. }
  51264. public function error($message, array $context = array())
  51265. {
  51266. $this->log(LogLevel::ERROR, $message, $context);
  51267. }
  51268. public function warning($message, array $context = array())
  51269. {
  51270. $this->log(LogLevel::WARNING, $message, $context);
  51271. }
  51272. public function notice($message, array $context = array())
  51273. {
  51274. $this->log(LogLevel::NOTICE, $message, $context);
  51275. }
  51276. public function info($message, array $context = array())
  51277. {
  51278. $this->log(LogLevel::INFO, $message, $context);
  51279. }
  51280. public function debug($message, array $context = array())
  51281. {
  51282. $this->log(LogLevel::DEBUG, $message, $context);
  51283. }
  51284. }
  51285. <?php
  51286. namespace Psr\Log;
  51287. class InvalidArgumentException extends \InvalidArgumentException
  51288. {
  51289. }
  51290. <?php
  51291. namespace Psr\Log;
  51292. class LogLevel
  51293. {
  51294. const EMERGENCY = 'emergency';
  51295. const ALERT = 'alert';
  51296. const CRITICAL = 'critical';
  51297. const ERROR = 'error';
  51298. const WARNING = 'warning';
  51299. const NOTICE = 'notice';
  51300. const INFO = 'info';
  51301. const DEBUG = 'debug';
  51302. }
  51303. <?php
  51304. namespace Psr\Log;
  51305. interface LoggerAwareInterface
  51306. {
  51307. public function setLogger(LoggerInterface $logger);
  51308. }
  51309. <?php
  51310. namespace Psr\Log;
  51311. trait LoggerAwareTrait
  51312. {
  51313. protected $logger;
  51314. public function setLogger(LoggerInterface $logger)
  51315. {
  51316. $this->logger = $logger;
  51317. }
  51318. }
  51319. <?php
  51320. namespace Psr\Log;
  51321. interface LoggerInterface
  51322. {
  51323. public function emergency($message, array $context = array());
  51324. public function alert($message, array $context = array());
  51325. public function critical($message, array $context = array());
  51326. public function error($message, array $context = array());
  51327. public function warning($message, array $context = array());
  51328. public function notice($message, array $context = array());
  51329. public function info($message, array $context = array());
  51330. public function debug($message, array $context = array());
  51331. public function log($level, $message, array $context = array());
  51332. }
  51333. <?php
  51334. namespace Psr\Log;
  51335. trait LoggerTrait
  51336. {
  51337. public function emergency($message, array $context = array())
  51338. {
  51339. $this->log(LogLevel::EMERGENCY, $message, $context);
  51340. }
  51341. public function alert($message, array $context = array())
  51342. {
  51343. $this->log(LogLevel::ALERT, $message, $context);
  51344. }
  51345. public function critical($message, array $context = array())
  51346. {
  51347. $this->log(LogLevel::CRITICAL, $message, $context);
  51348. }
  51349. public function error($message, array $context = array())
  51350. {
  51351. $this->log(LogLevel::ERROR, $message, $context);
  51352. }
  51353. public function warning($message, array $context = array())
  51354. {
  51355. $this->log(LogLevel::WARNING, $message, $context);
  51356. }
  51357. public function notice($message, array $context = array())
  51358. {
  51359. $this->log(LogLevel::NOTICE, $message, $context);
  51360. }
  51361. public function info($message, array $context = array())
  51362. {
  51363. $this->log(LogLevel::INFO, $message, $context);
  51364. }
  51365. public function debug($message, array $context = array())
  51366. {
  51367. $this->log(LogLevel::DEBUG, $message, $context);
  51368. }
  51369. abstract public function log($level, $message, array $context = array());
  51370. }
  51371. <?php
  51372. namespace Psr\Log;
  51373. class NullLogger extends AbstractLogger
  51374. {
  51375. public function log($level, $message, array $context = array())
  51376. {
  51377. }
  51378. }
  51379. <?php
  51380. namespace Psr\Log\Test;
  51381. use Psr\Log\LoggerInterface;
  51382. use Psr\Log\LogLevel;
  51383. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  51384. {
  51385. abstract public function getLogger();
  51386. abstract public function getLogs();
  51387. public function testImplements()
  51388. {
  51389. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  51390. }
  51391. public function testLogsAtAllLevels($level, $message)
  51392. {
  51393. $logger = $this->getLogger();
  51394. $logger->{$level}($message, array('user' => 'Bob'));
  51395. $logger->log($level, $message, array('user' => 'Bob'));
  51396. $expected = array(
  51397. $level.' message of level '.$level.' with context: Bob',
  51398. $level.' message of level '.$level.' with context: Bob',
  51399. );
  51400. $this->assertEquals($expected, $this->getLogs());
  51401. }
  51402. public function provideLevelsAndMessages()
  51403. {
  51404. return array(
  51405. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  51406. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  51407. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  51408. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  51409. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  51410. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  51411. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  51412. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  51413. );
  51414. }
  51415. public function testThrowsOnInvalidLevel()
  51416. {
  51417. $logger = $this->getLogger();
  51418. $logger->log('invalid level', 'Foo');
  51419. }
  51420. public function testContextReplacement()
  51421. {
  51422. $logger = $this->getLogger();
  51423. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  51424. $expected = array('info {Message {nothing} Bob Bar a}');
  51425. $this->assertEquals($expected, $this->getLogs());
  51426. }
  51427. public function testObjectCastToString()
  51428. {
  51429. if (method_exists($this, 'createPartialMock')) {
  51430. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  51431. } else {
  51432. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  51433. }
  51434. $dummy->expects($this->once())
  51435. ->method('__toString')
  51436. ->will($this->returnValue('DUMMY'));
  51437. $this->getLogger()->warning($dummy);
  51438. $expected = array('warning DUMMY');
  51439. $this->assertEquals($expected, $this->getLogs());
  51440. }
  51441. public function testContextCanContainAnything()
  51442. {
  51443. $closed = fopen('php://memory', 'r');
  51444. fclose($closed);
  51445. $context = array(
  51446. 'bool' => true,
  51447. 'null' => null,
  51448. 'string' => 'Foo',
  51449. 'int' => 0,
  51450. 'float' => 0.5,
  51451. 'nested' => array('with object' => new DummyTest),
  51452. 'object' => new \DateTime,
  51453. 'resource' => fopen('php://memory', 'r'),
  51454. 'closed' => $closed,
  51455. );
  51456. $this->getLogger()->warning('Crazy context data', $context);
  51457. $expected = array('warning Crazy context data');
  51458. $this->assertEquals($expected, $this->getLogs());
  51459. }
  51460. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  51461. {
  51462. $logger = $this->getLogger();
  51463. $logger->warning('Random message', array('exception' => 'oops'));
  51464. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  51465. $expected = array(
  51466. 'warning Random message',
  51467. 'critical Uncaught Exception!'
  51468. );
  51469. $this->assertEquals($expected, $this->getLogs());
  51470. }
  51471. }
  51472. class DummyTest
  51473. {
  51474. public function __toString()
  51475. {
  51476. }
  51477. }
  51478. <?php
  51479. namespace Psr\Log\Test;
  51480. use Psr\Log\AbstractLogger;
  51481. class TestLogger extends AbstractLogger
  51482. {
  51483. public $records = [];
  51484. public $recordsByLevel = [];
  51485. public function log($level, $message, array $context = [])
  51486. {
  51487. $record = [
  51488. 'level' => $level,
  51489. 'message' => $message,
  51490. 'context' => $context,
  51491. ];
  51492. $this->recordsByLevel[$record['level']][] = $record;
  51493. $this->records[] = $record;
  51494. }
  51495. public function hasRecords($level)
  51496. {
  51497. return isset($this->recordsByLevel[$level]);
  51498. }
  51499. public function hasRecord($record, $level)
  51500. {
  51501. if (is_string($record)) {
  51502. $record = ['message' => $record];
  51503. }
  51504. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  51505. if ($rec['message'] !== $record['message']) {
  51506. return false;
  51507. }
  51508. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  51509. return false;
  51510. }
  51511. return true;
  51512. }, $level);
  51513. }
  51514. public function hasRecordThatContains($message, $level)
  51515. {
  51516. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  51517. return strpos($rec['message'], $message) !== false;
  51518. }, $level);
  51519. }
  51520. public function hasRecordThatMatches($regex, $level)
  51521. {
  51522. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  51523. return preg_match($regex, $rec['message']) > 0;
  51524. }, $level);
  51525. }
  51526. public function hasRecordThatPasses(callable $predicate, $level)
  51527. {
  51528. if (!isset($this->recordsByLevel[$level])) {
  51529. return false;
  51530. }
  51531. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  51532. if (call_user_func($predicate, $rec, $i)) {
  51533. return true;
  51534. }
  51535. }
  51536. return false;
  51537. }
  51538. public function __call($method, $args)
  51539. {
  51540. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  51541. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  51542. $level = strtolower($matches[2]);
  51543. if (method_exists($this, $genericMethod)) {
  51544. $args[] = $level;
  51545. return call_user_func_array([$this, $genericMethod], $args);
  51546. }
  51547. }
  51548. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  51549. }
  51550. public function reset()
  51551. {
  51552. $this->records = [];
  51553. }
  51554. }
  51555. <?php
  51556. require_once __DIR__ . '/composer/autoload_real.php';
  51557. return ComposerAutoloaderInitComposerPhar1549878730::getLoader();
  51558. <?php
  51559. $vendorDir = dirname(dirname(__FILE__));
  51560. $baseDir = dirname($vendorDir);
  51561. return array(
  51562. );
  51563. <?php
  51564. $vendorDir = dirname(dirname(__FILE__));
  51565. $baseDir = dirname($vendorDir);
  51566. return array(
  51567. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  51568. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  51569. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  51570. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  51571. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  51572. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  51573. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  51574. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  51575. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  51576. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  51577. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  51578. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  51579. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  51580. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  51581. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  51582. 'Composer\\' => array($baseDir . '/src/Composer'),
  51583. );
  51584. <?php
  51585. $vendorDir = dirname(dirname(__FILE__));
  51586. $baseDir = dirname($vendorDir);
  51587. return array(
  51588. );
  51589. <?php
  51590. $vendorDir = dirname(dirname(__FILE__));
  51591. $baseDir = dirname($vendorDir);
  51592. return array(
  51593. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  51594. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  51595. );
  51596. <?php
  51597. class ComposerAutoloaderInitComposerPhar1549878730
  51598. {
  51599. private static $loader;
  51600. public static function loadClassLoader($class)
  51601. {
  51602. if ('Composer\Autoload\ClassLoader' === $class) {
  51603. require __DIR__ . '/ClassLoader.php';
  51604. }
  51605. }
  51606. public static function getLoader()
  51607. {
  51608. if (null !== self::$loader) {
  51609. return self::$loader;
  51610. }
  51611. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1549878730', 'loadClassLoader'), true, true);
  51612. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  51613. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1549878730', 'loadClassLoader'));
  51614. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  51615. if ($useStaticLoader) {
  51616. require_once __DIR__ . '/autoload_static.php';
  51617. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1549878730::getInitializer($loader));
  51618. } else {
  51619. $map = require __DIR__ . '/autoload_namespaces.php';
  51620. foreach ($map as $namespace => $path) {
  51621. $loader->set($namespace, $path);
  51622. }
  51623. $map = require __DIR__ . '/autoload_psr4.php';
  51624. foreach ($map as $namespace => $path) {
  51625. $loader->setPsr4($namespace, $path);
  51626. }
  51627. $classMap = require __DIR__ . '/autoload_classmap.php';
  51628. if ($classMap) {
  51629. $loader->addClassMap($classMap);
  51630. }
  51631. }
  51632. $loader->register(true);
  51633. if ($useStaticLoader) {
  51634. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1549878730::$files;
  51635. } else {
  51636. $includeFiles = require __DIR__ . '/autoload_files.php';
  51637. }
  51638. foreach ($includeFiles as $fileIdentifier => $file) {
  51639. composerRequireComposerPhar1549878730($fileIdentifier, $file);
  51640. }
  51641. return $loader;
  51642. }
  51643. }
  51644. function composerRequireComposerPhar1549878730($fileIdentifier, $file)
  51645. {
  51646. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  51647. require $file;
  51648. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  51649. }
  51650. }
  51651. <?php
  51652. namespace Composer\Autoload;
  51653. class ComposerStaticInitComposerPhar1549878730
  51654. {
  51655. public static $files = array (
  51656. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  51657. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  51658. );
  51659. public static $prefixLengthsPsr4 = array (
  51660. 'S' =>
  51661. array (
  51662. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  51663. 'Symfony\\Polyfill\\Ctype\\' => 23,
  51664. 'Symfony\\Component\\Process\\' => 26,
  51665. 'Symfony\\Component\\Finder\\' => 25,
  51666. 'Symfony\\Component\\Filesystem\\' => 29,
  51667. 'Symfony\\Component\\Debug\\' => 24,
  51668. 'Symfony\\Component\\Console\\' => 26,
  51669. 'Seld\\PharUtils\\' => 15,
  51670. 'Seld\\JsonLint\\' => 14,
  51671. ),
  51672. 'P' =>
  51673. array (
  51674. 'Psr\\Log\\' => 8,
  51675. ),
  51676. 'J' =>
  51677. array (
  51678. 'JsonSchema\\' => 11,
  51679. ),
  51680. 'C' =>
  51681. array (
  51682. 'Composer\\XdebugHandler\\' => 23,
  51683. 'Composer\\Spdx\\' => 14,
  51684. 'Composer\\Semver\\' => 16,
  51685. 'Composer\\CaBundle\\' => 18,
  51686. 'Composer\\' => 9,
  51687. ),
  51688. );
  51689. public static $prefixDirsPsr4 = array (
  51690. 'Symfony\\Polyfill\\Mbstring\\' =>
  51691. array (
  51692. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  51693. ),
  51694. 'Symfony\\Polyfill\\Ctype\\' =>
  51695. array (
  51696. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  51697. ),
  51698. 'Symfony\\Component\\Process\\' =>
  51699. array (
  51700. 0 => __DIR__ . '/..' . '/symfony/process',
  51701. ),
  51702. 'Symfony\\Component\\Finder\\' =>
  51703. array (
  51704. 0 => __DIR__ . '/..' . '/symfony/finder',
  51705. ),
  51706. 'Symfony\\Component\\Filesystem\\' =>
  51707. array (
  51708. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  51709. ),
  51710. 'Symfony\\Component\\Debug\\' =>
  51711. array (
  51712. 0 => __DIR__ . '/..' . '/symfony/debug',
  51713. ),
  51714. 'Symfony\\Component\\Console\\' =>
  51715. array (
  51716. 0 => __DIR__ . '/..' . '/symfony/console',
  51717. ),
  51718. 'Seld\\PharUtils\\' =>
  51719. array (
  51720. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  51721. ),
  51722. 'Seld\\JsonLint\\' =>
  51723. array (
  51724. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  51725. ),
  51726. 'Psr\\Log\\' =>
  51727. array (
  51728. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  51729. ),
  51730. 'JsonSchema\\' =>
  51731. array (
  51732. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  51733. ),
  51734. 'Composer\\XdebugHandler\\' =>
  51735. array (
  51736. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  51737. ),
  51738. 'Composer\\Spdx\\' =>
  51739. array (
  51740. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  51741. ),
  51742. 'Composer\\Semver\\' =>
  51743. array (
  51744. 0 => __DIR__ . '/..' . '/composer/semver/src',
  51745. ),
  51746. 'Composer\\CaBundle\\' =>
  51747. array (
  51748. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  51749. ),
  51750. 'Composer\\' =>
  51751. array (
  51752. 0 => __DIR__ . '/../..' . '/src/Composer',
  51753. ),
  51754. );
  51755. public static function getInitializer(ClassLoader $loader)
  51756. {
  51757. return \Closure::bind(function () use ($loader) {
  51758. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1549878730::$prefixLengthsPsr4;
  51759. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1549878730::$prefixDirsPsr4;
  51760. }, null, ClassLoader::class);
  51761. }
  51762. }
  51763. <?php
  51764. namespace Composer\Autoload;
  51765. class ClassLoader
  51766. {
  51767. private $prefixLengthsPsr4 = array();
  51768. private $prefixDirsPsr4 = array();
  51769. private $fallbackDirsPsr4 = array();
  51770. private $prefixesPsr0 = array();
  51771. private $fallbackDirsPsr0 = array();
  51772. private $useIncludePath = false;
  51773. private $classMap = array();
  51774. private $classMapAuthoritative = false;
  51775. private $missingClasses = array();
  51776. private $apcuPrefix;
  51777. public function getPrefixes()
  51778. {
  51779. if (!empty($this->prefixesPsr0)) {
  51780. return call_user_func_array('array_merge', $this->prefixesPsr0);
  51781. }
  51782. return array();
  51783. }
  51784. public function getPrefixesPsr4()
  51785. {
  51786. return $this->prefixDirsPsr4;
  51787. }
  51788. public function getFallbackDirs()
  51789. {
  51790. return $this->fallbackDirsPsr0;
  51791. }
  51792. public function getFallbackDirsPsr4()
  51793. {
  51794. return $this->fallbackDirsPsr4;
  51795. }
  51796. public function getClassMap()
  51797. {
  51798. return $this->classMap;
  51799. }
  51800. public function addClassMap(array $classMap)
  51801. {
  51802. if ($this->classMap) {
  51803. $this->classMap = array_merge($this->classMap, $classMap);
  51804. } else {
  51805. $this->classMap = $classMap;
  51806. }
  51807. }
  51808. public function add($prefix, $paths, $prepend = false)
  51809. {
  51810. if (!$prefix) {
  51811. if ($prepend) {
  51812. $this->fallbackDirsPsr0 = array_merge(
  51813. (array) $paths,
  51814. $this->fallbackDirsPsr0
  51815. );
  51816. } else {
  51817. $this->fallbackDirsPsr0 = array_merge(
  51818. $this->fallbackDirsPsr0,
  51819. (array) $paths
  51820. );
  51821. }
  51822. return;
  51823. }
  51824. $first = $prefix[0];
  51825. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  51826. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  51827. return;
  51828. }
  51829. if ($prepend) {
  51830. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51831. (array) $paths,
  51832. $this->prefixesPsr0[$first][$prefix]
  51833. );
  51834. } else {
  51835. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51836. $this->prefixesPsr0[$first][$prefix],
  51837. (array) $paths
  51838. );
  51839. }
  51840. }
  51841. public function addPsr4($prefix, $paths, $prepend = false)
  51842. {
  51843. if (!$prefix) {
  51844. if ($prepend) {
  51845. $this->fallbackDirsPsr4 = array_merge(
  51846. (array) $paths,
  51847. $this->fallbackDirsPsr4
  51848. );
  51849. } else {
  51850. $this->fallbackDirsPsr4 = array_merge(
  51851. $this->fallbackDirsPsr4,
  51852. (array) $paths
  51853. );
  51854. }
  51855. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  51856. $length = strlen($prefix);
  51857. if ('\\' !== $prefix[$length - 1]) {
  51858. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51859. }
  51860. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51861. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51862. } elseif ($prepend) {
  51863. $this->prefixDirsPsr4[$prefix] = array_merge(
  51864. (array) $paths,
  51865. $this->prefixDirsPsr4[$prefix]
  51866. );
  51867. } else {
  51868. $this->prefixDirsPsr4[$prefix] = array_merge(
  51869. $this->prefixDirsPsr4[$prefix],
  51870. (array) $paths
  51871. );
  51872. }
  51873. }
  51874. public function set($prefix, $paths)
  51875. {
  51876. if (!$prefix) {
  51877. $this->fallbackDirsPsr0 = (array) $paths;
  51878. } else {
  51879. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  51880. }
  51881. }
  51882. public function setPsr4($prefix, $paths)
  51883. {
  51884. if (!$prefix) {
  51885. $this->fallbackDirsPsr4 = (array) $paths;
  51886. } else {
  51887. $length = strlen($prefix);
  51888. if ('\\' !== $prefix[$length - 1]) {
  51889. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51890. }
  51891. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51892. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51893. }
  51894. }
  51895. public function setUseIncludePath($useIncludePath)
  51896. {
  51897. $this->useIncludePath = $useIncludePath;
  51898. }
  51899. public function getUseIncludePath()
  51900. {
  51901. return $this->useIncludePath;
  51902. }
  51903. public function setClassMapAuthoritative($classMapAuthoritative)
  51904. {
  51905. $this->classMapAuthoritative = $classMapAuthoritative;
  51906. }
  51907. public function isClassMapAuthoritative()
  51908. {
  51909. return $this->classMapAuthoritative;
  51910. }
  51911. public function setApcuPrefix($apcuPrefix)
  51912. {
  51913. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  51914. }
  51915. public function getApcuPrefix()
  51916. {
  51917. return $this->apcuPrefix;
  51918. }
  51919. public function register($prepend = false)
  51920. {
  51921. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  51922. }
  51923. public function unregister()
  51924. {
  51925. spl_autoload_unregister(array($this, 'loadClass'));
  51926. }
  51927. public function loadClass($class)
  51928. {
  51929. if ($file = $this->findFile($class)) {
  51930. includeFile($file);
  51931. return true;
  51932. }
  51933. }
  51934. public function findFile($class)
  51935. {
  51936. if (isset($this->classMap[$class])) {
  51937. return $this->classMap[$class];
  51938. }
  51939. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  51940. return false;
  51941. }
  51942. if (null !== $this->apcuPrefix) {
  51943. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  51944. if ($hit) {
  51945. return $file;
  51946. }
  51947. }
  51948. $file = $this->findFileWithExtension($class, '.php');
  51949. if (false === $file && defined('HHVM_VERSION')) {
  51950. $file = $this->findFileWithExtension($class, '.hh');
  51951. }
  51952. if (null !== $this->apcuPrefix) {
  51953. apcu_add($this->apcuPrefix.$class, $file);
  51954. }
  51955. if (false === $file) {
  51956. $this->missingClasses[$class] = true;
  51957. }
  51958. return $file;
  51959. }
  51960. private function findFileWithExtension($class, $ext)
  51961. {
  51962. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  51963. $first = $class[0];
  51964. if (isset($this->prefixLengthsPsr4[$first])) {
  51965. $subPath = $class;
  51966. while (false !== $lastPos = strrpos($subPath, '\\')) {
  51967. $subPath = substr($subPath, 0, $lastPos);
  51968. $search = $subPath . '\\';
  51969. if (isset($this->prefixDirsPsr4[$search])) {
  51970. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  51971. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  51972. if (file_exists($file = $dir . $pathEnd)) {
  51973. return $file;
  51974. }
  51975. }
  51976. }
  51977. }
  51978. }
  51979. foreach ($this->fallbackDirsPsr4 as $dir) {
  51980. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  51981. return $file;
  51982. }
  51983. }
  51984. if (false !== $pos = strrpos($class, '\\')) {
  51985. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  51986. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  51987. } else {
  51988. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  51989. }
  51990. if (isset($this->prefixesPsr0[$first])) {
  51991. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  51992. if (0 === strpos($class, $prefix)) {
  51993. foreach ($dirs as $dir) {
  51994. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  51995. return $file;
  51996. }
  51997. }
  51998. }
  51999. }
  52000. }
  52001. foreach ($this->fallbackDirsPsr0 as $dir) {
  52002. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52003. return $file;
  52004. }
  52005. }
  52006. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  52007. return $file;
  52008. }
  52009. return false;
  52010. }
  52011. }
  52012. function includeFile($file)
  52013. {
  52014. include $file;
  52015. }
  52016. ##
  52017. ## Bundle of CA Root Certificates
  52018. ##
  52019. ## Certificate data from Mozilla as of: Wed Jan 23 04:12:09 2019 GMT
  52020. ##
  52021. ## This is a bundle of X.509 certificates of public Certificate Authorities
  52022. ## (CA). These were automatically extracted from Mozilla's root certificates
  52023. ## file (certdata.txt). This file can be found in the mozilla source tree:
  52024. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  52025. ##
  52026. ## It contains the certificates in PEM format and therefore
  52027. ## can be directly used with curl / libcurl / php_curl, or with
  52028. ## an Apache+mod_ssl webserver for SSL client authentication.
  52029. ## Just configure this file as the SSLCACertificateFile.
  52030. ##
  52031. ## Conversion done with mk-ca-bundle.pl version 1.27.
  52032. ## SHA256: 18372117493b5b7ec006c31d966143fc95a9464a2b5f8d5188e23c5557b2292d
  52033. ##
  52034. GlobalSign Root CA
  52035. ==================
  52036. -----BEGIN CERTIFICATE-----
  52037. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  52038. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  52039. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  52040. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  52041. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  52042. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  52043. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  52044. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  52045. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  52046. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  52047. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  52048. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  52049. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  52050. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  52051. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  52052. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  52053. -----END CERTIFICATE-----
  52054. GlobalSign Root CA - R2
  52055. =======================
  52056. -----BEGIN CERTIFICATE-----
  52057. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  52058. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52059. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52060. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52061. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  52062. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  52063. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  52064. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  52065. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  52066. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  52067. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  52068. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  52069. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  52070. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  52071. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  52072. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  52073. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  52074. -----END CERTIFICATE-----
  52075. Verisign Class 3 Public Primary Certification Authority - G3
  52076. ============================================================
  52077. -----BEGIN CERTIFICATE-----
  52078. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  52079. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52080. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52081. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  52082. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  52083. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  52084. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  52085. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  52086. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52087. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  52088. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  52089. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  52090. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  52091. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  52092. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  52093. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  52094. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  52095. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  52096. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  52097. -----END CERTIFICATE-----
  52098. Entrust.net Premium 2048 Secure Server CA
  52099. =========================================
  52100. -----BEGIN CERTIFICATE-----
  52101. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  52102. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  52103. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  52104. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  52105. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  52106. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  52107. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  52108. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52109. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  52110. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  52111. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  52112. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  52113. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  52114. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  52115. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  52116. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  52117. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  52118. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  52119. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  52120. -----END CERTIFICATE-----
  52121. Baltimore CyberTrust Root
  52122. =========================
  52123. -----BEGIN CERTIFICATE-----
  52124. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  52125. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  52126. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  52127. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  52128. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  52129. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  52130. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  52131. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  52132. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  52133. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  52134. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  52135. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  52136. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  52137. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  52138. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  52139. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  52140. -----END CERTIFICATE-----
  52141. AddTrust External Root
  52142. ======================
  52143. -----BEGIN CERTIFICATE-----
  52144. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  52145. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  52146. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  52147. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  52148. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  52149. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  52150. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  52151. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  52152. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  52153. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  52154. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  52155. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  52156. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  52157. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  52158. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  52159. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  52160. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  52161. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  52162. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  52163. -----END CERTIFICATE-----
  52164. Entrust Root Certification Authority
  52165. ====================================
  52166. -----BEGIN CERTIFICATE-----
  52167. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  52168. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  52169. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  52170. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  52171. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  52172. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  52173. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  52174. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52175. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  52176. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  52177. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  52178. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  52179. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  52180. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  52181. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  52182. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  52183. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  52184. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  52185. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  52186. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  52187. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  52188. -----END CERTIFICATE-----
  52189. GeoTrust Global CA
  52190. ==================
  52191. -----BEGIN CERTIFICATE-----
  52192. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  52193. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  52194. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  52195. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52196. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  52197. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  52198. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  52199. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  52200. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  52201. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  52202. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  52203. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  52204. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  52205. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  52206. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  52207. Mw==
  52208. -----END CERTIFICATE-----
  52209. GeoTrust Universal CA
  52210. =====================
  52211. -----BEGIN CERTIFICATE-----
  52212. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52213. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  52214. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  52215. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  52216. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  52217. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  52218. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  52219. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  52220. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  52221. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  52222. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  52223. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  52224. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  52225. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  52226. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  52227. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  52228. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  52229. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  52230. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  52231. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  52232. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  52233. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  52234. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  52235. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  52236. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  52237. -----END CERTIFICATE-----
  52238. GeoTrust Universal CA 2
  52239. =======================
  52240. -----BEGIN CERTIFICATE-----
  52241. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52242. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  52243. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  52244. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  52245. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  52246. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  52247. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  52248. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  52249. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  52250. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  52251. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  52252. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  52253. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  52254. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  52255. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  52256. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  52257. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  52258. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  52259. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  52260. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  52261. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  52262. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  52263. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  52264. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  52265. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  52266. -----END CERTIFICATE-----
  52267. Comodo AAA Services root
  52268. ========================
  52269. -----BEGIN CERTIFICATE-----
  52270. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  52271. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  52272. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  52273. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  52274. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  52275. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52276. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  52277. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  52278. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  52279. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  52280. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  52281. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  52282. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  52283. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  52284. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  52285. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  52286. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  52287. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  52288. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  52289. -----END CERTIFICATE-----
  52290. QuoVadis Root CA
  52291. ================
  52292. -----BEGIN CERTIFICATE-----
  52293. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  52294. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  52295. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  52296. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  52297. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  52298. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  52299. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  52300. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  52301. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  52302. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  52303. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  52304. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  52305. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  52306. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  52307. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  52308. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  52309. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  52310. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  52311. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  52312. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  52313. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  52314. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  52315. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  52316. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  52317. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  52318. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  52319. 5nrQNiOKSnQ2+Q==
  52320. -----END CERTIFICATE-----
  52321. QuoVadis Root CA 2
  52322. ==================
  52323. -----BEGIN CERTIFICATE-----
  52324. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52325. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  52326. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52327. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52328. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  52329. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  52330. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  52331. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  52332. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  52333. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  52334. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  52335. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  52336. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  52337. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  52338. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  52339. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  52340. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  52341. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  52342. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  52343. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  52344. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  52345. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  52346. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  52347. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  52348. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  52349. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  52350. -----END CERTIFICATE-----
  52351. QuoVadis Root CA 3
  52352. ==================
  52353. -----BEGIN CERTIFICATE-----
  52354. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52355. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  52356. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52357. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52358. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  52359. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  52360. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  52361. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  52362. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  52363. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  52364. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  52365. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  52366. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  52367. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  52368. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  52369. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  52370. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  52371. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  52372. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  52373. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  52374. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  52375. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  52376. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  52377. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  52378. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  52379. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  52380. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  52381. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  52382. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  52383. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  52384. -----END CERTIFICATE-----
  52385. Security Communication Root CA
  52386. ==============================
  52387. -----BEGIN CERTIFICATE-----
  52388. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52389. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52390. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52391. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52392. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  52393. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  52394. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  52395. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  52396. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  52397. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  52398. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  52399. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  52400. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  52401. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  52402. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  52403. FL39vmwLAw==
  52404. -----END CERTIFICATE-----
  52405. Sonera Class 2 Root CA
  52406. ======================
  52407. -----BEGIN CERTIFICATE-----
  52408. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  52409. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  52410. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  52411. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  52412. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  52413. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  52414. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  52415. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  52416. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  52417. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  52418. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  52419. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  52420. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  52421. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  52422. llpwrN9M
  52423. -----END CERTIFICATE-----
  52424. XRamp Global CA Root
  52425. ====================
  52426. -----BEGIN CERTIFICATE-----
  52427. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  52428. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  52429. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  52430. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  52431. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  52432. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52433. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  52434. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  52435. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  52436. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  52437. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  52438. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52439. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  52440. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  52441. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  52442. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  52443. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  52444. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  52445. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  52446. -----END CERTIFICATE-----
  52447. Go Daddy Class 2 CA
  52448. ===================
  52449. -----BEGIN CERTIFICATE-----
  52450. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  52451. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  52452. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  52453. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  52454. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  52455. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  52456. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  52457. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  52458. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  52459. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  52460. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  52461. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  52462. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  52463. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  52464. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  52465. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  52466. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  52467. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  52468. vZ8=
  52469. -----END CERTIFICATE-----
  52470. Starfield Class 2 CA
  52471. ====================
  52472. -----BEGIN CERTIFICATE-----
  52473. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  52474. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  52475. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  52476. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  52477. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  52478. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  52479. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  52480. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  52481. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  52482. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  52483. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  52484. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  52485. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  52486. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  52487. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  52488. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  52489. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  52490. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  52491. QBFGmh95DmK/D5fs4C8fF5Q=
  52492. -----END CERTIFICATE-----
  52493. Taiwan GRCA
  52494. ===========
  52495. -----BEGIN CERTIFICATE-----
  52496. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  52497. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  52498. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  52499. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52500. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  52501. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  52502. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  52503. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  52504. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  52505. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  52506. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  52507. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  52508. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  52509. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  52510. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  52511. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  52512. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  52513. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  52514. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  52515. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  52516. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  52517. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  52518. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  52519. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  52520. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  52521. -----END CERTIFICATE-----
  52522. DigiCert Assured ID Root CA
  52523. ===========================
  52524. -----BEGIN CERTIFICATE-----
  52525. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  52526. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52527. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  52528. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52529. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  52530. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  52531. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  52532. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  52533. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  52534. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  52535. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  52536. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  52537. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  52538. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  52539. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  52540. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  52541. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  52542. -----END CERTIFICATE-----
  52543. DigiCert Global Root CA
  52544. =======================
  52545. -----BEGIN CERTIFICATE-----
  52546. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  52547. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52548. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  52549. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52550. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  52551. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  52552. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  52553. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  52554. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  52555. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  52556. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  52557. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  52558. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  52559. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  52560. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  52561. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  52562. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  52563. -----END CERTIFICATE-----
  52564. DigiCert High Assurance EV Root CA
  52565. ==================================
  52566. -----BEGIN CERTIFICATE-----
  52567. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  52568. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  52569. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  52570. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  52571. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  52572. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  52573. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  52574. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  52575. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  52576. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  52577. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  52578. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  52579. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  52580. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  52581. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  52582. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  52583. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  52584. -----END CERTIFICATE-----
  52585. Certplus Class 2 Primary CA
  52586. ===========================
  52587. -----BEGIN CERTIFICATE-----
  52588. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  52589. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  52590. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  52591. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  52592. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  52593. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  52594. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  52595. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  52596. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  52597. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  52598. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  52599. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  52600. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  52601. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  52602. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  52603. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  52604. l7+ijrRU
  52605. -----END CERTIFICATE-----
  52606. DST Root CA X3
  52607. ==============
  52608. -----BEGIN CERTIFICATE-----
  52609. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  52610. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  52611. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  52612. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  52613. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  52614. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  52615. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  52616. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  52617. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  52618. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  52619. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  52620. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  52621. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  52622. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  52623. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  52624. -----END CERTIFICATE-----
  52625. SwissSign Gold CA - G2
  52626. ======================
  52627. -----BEGIN CERTIFICATE-----
  52628. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  52629. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  52630. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  52631. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  52632. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  52633. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  52634. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  52635. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  52636. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  52637. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  52638. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  52639. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  52640. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  52641. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  52642. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  52643. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  52644. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  52645. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  52646. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  52647. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  52648. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  52649. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  52650. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  52651. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  52652. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  52653. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  52654. -----END CERTIFICATE-----
  52655. SwissSign Silver CA - G2
  52656. ========================
  52657. -----BEGIN CERTIFICATE-----
  52658. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  52659. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  52660. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  52661. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  52662. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  52663. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  52664. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  52665. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  52666. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  52667. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  52668. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  52669. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  52670. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  52671. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  52672. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  52673. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  52674. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  52675. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  52676. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  52677. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  52678. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  52679. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  52680. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  52681. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  52682. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  52683. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  52684. -----END CERTIFICATE-----
  52685. GeoTrust Primary Certification Authority
  52686. ========================================
  52687. -----BEGIN CERTIFICATE-----
  52688. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  52689. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  52690. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  52691. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  52692. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52693. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  52694. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  52695. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  52696. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  52697. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52698. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  52699. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  52700. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  52701. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  52702. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  52703. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  52704. -----END CERTIFICATE-----
  52705. thawte Primary Root CA
  52706. ======================
  52707. -----BEGIN CERTIFICATE-----
  52708. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  52709. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52710. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52711. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  52712. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  52713. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  52714. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  52715. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  52716. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  52717. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  52718. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  52719. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  52720. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  52721. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  52722. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  52723. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  52724. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  52725. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  52726. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  52727. -----END CERTIFICATE-----
  52728. VeriSign Class 3 Public Primary Certification Authority - G5
  52729. ============================================================
  52730. -----BEGIN CERTIFICATE-----
  52731. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  52732. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52733. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52734. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  52735. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  52736. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  52737. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  52738. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  52739. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  52740. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  52741. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  52742. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  52743. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  52744. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  52745. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  52746. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  52747. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  52748. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  52749. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  52750. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  52751. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  52752. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  52753. -----END CERTIFICATE-----
  52754. SecureTrust CA
  52755. ==============
  52756. -----BEGIN CERTIFICATE-----
  52757. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  52758. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  52759. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  52760. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  52761. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  52762. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  52763. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  52764. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  52765. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  52766. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  52767. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  52768. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52769. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  52770. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  52771. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  52772. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  52773. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  52774. -----END CERTIFICATE-----
  52775. Secure Global CA
  52776. ================
  52777. -----BEGIN CERTIFICATE-----
  52778. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  52779. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  52780. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  52781. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  52782. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  52783. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  52784. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  52785. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  52786. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  52787. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52788. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  52789. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  52790. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  52791. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  52792. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  52793. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  52794. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  52795. -----END CERTIFICATE-----
  52796. COMODO Certification Authority
  52797. ==============================
  52798. -----BEGIN CERTIFICATE-----
  52799. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  52800. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52801. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  52802. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  52803. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  52804. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52805. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  52806. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  52807. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  52808. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  52809. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  52810. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  52811. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  52812. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  52813. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  52814. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  52815. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  52816. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  52817. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  52818. -----END CERTIFICATE-----
  52819. Network Solutions Certificate Authority
  52820. =======================================
  52821. -----BEGIN CERTIFICATE-----
  52822. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  52823. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  52824. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  52825. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  52826. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  52827. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  52828. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  52829. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  52830. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  52831. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  52832. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  52833. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  52834. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  52835. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  52836. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  52837. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  52838. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  52839. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  52840. -----END CERTIFICATE-----
  52841. COMODO ECC Certification Authority
  52842. ==================================
  52843. -----BEGIN CERTIFICATE-----
  52844. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  52845. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52846. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  52847. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  52848. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  52849. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  52850. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  52851. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  52852. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  52853. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  52854. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  52855. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  52856. -----END CERTIFICATE-----
  52857. OISTE WISeKey Global Root GA CA
  52858. ===============================
  52859. -----BEGIN CERTIFICATE-----
  52860. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  52861. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  52862. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  52863. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  52864. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  52865. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  52866. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  52867. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  52868. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  52869. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  52870. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  52871. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  52872. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52873. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  52874. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  52875. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  52876. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  52877. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  52878. -----END CERTIFICATE-----
  52879. Certigna
  52880. ========
  52881. -----BEGIN CERTIFICATE-----
  52882. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  52883. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  52884. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  52885. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  52886. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  52887. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  52888. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  52889. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  52890. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  52891. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  52892. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  52893. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  52894. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  52895. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  52896. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  52897. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  52898. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  52899. -----END CERTIFICATE-----
  52900. Deutsche Telekom Root CA 2
  52901. ==========================
  52902. -----BEGIN CERTIFICATE-----
  52903. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  52904. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  52905. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  52906. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  52907. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  52908. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  52909. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  52910. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  52911. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  52912. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  52913. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  52914. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  52915. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  52916. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  52917. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  52918. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  52919. Cm26OWMohpLzGITY+9HPBVZkVw==
  52920. -----END CERTIFICATE-----
  52921. Cybertrust Global Root
  52922. ======================
  52923. -----BEGIN CERTIFICATE-----
  52924. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  52925. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  52926. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  52927. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  52928. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  52929. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  52930. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  52931. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  52932. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  52933. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  52934. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  52935. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  52936. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  52937. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  52938. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  52939. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  52940. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  52941. -----END CERTIFICATE-----
  52942. ePKI Root Certification Authority
  52943. =================================
  52944. -----BEGIN CERTIFICATE-----
  52945. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  52946. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  52947. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  52948. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  52949. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  52950. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  52951. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  52952. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  52953. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  52954. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  52955. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  52956. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  52957. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  52958. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  52959. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  52960. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  52961. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  52962. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  52963. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  52964. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  52965. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  52966. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  52967. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  52968. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  52969. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  52970. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  52971. -----END CERTIFICATE-----
  52972. certSIGN ROOT CA
  52973. ================
  52974. -----BEGIN CERTIFICATE-----
  52975. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  52976. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  52977. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  52978. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  52979. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  52980. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  52981. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  52982. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  52983. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  52984. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  52985. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  52986. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  52987. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  52988. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  52989. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  52990. -----END CERTIFICATE-----
  52991. GeoTrust Primary Certification Authority - G3
  52992. =============================================
  52993. -----BEGIN CERTIFICATE-----
  52994. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  52995. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  52996. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  52997. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  52998. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  52999. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  53000. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  53001. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  53002. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  53003. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  53004. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  53005. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  53006. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  53007. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  53008. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  53009. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  53010. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  53011. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  53012. -----END CERTIFICATE-----
  53013. thawte Primary Root CA - G2
  53014. ===========================
  53015. -----BEGIN CERTIFICATE-----
  53016. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  53017. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  53018. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  53019. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  53020. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  53021. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  53022. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  53023. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  53024. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  53025. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  53026. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  53027. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  53028. -----END CERTIFICATE-----
  53029. thawte Primary Root CA - G3
  53030. ===========================
  53031. -----BEGIN CERTIFICATE-----
  53032. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  53033. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53034. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53035. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  53036. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  53037. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  53038. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  53039. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53040. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  53041. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  53042. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  53043. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  53044. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  53045. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  53046. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  53047. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  53048. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  53049. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  53050. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  53051. -----END CERTIFICATE-----
  53052. GeoTrust Primary Certification Authority - G2
  53053. =============================================
  53054. -----BEGIN CERTIFICATE-----
  53055. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  53056. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  53057. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  53058. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  53059. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  53060. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  53061. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  53062. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  53063. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  53064. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  53065. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  53066. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  53067. npaqBA+K
  53068. -----END CERTIFICATE-----
  53069. VeriSign Universal Root Certification Authority
  53070. ===============================================
  53071. -----BEGIN CERTIFICATE-----
  53072. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  53073. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53074. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53075. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  53076. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  53077. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  53078. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  53079. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  53080. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  53081. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  53082. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  53083. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  53084. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  53085. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  53086. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  53087. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  53088. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  53089. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  53090. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  53091. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  53092. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  53093. mJO37M2CYfE45k+XmCpajQ==
  53094. -----END CERTIFICATE-----
  53095. VeriSign Class 3 Public Primary Certification Authority - G4
  53096. ============================================================
  53097. -----BEGIN CERTIFICATE-----
  53098. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  53099. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  53100. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  53101. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  53102. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  53103. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  53104. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  53105. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  53106. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  53107. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  53108. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  53109. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  53110. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  53111. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  53112. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  53113. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  53114. -----END CERTIFICATE-----
  53115. NetLock Arany (Class Gold) Főtanúsítvány
  53116. ========================================
  53117. -----BEGIN CERTIFICATE-----
  53118. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  53119. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  53120. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  53121. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  53122. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  53123. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  53124. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  53125. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  53126. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  53127. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  53128. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  53129. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  53130. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  53131. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  53132. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  53133. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  53134. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  53135. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  53136. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  53137. -----END CERTIFICATE-----
  53138. Staat der Nederlanden Root CA - G2
  53139. ==================================
  53140. -----BEGIN CERTIFICATE-----
  53141. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53142. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53143. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  53144. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53145. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  53146. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  53147. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  53148. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  53149. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  53150. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  53151. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  53152. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  53153. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  53154. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  53155. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  53156. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  53157. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  53158. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  53159. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  53160. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  53161. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  53162. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  53163. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  53164. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  53165. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  53166. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  53167. 66+KAQ==
  53168. -----END CERTIFICATE-----
  53169. Hongkong Post Root CA 1
  53170. =======================
  53171. -----BEGIN CERTIFICATE-----
  53172. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  53173. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  53174. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  53175. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  53176. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  53177. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  53178. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  53179. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  53180. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  53181. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  53182. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  53183. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  53184. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  53185. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  53186. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  53187. -----END CERTIFICATE-----
  53188. SecureSign RootCA11
  53189. ===================
  53190. -----BEGIN CERTIFICATE-----
  53191. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  53192. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  53193. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  53194. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  53195. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  53196. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  53197. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  53198. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  53199. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  53200. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  53201. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  53202. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  53203. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  53204. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  53205. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  53206. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  53207. -----END CERTIFICATE-----
  53208. Microsec e-Szigno Root CA 2009
  53209. ==============================
  53210. -----BEGIN CERTIFICATE-----
  53211. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  53212. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  53213. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  53214. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  53215. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  53216. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  53217. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  53218. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  53219. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  53220. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  53221. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  53222. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  53223. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  53224. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  53225. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  53226. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  53227. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  53228. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  53229. LXpUq3DDfSJlgnCW
  53230. -----END CERTIFICATE-----
  53231. GlobalSign Root CA - R3
  53232. =======================
  53233. -----BEGIN CERTIFICATE-----
  53234. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  53235. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  53236. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  53237. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  53238. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  53239. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  53240. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  53241. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  53242. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  53243. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53244. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  53245. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  53246. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  53247. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  53248. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  53249. kpeDMdmztcpHWD9f
  53250. -----END CERTIFICATE-----
  53251. Autoridad de Certificacion Firmaprofesional CIF A62634068
  53252. =========================================================
  53253. -----BEGIN CERTIFICATE-----
  53254. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  53255. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  53256. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  53257. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  53258. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  53259. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  53260. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  53261. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  53262. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  53263. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  53264. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  53265. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  53266. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  53267. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  53268. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  53269. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  53270. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  53271. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  53272. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  53273. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  53274. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  53275. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  53276. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  53277. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  53278. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  53279. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  53280. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  53281. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  53282. -----END CERTIFICATE-----
  53283. Izenpe.com
  53284. ==========
  53285. -----BEGIN CERTIFICATE-----
  53286. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  53287. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  53288. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  53289. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  53290. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  53291. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  53292. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  53293. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  53294. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  53295. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  53296. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  53297. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  53298. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  53299. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  53300. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  53301. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  53302. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53303. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  53304. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  53305. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  53306. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  53307. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  53308. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  53309. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  53310. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  53311. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  53312. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  53313. -----END CERTIFICATE-----
  53314. Chambers of Commerce Root - 2008
  53315. ================================
  53316. -----BEGIN CERTIFICATE-----
  53317. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  53318. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53319. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53320. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  53321. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  53322. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  53323. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  53324. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  53325. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  53326. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  53327. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  53328. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  53329. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  53330. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  53331. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  53332. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  53333. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  53334. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  53335. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  53336. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  53337. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  53338. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  53339. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  53340. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  53341. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  53342. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  53343. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  53344. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  53345. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  53346. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  53347. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  53348. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  53349. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  53350. -----END CERTIFICATE-----
  53351. Global Chambersign Root - 2008
  53352. ==============================
  53353. -----BEGIN CERTIFICATE-----
  53354. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  53355. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53356. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53357. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  53358. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  53359. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  53360. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  53361. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  53362. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  53363. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  53364. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  53365. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  53366. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  53367. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  53368. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  53369. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  53370. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  53371. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  53372. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  53373. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  53374. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  53375. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  53376. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  53377. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  53378. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  53379. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  53380. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  53381. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  53382. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  53383. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  53384. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  53385. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  53386. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  53387. -----END CERTIFICATE-----
  53388. Go Daddy Root Certificate Authority - G2
  53389. ========================================
  53390. -----BEGIN CERTIFICATE-----
  53391. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53392. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  53393. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  53394. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  53395. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  53396. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  53397. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  53398. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  53399. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  53400. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  53401. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  53402. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  53403. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  53404. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  53405. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  53406. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  53407. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  53408. -----END CERTIFICATE-----
  53409. Starfield Root Certificate Authority - G2
  53410. =========================================
  53411. -----BEGIN CERTIFICATE-----
  53412. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53413. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53414. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  53415. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  53416. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  53417. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  53418. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  53419. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  53420. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  53421. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  53422. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  53423. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53424. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  53425. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  53426. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  53427. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  53428. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  53429. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  53430. -----END CERTIFICATE-----
  53431. Starfield Services Root Certificate Authority - G2
  53432. ==================================================
  53433. -----BEGIN CERTIFICATE-----
  53434. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53435. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53436. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  53437. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  53438. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  53439. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  53440. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  53441. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  53442. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  53443. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  53444. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  53445. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  53446. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  53447. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  53448. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  53449. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  53450. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  53451. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  53452. -----END CERTIFICATE-----
  53453. AffirmTrust Commercial
  53454. ======================
  53455. -----BEGIN CERTIFICATE-----
  53456. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53457. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  53458. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53459. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  53460. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  53461. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  53462. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  53463. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  53464. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  53465. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53466. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  53467. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  53468. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  53469. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  53470. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  53471. -----END CERTIFICATE-----
  53472. AffirmTrust Networking
  53473. ======================
  53474. -----BEGIN CERTIFICATE-----
  53475. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53476. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  53477. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53478. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  53479. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  53480. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  53481. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  53482. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  53483. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  53484. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53485. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  53486. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  53487. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  53488. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  53489. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  53490. -----END CERTIFICATE-----
  53491. AffirmTrust Premium
  53492. ===================
  53493. -----BEGIN CERTIFICATE-----
  53494. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  53495. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  53496. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  53497. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53498. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  53499. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  53500. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  53501. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  53502. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  53503. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  53504. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  53505. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  53506. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  53507. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  53508. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  53509. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  53510. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  53511. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  53512. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  53513. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  53514. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  53515. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  53516. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  53517. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  53518. -----END CERTIFICATE-----
  53519. AffirmTrust Premium ECC
  53520. =======================
  53521. -----BEGIN CERTIFICATE-----
  53522. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  53523. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  53524. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  53525. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  53526. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  53527. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  53528. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  53529. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  53530. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  53531. eQ==
  53532. -----END CERTIFICATE-----
  53533. Certum Trusted Network CA
  53534. =========================
  53535. -----BEGIN CERTIFICATE-----
  53536. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  53537. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  53538. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  53539. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  53540. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53541. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  53542. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  53543. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  53544. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  53545. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  53546. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  53547. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  53548. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  53549. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  53550. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  53551. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  53552. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  53553. -----END CERTIFICATE-----
  53554. TWCA Root Certification Authority
  53555. =================================
  53556. -----BEGIN CERTIFICATE-----
  53557. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  53558. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  53559. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  53560. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  53561. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  53562. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  53563. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  53564. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  53565. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  53566. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  53567. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  53568. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  53569. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  53570. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  53571. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  53572. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  53573. -----END CERTIFICATE-----
  53574. Security Communication RootCA2
  53575. ==============================
  53576. -----BEGIN CERTIFICATE-----
  53577. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  53578. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  53579. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  53580. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  53581. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53582. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  53583. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  53584. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  53585. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  53586. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  53587. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  53588. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  53589. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  53590. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  53591. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  53592. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  53593. -----END CERTIFICATE-----
  53594. EC-ACC
  53595. ======
  53596. -----BEGIN CERTIFICATE-----
  53597. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  53598. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  53599. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  53600. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  53601. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  53602. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  53603. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  53604. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  53605. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  53606. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  53607. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  53608. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  53609. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  53610. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  53611. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  53612. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  53613. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  53614. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  53615. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  53616. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  53617. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  53618. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  53619. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  53620. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  53621. 5EI=
  53622. -----END CERTIFICATE-----
  53623. Hellenic Academic and Research Institutions RootCA 2011
  53624. =======================================================
  53625. -----BEGIN CERTIFICATE-----
  53626. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  53627. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  53628. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53629. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  53630. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53631. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  53632. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53633. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  53634. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  53635. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  53636. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  53637. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  53638. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  53639. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  53640. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  53641. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  53642. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  53643. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  53644. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  53645. -----END CERTIFICATE-----
  53646. Actalis Authentication Root CA
  53647. ==============================
  53648. -----BEGIN CERTIFICATE-----
  53649. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  53650. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  53651. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  53652. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  53653. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  53654. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  53655. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  53656. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  53657. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  53658. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  53659. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  53660. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  53661. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  53662. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  53663. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  53664. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  53665. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  53666. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  53667. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  53668. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  53669. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  53670. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  53671. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  53672. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  53673. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  53674. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  53675. -----END CERTIFICATE-----
  53676. Trustis FPS Root CA
  53677. ===================
  53678. -----BEGIN CERTIFICATE-----
  53679. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  53680. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  53681. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  53682. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  53683. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  53684. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  53685. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  53686. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  53687. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  53688. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  53689. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  53690. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  53691. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  53692. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  53693. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  53694. iB6XzCGcKQENZetX2fNXlrtIzYE=
  53695. -----END CERTIFICATE-----
  53696. Buypass Class 2 Root CA
  53697. =======================
  53698. -----BEGIN CERTIFICATE-----
  53699. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53700. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  53701. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53702. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  53703. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  53704. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  53705. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  53706. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  53707. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  53708. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  53709. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  53710. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  53711. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  53712. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53713. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53714. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  53715. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  53716. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  53717. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  53718. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  53719. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  53720. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  53721. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  53722. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  53723. rJgWVqA=
  53724. -----END CERTIFICATE-----
  53725. Buypass Class 3 Root CA
  53726. =======================
  53727. -----BEGIN CERTIFICATE-----
  53728. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53729. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  53730. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53731. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  53732. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  53733. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  53734. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  53735. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  53736. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  53737. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  53738. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  53739. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  53740. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  53741. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53742. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53743. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  53744. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  53745. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  53746. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  53747. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  53748. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  53749. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  53750. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  53751. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  53752. Cp/HuZc=
  53753. -----END CERTIFICATE-----
  53754. T-TeleSec GlobalRoot Class 3
  53755. ============================
  53756. -----BEGIN CERTIFICATE-----
  53757. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53758. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53759. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  53760. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53761. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53762. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  53763. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  53764. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  53765. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  53766. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  53767. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  53768. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  53769. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  53770. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  53771. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  53772. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  53773. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  53774. -----END CERTIFICATE-----
  53775. EE Certification Centre Root CA
  53776. ===============================
  53777. -----BEGIN CERTIFICATE-----
  53778. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  53779. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  53780. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  53781. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  53782. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  53783. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  53784. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  53785. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  53786. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  53787. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  53788. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  53789. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  53790. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  53791. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  53792. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  53793. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  53794. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  53795. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  53796. dcGWxZ0=
  53797. -----END CERTIFICATE-----
  53798. D-TRUST Root Class 3 CA 2 2009
  53799. ==============================
  53800. -----BEGIN CERTIFICATE-----
  53801. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53802. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  53803. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  53804. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  53805. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  53806. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  53807. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  53808. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  53809. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  53810. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  53811. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  53812. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  53813. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  53814. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  53815. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  53816. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  53817. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  53818. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  53819. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  53820. -----END CERTIFICATE-----
  53821. D-TRUST Root Class 3 CA 2 EV 2009
  53822. =================================
  53823. -----BEGIN CERTIFICATE-----
  53824. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53825. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53826. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53827. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53828. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  53829. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  53830. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  53831. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  53832. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  53833. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  53834. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  53835. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  53836. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  53837. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  53838. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  53839. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  53840. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  53841. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  53842. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  53843. w9y4AyHqnxbxLFS1
  53844. -----END CERTIFICATE-----
  53845. CA Disig Root R2
  53846. ================
  53847. -----BEGIN CERTIFICATE-----
  53848. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  53849. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  53850. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  53851. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  53852. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  53853. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  53854. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  53855. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  53856. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  53857. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  53858. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  53859. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  53860. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  53861. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  53862. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  53863. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  53864. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  53865. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  53866. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  53867. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  53868. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  53869. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  53870. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  53871. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  53872. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  53873. -----END CERTIFICATE-----
  53874. ACCVRAIZ1
  53875. =========
  53876. -----BEGIN CERTIFICATE-----
  53877. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  53878. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  53879. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  53880. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  53881. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  53882. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  53883. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  53884. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  53885. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  53886. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  53887. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  53888. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  53889. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  53890. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  53891. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  53892. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  53893. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  53894. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  53895. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  53896. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  53897. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  53898. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  53899. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  53900. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  53901. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  53902. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  53903. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  53904. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  53905. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  53906. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  53907. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  53908. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  53909. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  53910. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  53911. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  53912. EfbRD0tVNEYqi4Y7
  53913. -----END CERTIFICATE-----
  53914. TWCA Global Root CA
  53915. ===================
  53916. -----BEGIN CERTIFICATE-----
  53917. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  53918. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  53919. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  53920. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  53921. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  53922. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  53923. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  53924. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  53925. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  53926. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  53927. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  53928. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  53929. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  53930. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  53931. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  53932. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  53933. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  53934. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  53935. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  53936. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  53937. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  53938. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  53939. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  53940. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  53941. -----END CERTIFICATE-----
  53942. TeliaSonera Root CA v1
  53943. ======================
  53944. -----BEGIN CERTIFICATE-----
  53945. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  53946. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  53947. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  53948. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  53949. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  53950. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  53951. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  53952. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  53953. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  53954. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  53955. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  53956. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  53957. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  53958. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  53959. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  53960. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  53961. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  53962. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  53963. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  53964. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  53965. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  53966. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  53967. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  53968. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  53969. -----END CERTIFICATE-----
  53970. E-Tugra Certification Authority
  53971. ===============================
  53972. -----BEGIN CERTIFICATE-----
  53973. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  53974. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  53975. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  53976. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  53977. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  53978. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  53979. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  53980. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53981. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  53982. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  53983. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  53984. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  53985. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  53986. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  53987. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  53988. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  53989. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  53990. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  53991. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  53992. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  53993. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  53994. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  53995. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  53996. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  53997. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  53998. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  53999. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  54000. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  54001. C7TbO6Orb1wdtn7os4I07QZcJA==
  54002. -----END CERTIFICATE-----
  54003. T-TeleSec GlobalRoot Class 2
  54004. ============================
  54005. -----BEGIN CERTIFICATE-----
  54006. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54007. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54008. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  54009. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54010. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54011. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  54012. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  54013. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  54014. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  54015. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  54016. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  54017. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  54018. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  54019. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  54020. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  54021. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  54022. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  54023. -----END CERTIFICATE-----
  54024. Atos TrustedRoot 2011
  54025. =====================
  54026. -----BEGIN CERTIFICATE-----
  54027. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  54028. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  54029. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  54030. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  54031. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  54032. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  54033. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  54034. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  54035. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  54036. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  54037. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  54038. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  54039. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  54040. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  54041. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  54042. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  54043. -----END CERTIFICATE-----
  54044. QuoVadis Root CA 1 G3
  54045. =====================
  54046. -----BEGIN CERTIFICATE-----
  54047. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54048. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54049. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  54050. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  54051. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  54052. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  54053. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  54054. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  54055. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  54056. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  54057. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  54058. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  54059. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  54060. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54061. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  54062. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  54063. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  54064. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  54065. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  54066. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  54067. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  54068. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  54069. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  54070. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  54071. hMJKzRwuJIczYOXD
  54072. -----END CERTIFICATE-----
  54073. QuoVadis Root CA 2 G3
  54074. =====================
  54075. -----BEGIN CERTIFICATE-----
  54076. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54077. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54078. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  54079. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  54080. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  54081. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  54082. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  54083. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  54084. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  54085. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  54086. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  54087. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  54088. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  54089. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54090. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  54091. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  54092. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  54093. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  54094. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  54095. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  54096. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  54097. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  54098. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  54099. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  54100. O3jtZsSOeWmD3n+M
  54101. -----END CERTIFICATE-----
  54102. QuoVadis Root CA 3 G3
  54103. =====================
  54104. -----BEGIN CERTIFICATE-----
  54105. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  54106. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54107. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  54108. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  54109. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  54110. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  54111. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  54112. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  54113. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  54114. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  54115. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  54116. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  54117. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  54118. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54119. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  54120. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  54121. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  54122. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  54123. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  54124. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  54125. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  54126. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  54127. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  54128. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  54129. PpxxVJkES/1Y+Zj0
  54130. -----END CERTIFICATE-----
  54131. DigiCert Assured ID Root G2
  54132. ===========================
  54133. -----BEGIN CERTIFICATE-----
  54134. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  54135. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54136. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  54137. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54138. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  54139. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  54140. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  54141. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  54142. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  54143. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  54144. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  54145. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  54146. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  54147. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  54148. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  54149. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  54150. IhNzbM8m9Yop5w==
  54151. -----END CERTIFICATE-----
  54152. DigiCert Assured ID Root G3
  54153. ===========================
  54154. -----BEGIN CERTIFICATE-----
  54155. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  54156. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  54157. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54158. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54159. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  54160. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  54161. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  54162. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  54163. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  54164. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  54165. 1vUhZscv6pZjamVFkpUBtA==
  54166. -----END CERTIFICATE-----
  54167. DigiCert Global Root G2
  54168. =======================
  54169. -----BEGIN CERTIFICATE-----
  54170. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  54171. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54172. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  54173. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54174. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  54175. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  54176. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  54177. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  54178. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  54179. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  54180. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  54181. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  54182. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  54183. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  54184. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  54185. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  54186. MrY=
  54187. -----END CERTIFICATE-----
  54188. DigiCert Global Root G3
  54189. =======================
  54190. -----BEGIN CERTIFICATE-----
  54191. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  54192. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  54193. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  54194. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  54195. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  54196. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  54197. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  54198. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  54199. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  54200. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  54201. VOKa5Vt8sycX
  54202. -----END CERTIFICATE-----
  54203. DigiCert Trusted Root G4
  54204. ========================
  54205. -----BEGIN CERTIFICATE-----
  54206. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  54207. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  54208. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54209. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54210. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  54211. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  54212. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  54213. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  54214. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  54215. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  54216. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  54217. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  54218. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  54219. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  54220. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  54221. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  54222. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  54223. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  54224. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  54225. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  54226. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  54227. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  54228. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  54229. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  54230. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  54231. 82Z+
  54232. -----END CERTIFICATE-----
  54233. COMODO RSA Certification Authority
  54234. ==================================
  54235. -----BEGIN CERTIFICATE-----
  54236. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  54237. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54238. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  54239. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  54240. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54241. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  54242. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  54243. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  54244. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  54245. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  54246. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  54247. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  54248. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  54249. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  54250. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  54251. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  54252. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  54253. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  54254. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  54255. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  54256. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  54257. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  54258. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  54259. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  54260. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  54261. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  54262. LaZRfyHBNVOFBkpdn627G190
  54263. -----END CERTIFICATE-----
  54264. USERTrust RSA Certification Authority
  54265. =====================================
  54266. -----BEGIN CERTIFICATE-----
  54267. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  54268. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54269. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54270. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  54271. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54272. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54273. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  54274. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  54275. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  54276. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  54277. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  54278. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  54279. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  54280. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  54281. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  54282. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  54283. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  54284. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  54285. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  54286. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  54287. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  54288. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  54289. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  54290. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  54291. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  54292. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  54293. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  54294. -----END CERTIFICATE-----
  54295. USERTrust ECC Certification Authority
  54296. =====================================
  54297. -----BEGIN CERTIFICATE-----
  54298. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  54299. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54300. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54301. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  54302. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54303. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54304. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  54305. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  54306. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  54307. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  54308. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  54309. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  54310. -----END CERTIFICATE-----
  54311. GlobalSign ECC Root CA - R4
  54312. ===========================
  54313. -----BEGIN CERTIFICATE-----
  54314. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  54315. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54316. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54317. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54318. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  54319. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  54320. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  54321. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  54322. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  54323. -----END CERTIFICATE-----
  54324. GlobalSign ECC Root CA - R5
  54325. ===========================
  54326. -----BEGIN CERTIFICATE-----
  54327. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  54328. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54329. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54330. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54331. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  54332. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  54333. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  54334. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  54335. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  54336. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  54337. -----END CERTIFICATE-----
  54338. Staat der Nederlanden Root CA - G3
  54339. ==================================
  54340. -----BEGIN CERTIFICATE-----
  54341. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54342. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54343. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  54344. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  54345. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  54346. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  54347. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  54348. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  54349. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  54350. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  54351. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  54352. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  54353. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  54354. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  54355. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  54356. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  54357. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  54358. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  54359. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  54360. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  54361. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  54362. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  54363. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  54364. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  54365. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  54366. -----END CERTIFICATE-----
  54367. Staat der Nederlanden EV Root CA
  54368. ================================
  54369. -----BEGIN CERTIFICATE-----
  54370. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54371. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54372. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  54373. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  54374. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  54375. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  54376. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  54377. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  54378. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  54379. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  54380. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  54381. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  54382. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  54383. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  54384. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  54385. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  54386. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  54387. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  54388. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  54389. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  54390. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  54391. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  54392. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  54393. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  54394. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  54395. -----END CERTIFICATE-----
  54396. IdenTrust Commercial Root CA 1
  54397. ==============================
  54398. -----BEGIN CERTIFICATE-----
  54399. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  54400. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  54401. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  54402. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  54403. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  54404. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  54405. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  54406. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  54407. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  54408. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  54409. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  54410. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  54411. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  54412. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  54413. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  54414. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  54415. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  54416. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  54417. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  54418. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  54419. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  54420. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  54421. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  54422. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  54423. cGzM7vRX+Bi6hG6H
  54424. -----END CERTIFICATE-----
  54425. IdenTrust Public Sector Root CA 1
  54426. =================================
  54427. -----BEGIN CERTIFICATE-----
  54428. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  54429. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  54430. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  54431. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  54432. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  54433. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  54434. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  54435. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  54436. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  54437. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  54438. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  54439. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  54440. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  54441. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  54442. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  54443. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  54444. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  54445. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  54446. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  54447. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  54448. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  54449. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  54450. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  54451. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  54452. 3Wl9af0AVqW3rLatt8o+Ae+c
  54453. -----END CERTIFICATE-----
  54454. Entrust Root Certification Authority - G2
  54455. =========================================
  54456. -----BEGIN CERTIFICATE-----
  54457. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  54458. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  54459. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  54460. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  54461. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  54462. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  54463. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  54464. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  54465. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  54466. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  54467. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  54468. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  54469. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  54470. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  54471. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  54472. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  54473. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  54474. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  54475. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  54476. e4pIb4tF9g==
  54477. -----END CERTIFICATE-----
  54478. Entrust Root Certification Authority - EC1
  54479. ==========================================
  54480. -----BEGIN CERTIFICATE-----
  54481. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  54482. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  54483. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  54484. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54485. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  54486. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  54487. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  54488. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  54489. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  54490. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  54491. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  54492. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  54493. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  54494. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  54495. -----END CERTIFICATE-----
  54496. CFCA EV ROOT
  54497. ============
  54498. -----BEGIN CERTIFICATE-----
  54499. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  54500. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  54501. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  54502. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  54503. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  54504. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  54505. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  54506. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  54507. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  54508. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  54509. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  54510. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  54511. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  54512. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  54513. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  54514. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  54515. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  54516. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  54517. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  54518. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  54519. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  54520. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  54521. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  54522. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  54523. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  54524. -----END CERTIFICATE-----
  54525. Certinomis - Root CA
  54526. ====================
  54527. -----BEGIN CERTIFICATE-----
  54528. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  54529. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  54530. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  54531. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  54532. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  54533. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  54534. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  54535. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  54536. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  54537. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  54538. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  54539. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  54540. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  54541. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  54542. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  54543. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  54544. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  54545. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  54546. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  54547. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  54548. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  54549. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  54550. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  54551. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  54552. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  54553. hkIGuUE=
  54554. -----END CERTIFICATE-----
  54555. OISTE WISeKey Global Root GB CA
  54556. ===============================
  54557. -----BEGIN CERTIFICATE-----
  54558. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  54559. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  54560. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  54561. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  54562. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  54563. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  54564. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  54565. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  54566. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  54567. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  54568. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  54569. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  54570. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  54571. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  54572. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  54573. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  54574. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  54575. -----END CERTIFICATE-----
  54576. SZAFIR ROOT CA2
  54577. ===============
  54578. -----BEGIN CERTIFICATE-----
  54579. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  54580. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  54581. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  54582. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  54583. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  54584. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  54585. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  54586. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  54587. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  54588. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  54589. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  54590. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  54591. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  54592. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  54593. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  54594. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  54595. -----END CERTIFICATE-----
  54596. Certum Trusted Network CA 2
  54597. ===========================
  54598. -----BEGIN CERTIFICATE-----
  54599. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  54600. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  54601. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  54602. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  54603. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  54604. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  54605. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  54606. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  54607. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  54608. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  54609. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  54610. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  54611. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  54612. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  54613. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  54614. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54615. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  54616. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  54617. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  54618. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  54619. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  54620. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  54621. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  54622. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  54623. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  54624. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  54625. zAYspsbiDrW5viSP
  54626. -----END CERTIFICATE-----
  54627. Hellenic Academic and Research Institutions RootCA 2015
  54628. =======================================================
  54629. -----BEGIN CERTIFICATE-----
  54630. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  54631. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  54632. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  54633. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  54634. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  54635. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  54636. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  54637. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  54638. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  54639. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  54640. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  54641. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  54642. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  54643. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  54644. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  54645. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  54646. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54647. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  54648. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  54649. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  54650. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  54651. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  54652. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  54653. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  54654. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  54655. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  54656. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  54657. p/UsQu0yrbYhnr68
  54658. -----END CERTIFICATE-----
  54659. Hellenic Academic and Research Institutions ECC RootCA 2015
  54660. ===========================================================
  54661. -----BEGIN CERTIFICATE-----
  54662. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  54663. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  54664. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  54665. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  54666. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  54667. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  54668. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  54669. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  54670. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  54671. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  54672. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  54673. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  54674. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  54675. -----END CERTIFICATE-----
  54676. ISRG Root X1
  54677. ============
  54678. -----BEGIN CERTIFICATE-----
  54679. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  54680. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  54681. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  54682. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  54683. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  54684. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  54685. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  54686. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  54687. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  54688. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  54689. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  54690. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  54691. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  54692. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  54693. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  54694. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  54695. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  54696. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  54697. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  54698. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  54699. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  54700. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  54701. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  54702. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  54703. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  54704. -----END CERTIFICATE-----
  54705. AC RAIZ FNMT-RCM
  54706. ================
  54707. -----BEGIN CERTIFICATE-----
  54708. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  54709. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  54710. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  54711. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54712. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  54713. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  54714. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  54715. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  54716. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  54717. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  54718. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  54719. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  54720. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  54721. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  54722. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  54723. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  54724. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  54725. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  54726. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  54727. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  54728. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  54729. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  54730. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  54731. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  54732. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  54733. -----END CERTIFICATE-----
  54734. Amazon Root CA 1
  54735. ================
  54736. -----BEGIN CERTIFICATE-----
  54737. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  54738. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  54739. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54740. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54741. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  54742. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  54743. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  54744. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  54745. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  54746. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  54747. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  54748. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  54749. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  54750. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  54751. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  54752. -----END CERTIFICATE-----
  54753. Amazon Root CA 2
  54754. ================
  54755. -----BEGIN CERTIFICATE-----
  54756. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  54757. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  54758. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54759. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54760. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  54761. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  54762. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  54763. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  54764. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  54765. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  54766. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  54767. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  54768. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  54769. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  54770. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  54771. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  54772. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  54773. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  54774. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  54775. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  54776. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  54777. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  54778. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  54779. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  54780. -----END CERTIFICATE-----
  54781. Amazon Root CA 3
  54782. ================
  54783. -----BEGIN CERTIFICATE-----
  54784. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  54785. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  54786. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54787. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  54788. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  54789. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  54790. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  54791. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  54792. -----END CERTIFICATE-----
  54793. Amazon Root CA 4
  54794. ================
  54795. -----BEGIN CERTIFICATE-----
  54796. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  54797. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  54798. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54799. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  54800. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  54801. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  54802. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  54803. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  54804. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  54805. -----END CERTIFICATE-----
  54806. LuxTrust Global Root 2
  54807. ======================
  54808. -----BEGIN CERTIFICATE-----
  54809. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  54810. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  54811. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  54812. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  54813. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  54814. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  54815. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  54816. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  54817. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  54818. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  54819. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  54820. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  54821. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  54822. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  54823. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  54824. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  54825. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  54826. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  54827. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  54828. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  54829. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  54830. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  54831. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  54832. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  54833. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  54834. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  54835. -----END CERTIFICATE-----
  54836. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  54837. =============================================
  54838. -----BEGIN CERTIFICATE-----
  54839. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  54840. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  54841. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  54842. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  54843. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  54844. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  54845. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  54846. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  54847. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54848. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  54849. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  54850. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  54851. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  54852. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  54853. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  54854. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  54855. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  54856. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  54857. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  54858. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  54859. -----END CERTIFICATE-----
  54860. GDCA TrustAUTH R5 ROOT
  54861. ======================
  54862. -----BEGIN CERTIFICATE-----
  54863. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  54864. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  54865. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  54866. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  54867. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  54868. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  54869. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  54870. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  54871. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  54872. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  54873. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  54874. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  54875. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  54876. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  54877. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  54878. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  54879. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  54880. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  54881. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  54882. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  54883. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  54884. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  54885. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  54886. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  54887. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  54888. -----END CERTIFICATE-----
  54889. TrustCor RootCert CA-1
  54890. ======================
  54891. -----BEGIN CERTIFICATE-----
  54892. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  54893. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54894. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54895. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  54896. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  54897. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  54898. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  54899. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  54900. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  54901. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  54902. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  54903. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  54904. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  54905. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54906. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  54907. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  54908. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  54909. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  54910. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  54911. -----END CERTIFICATE-----
  54912. TrustCor RootCert CA-2
  54913. ======================
  54914. -----BEGIN CERTIFICATE-----
  54915. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  54916. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  54917. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  54918. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  54919. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  54920. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  54921. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  54922. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  54923. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  54924. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  54925. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  54926. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  54927. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  54928. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  54929. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  54930. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  54931. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  54932. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  54933. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  54934. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  54935. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  54936. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  54937. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  54938. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  54939. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  54940. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  54941. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  54942. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  54943. -----END CERTIFICATE-----
  54944. TrustCor ECA-1
  54945. ==============
  54946. -----BEGIN CERTIFICATE-----
  54947. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  54948. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54949. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54950. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  54951. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  54952. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  54953. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  54954. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  54955. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  54956. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  54957. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  54958. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  54959. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  54960. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  54961. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  54962. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  54963. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  54964. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  54965. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  54966. -----END CERTIFICATE-----
  54967. SSL.com Root Certification Authority RSA
  54968. ========================================
  54969. -----BEGIN CERTIFICATE-----
  54970. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  54971. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  54972. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  54973. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  54974. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  54975. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  54976. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  54977. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  54978. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  54979. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  54980. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  54981. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  54982. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  54983. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  54984. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  54985. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  54986. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  54987. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  54988. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  54989. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  54990. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  54991. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  54992. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  54993. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  54994. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  54995. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  54996. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  54997. -----END CERTIFICATE-----
  54998. SSL.com Root Certification Authority ECC
  54999. ========================================
  55000. -----BEGIN CERTIFICATE-----
  55001. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  55002. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  55003. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  55004. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  55005. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  55006. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  55007. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  55008. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  55009. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  55010. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  55011. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  55012. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  55013. -----END CERTIFICATE-----
  55014. SSL.com EV Root Certification Authority RSA R2
  55015. ==============================================
  55016. -----BEGIN CERTIFICATE-----
  55017. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  55018. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  55019. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  55020. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  55021. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  55022. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  55023. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  55024. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  55025. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  55026. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  55027. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  55028. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  55029. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  55030. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  55031. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  55032. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  55033. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  55034. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  55035. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  55036. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  55037. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  55038. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  55039. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  55040. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  55041. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  55042. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  55043. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  55044. -----END CERTIFICATE-----
  55045. SSL.com EV Root Certification Authority ECC
  55046. ===========================================
  55047. -----BEGIN CERTIFICATE-----
  55048. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  55049. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  55050. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  55051. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55052. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  55053. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  55054. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  55055. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  55056. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  55057. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  55058. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  55059. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  55060. -----END CERTIFICATE-----
  55061. GlobalSign Root CA - R6
  55062. =======================
  55063. -----BEGIN CERTIFICATE-----
  55064. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  55065. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  55066. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  55067. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  55068. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  55069. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  55070. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  55071. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  55072. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  55073. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  55074. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  55075. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  55076. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  55077. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  55078. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  55079. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  55080. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  55081. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  55082. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  55083. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  55084. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  55085. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  55086. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  55087. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  55088. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  55089. -----END CERTIFICATE-----
  55090. OISTE WISeKey Global Root GC CA
  55091. ===============================
  55092. -----BEGIN CERTIFICATE-----
  55093. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  55094. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  55095. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  55096. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  55097. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  55098. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  55099. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  55100. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55101. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  55102. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  55103. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  55104. -----END CERTIFICATE-----
  55105. GTS Root R1
  55106. ===========
  55107. -----BEGIN CERTIFICATE-----
  55108. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55109. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55110. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55111. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  55112. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  55113. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  55114. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  55115. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  55116. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  55117. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  55118. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  55119. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  55120. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  55121. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55122. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  55123. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  55124. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  55125. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  55126. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  55127. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  55128. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  55129. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  55130. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  55131. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  55132. CFF1pkgl
  55133. -----END CERTIFICATE-----
  55134. GTS Root R2
  55135. ===========
  55136. -----BEGIN CERTIFICATE-----
  55137. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55138. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55139. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55140. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  55141. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  55142. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  55143. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  55144. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  55145. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  55146. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  55147. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  55148. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  55149. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  55150. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55151. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  55152. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  55153. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  55154. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  55155. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  55156. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  55157. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  55158. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  55159. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  55160. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  55161. o/DUhgkC
  55162. -----END CERTIFICATE-----
  55163. GTS Root R3
  55164. ===========
  55165. -----BEGIN CERTIFICATE-----
  55166. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55167. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55168. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55169. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  55170. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  55171. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  55172. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  55173. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  55174. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  55175. KaqW04MjyaR7YbPMAuhd
  55176. -----END CERTIFICATE-----
  55177. GTS Root R4
  55178. ===========
  55179. -----BEGIN CERTIFICATE-----
  55180. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55181. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55182. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55183. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  55184. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  55185. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  55186. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  55187. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  55188. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  55189. zPKwTdb+mciUqXWi4w==
  55190. -----END CERTIFICATE-----
  55191. UCA Global G2 Root
  55192. ==================
  55193. -----BEGIN CERTIFICATE-----
  55194. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  55195. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  55196. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  55197. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55198. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  55199. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  55200. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  55201. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  55202. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  55203. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  55204. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  55205. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  55206. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  55207. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  55208. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  55209. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  55210. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  55211. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  55212. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  55213. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  55214. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  55215. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  55216. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  55217. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  55218. -----END CERTIFICATE-----
  55219. UCA Extended Validation Root
  55220. ============================
  55221. -----BEGIN CERTIFICATE-----
  55222. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  55223. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  55224. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  55225. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  55226. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  55227. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  55228. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  55229. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  55230. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  55231. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  55232. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  55233. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  55234. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  55235. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  55236. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  55237. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  55238. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  55239. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  55240. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  55241. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  55242. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  55243. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  55244. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  55245. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  55246. dhh2n1ax
  55247. -----END CERTIFICATE-----
  55248. Certigna Root CA
  55249. ================
  55250. -----BEGIN CERTIFICATE-----
  55251. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  55252. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  55253. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  55254. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  55255. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55256. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  55257. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  55258. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  55259. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  55260. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  55261. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  55262. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  55263. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  55264. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  55265. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  55266. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  55267. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  55268. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  55269. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  55270. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  55271. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  55272. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  55273. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  55274. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  55275. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  55276. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  55277. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  55278. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  55279. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  55280. -----END CERTIFICATE-----
  55281. <?php
  55282. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  55283. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  55284. }
  55285. setlocale(LC_ALL, 'C');
  55286. require __DIR__.'/../src/bootstrap.php';
  55287. use Composer\Console\Application;
  55288. use Composer\XdebugHandler\XdebugHandler;
  55289. error_reporting(-1);
  55290. // Restart without xdebug
  55291. $xdebug = new XdebugHandler('Composer', '--ansi');
  55292. $xdebug->check();
  55293. unset($xdebug);
  55294. if (function_exists('ini_set')) {
  55295. @ini_set('display_errors', 1);
  55296. $memoryInBytes = function ($value) {
  55297. $unit = strtolower(substr($value, -1, 1));
  55298. $value = (int) $value;
  55299. switch($unit) {
  55300. case 'g':
  55301. $value *= 1024;
  55302. // no break (cumulative multiplier)
  55303. case 'm':
  55304. $value *= 1024;
  55305. // no break (cumulative multiplier)
  55306. case 'k':
  55307. $value *= 1024;
  55308. }
  55309. return $value;
  55310. };
  55311. $memoryLimit = trim(ini_get('memory_limit'));
  55312. // Increase memory_limit if it is lower than 1.5GB
  55313. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  55314. @ini_set('memory_limit', '1536M');
  55315. }
  55316. // Set user defined memory limit
  55317. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  55318. @ini_set('memory_limit', $memoryLimit);
  55319. }
  55320. unset($memoryInBytes, $memoryLimit);
  55321. }
  55322. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  55323. // run the command application
  55324. $application = new Application();
  55325. $application->run();
  55326. Copyright (c) Nils Adermann, Jordi Boggiano
  55327. Permission is hereby granted, free of charge, to any person obtaining a copy
  55328. of this software and associated documentation files (the "Software"), to deal
  55329. in the Software without restriction, including without limitation the rights
  55330. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  55331. copies of the Software, and to permit persons to whom the Software is furnished
  55332. to do so, subject to the following conditions:
  55333. The above copyright notice and this permission notice shall be included in all
  55334. copies or substantial portions of the Software.
  55335. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  55336. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  55337. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55338. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  55339. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  55340. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  55341. THE SOFTWARE.
  55342. “P½›wr�E²"#T¶AšT ����GBMB